shithub: scc

Download patch

ref: aaf9dd81207b3944018233ca15f6befa871aaf0f
parent: 167690b43dd4a0f6279bd9e8dd6f4aa84a3ca375
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Jul 27 06:56:43 EDT 2015

Add #elif

The implemetation of elif is really easy, it is a #else chained
with a #if.

--- a/cc1/cc1.h
+++ b/cc1/cc1.h
@@ -214,6 +214,7 @@
 	PRAGMA,
 	ERROR,
 	IFDEF,
+	ELIF,
 	IFNDEF,
 	UNDEF,
 	ENDIF,
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -522,6 +522,13 @@
 }
 
 static void
+elif(void)
+{
+	elseclause();
+	ifclause(0, 0);
+}
+
+static void
 undef(void)
 {
 	Symbol *sym;
@@ -549,6 +556,7 @@
 		{LINE, line},
 		{IFDEF, ifdef},
 		{IF, cppif},
+		{ELIF, elif},
 		{IFNDEF, ifndef},
 		{ELSE, elseclause},
 		{ENDIF, endif},
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -263,6 +263,7 @@
 		{"line", LINE, LINE},
 		{"ifdef", IFDEF, IFDEF},
 		{"if", IF, IF},
+		{"elif", ELIF, ELIF},
 		{"else", ELSE, ELSE},
 		{"ifndef", IFNDEF, IFNDEF},
 		{"endif", ENDIF, ENDIF},