commit 660288e9ac9bb504280b5051a3e1d83bce617765
Author:     Roberto E. Vargas Caballero <k...@shike2.com>
AuthorDate: Fri Jul 17 22:55:00 2015 +0200
Commit:     Roberto E. Vargas Caballero <k...@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
@@ -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
@@ -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)
@@ -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
@@ -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}

Reply via email to