URI:
       cc1: Warn only in different macro redefinitions - scc - simple c99 compiler
  HTML git clone git://git.simple-cc.org/scc
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 28c274e634e5bb1a8a99ee403f1373b6db7fcd07
   DIR parent 40275b12f4b192d63d7d6702fd3caaa8eb3f5bc5
  HTML Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
       Date:   Wed, 18 Feb 2026 19:45:06 +0100
       
       cc1: Warn only in different macro redefinitions
       
       The standard says that redefining a macro with a different value is undefined
       behaviour. Scc uses to warn in any redefinition of macros, but as there are
       some projects that like to redefine them continously this generated too much
       noise, and this commit moved the warning to only when the defintion is different.
       
       Diffstat:
         M src/cmd/scc-cc/cc1/cpp.c            |      17 ++++++++++-------
       
       1 file changed, 10 insertions(+), 7 deletions(-)
       ---
   DIR diff --git a/src/cmd/scc-cc/cc1/cpp.c b/src/cmd/scc-cc/cc1/cpp.c
       @@ -645,13 +645,6 @@ define(void)
                        return;
                }
                sym = yylval.sym;
       -        if (sym->flags & SDECLARED) {
       -                warn("'%s' redefined", yytext);
       -                free(sym->u.s);
       -        } else {
       -                sym = install(NS_CPP, sym);
       -                sym->flags |= SDECLARED|SSTRING;
       -        }
        
                namespace = NS_IDEN;       /* Avoid polution in NS_CPP */
                if ((n = getpars(args)) == NR_MACROARG)
       @@ -662,6 +655,16 @@ define(void)
                sprintf(buff, "%02d#", n);
                if (!getdefs(args, n, buff+3, LINESIZ-3))
                        goto delete;
       +
       +        if (sym->flags & SDECLARED) {
       +                if (strcmp(sym->u.s, buff) != 0)
       +                        warn("'%s' redefined", sym->name);
       +                free(sym->u.s);
       +        } else {
       +                sym = install(NS_CPP, sym);
       +                sym->flags |= SDECLARED|SSTRING;
       +        }
       +
                sym->u.s = xstrdup(buff);
                DBG("MACRO '%s' defined as '%s'", sym->name, buff);
                return;