[hackers] [scc] Create a list of flag macros || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 19 Jul 2015 09:48:32 +0200 (CEST)

commit 766c342d4a6d02f37a9f66c75a696530a36cdc24
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sun Jul 19 09:22:59 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sun Jul 19 09:31:28 2015 +0200

    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.

diff --git a/cc1/cpp.c b/cc1/cpp.c
index 59ab331..c86002f 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -40,20 +40,26 @@ icpp(void)
         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
Received on Sun Jul 19 2015 - 09:48:32 CEST

This archive was generated by hypermail 2.3.0 : Sun Jul 19 2015 - 10:00:16 CEST