[hackers] [scc] Add #endif clauses || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 18 Jul 2015 07:32:10 +0200 (CEST)

commit 660288e9ac9bb504280b5051a3e1d83bce617765
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Jul 17 22:55:00 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Jul 17 23:14:53 2015 +0200

    Add #endif clauses
    
    I forgot it in the rewriting ^^!!!!.

diff --git a/cc1/cc1.h b/cc1/cc1.h
index 518ed6a..1f1d7f4 100644
--- a/cc1/cc1.h
+++ b/cc1/cc1.h
_AT_@ -202,6 +202,7 @@ enum tokens {
         IFDEF,
         IFNDEF,
         UNDEF,
+ ENDIF,
         EOFTOK
 };
 
diff --git a/cc1/cpp.c b/cc1/cpp.c
index a81b5cc..b66c45b 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -477,6 +477,15 @@ ifndef(void)
 }
 
 static void
+endif(void)
+{
+ if (cppctx == 0)
+ error("#endif without #if");
+ if (!ifstatus[--cppctx])
+ --cppoff;
+}
+
+static void
 elseclause(void)
 {
         if (cppctx == 0)
_AT_@ -513,6 +522,7 @@ cpp(void)
                 {IFDEF, ifdef},
                 {IFNDEF, ifndef},
                 {ELSE, elseclause},
+ {ENDIF, endif},
                 {UNDEF, undef},
                 {PRAGMA, pragma},
                 {ERROR, usererr},
diff --git a/cc1/symbol.c b/cc1/symbol.c
index c869cd6..01d8053 100644
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
_AT_@ -235,6 +235,7 @@ ikeywords(void)
                 {"ifdef", IFDEF, IFDEF},
                 {"else", ELSE, ELSE},
                 {"ifndef", IFNDEF, IFNDEF},
+ {"endif", ENDIF, ENDIF},
                 {"undef", UNDEF, UNDEF},
                 {"pragma", PRAGMA, PRAGMA},
                 {"error", ERROR, ERROR}
Received on Sat Jul 18 2015 - 07:32:10 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 18 2015 - 07:36:22 CEST