shithub: scc

Download patch

ref: 766c342d4a6d02f37a9f66c75a696530a36cdc24
parent: 2d77075828c480d5cb0ad3ddb40199ccbbcc27b1
author: Roberto E. Vargas Caballero <[email protected]>
date: Sun Jul 19 05:22:59 EDT 2015

Create a list of flag macros

We will have to create more of this macros that are used as
flags, so it is better to have a list and a loop over them.

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -40,20 +40,26 @@
 	static char sdate[17], stime[14];
 	struct tm *tm;
 	time_t t;
+	char **bp, *list[] = {
+		"__STDC__",
+		"__STDC_HOSTED__",
+		"__SCC__",
+		NULL
+	};
 
 	t = time(NULL);
 	tm = localtime(&t);
 	strftime(sdate, sizeof(sdate), "-1#\"%b %d %Y\"", tm);
 	strftime(stime, sizeof(stime), "-1#\"%H:%M:%S\"", tm);
-
-	defmacro("__STDC__")->u.s = "-1#1";
-	defmacro("__SCC__")->u.s = "-1#1";
 	defmacro("__DATE__")->u.s = sdate;
 	defmacro("__TIME__")->u.s = stime;
-	defmacro("__STDC_HOSTED__")->u.s = "-1#1";
+
 	defmacro("__STDC_VERSION__")->u.s = "-1#199409L";
 	symline = defmacro("__LINE__");
 	symfile = defmacro("__FILE__");
+
+	for (bp = list; *bp; ++bp)
+		defmacro(*bp)->u.s = "-1#1";
 }
 
 static void