shithub: scc

Download patch

ref: 660288e9ac9bb504280b5051a3e1d83bce617765
parent: 50b60a65075cc74836becee050eb87f11642da75
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Jul 17 18:55:00 EDT 2015

Add #endif clauses

I forgot it in the rewriting ^^!!!!.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -202,6 +202,7 @@
 	IFDEF,
 	IFNDEF,
 	UNDEF,
+	ENDIF,
 	EOFTOK
 };
 
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -477,6 +477,15 @@
 }
 
 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 @@
 		{IFDEF, ifdef},
 		{IFNDEF, ifndef},
 		{ELSE, elseclause},
+		{ENDIF, endif},
 		{UNDEF, undef},
 		{PRAGMA, pragma},
 		{ERROR, usererr},
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -235,6 +235,7 @@
 		{"ifdef", IFDEF, IFDEF},
 		{"else", ELSE, ELSE},
 		{"ifndef", IFNDEF, IFNDEF},
+		{"endif", ENDIF, ENDIF},
 		{"undef", UNDEF, UNDEF},
 		{"pragma", PRAGMA, PRAGMA},
 		{"error", ERROR, ERROR}