Don't put comments in macro expansions with -C -- if the comment spans
authorDonn Seeley <donn@ucbvax.Berkeley.EDU>
Sun, 27 Apr 1986 19:02:04 +0000 (11:02 -0800)
committerDonn Seeley <donn@ucbvax.Berkeley.EDU>
Sun, 27 Apr 1986 19:02:04 +0000 (11:02 -0800)
multiple lines, lint's line numbers get screwed up.

SCCS-vsn: old/cpp/cpp.c 1.14

usr/src/old/cpp/cpp.c

index 9485529..6094ba5 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)cpp.c      1.13 %G%";
+static char sccsid[] = "@(#)cpp.c      1.14 %G%";
 #endif lint
 
 #ifdef FLEXNAMES
 #endif lint
 
 #ifdef FLEXNAMES
@@ -642,11 +642,15 @@ dodef(p) char *p; {/* process '#define' */
        char *space, *newspace;
        char *formal[MAXFRM]; /* formal[n] is name of nth formal */
        char formtxt[BUFSIZ]; /* space for formal names */
        char *space, *newspace;
        char *formal[MAXFRM]; /* formal[n] is name of nth formal */
        char formtxt[BUFSIZ]; /* space for formal names */
+       int opt_passcom=passcom;
+
+       passcom=0;      /* don't put comments in macro expansions */
 
        ++flslvl; /* prevent macro expansion during 'define' */
        p=skipbl(p); pin=inp;
        if ((toktyp+COFF)[*pin]!=IDENT) {
 
        ++flslvl; /* prevent macro expansion during 'define' */
        p=skipbl(p); pin=inp;
        if ((toktyp+COFF)[*pin]!=IDENT) {
-               ppwarn("illegal macro name"); while (*inp!='\n') p=skipbl(p); return(p);
+               ppwarn("illegal macro name"); while (*inp!='\n') p=skipbl(p);
+               passcom=opt_passcom; return(p);
        }
        np=slookup(pin,p,1);
        if (oldval=np->value) free(lastcopy);   /* was previously defined */
        }
        np=slookup(pin,p,1);
        if (oldval=np->value) free(lastcopy);   /* was previously defined */
@@ -680,7 +684,11 @@ dodef(p) char *p; {/* process '#define' */
        /* warn if a redefinition is different from old value.
        */
        space=psav=malloc(BUFSIZ);
        /* warn if a redefinition is different from old value.
        */
        space=psav=malloc(BUFSIZ);
-       if (space==NULL) {pperror("too much defining"); return(p);}
+       if (space==NULL) {
+               pperror("too much defining");
+               passcom=opt_passcom;
+               return(p);
+       }
        *psav++ = '\0';
        for (;;) {/* accumulate definition until linefeed */
                outp=inp=p; p=cotoken(p); pin=inp;
        *psav++ = '\0';
        for (;;) {/* accumulate definition until linefeed */
                outp=inp=p; p=cotoken(p); pin=inp;
@@ -731,6 +739,7 @@ dodef(p) char *p; {/* process '#define' */
                 */
                np->value += newspace-space;
        }
                 */
                np->value += newspace-space;
        }
+       passcom=opt_passcom;
        return(p);
 }
 
        return(p);
 }