Article View: gnu.gcc.bug
Article #894Gnu gcc 1.36 fails to catch repeated #define arguments (with fix)
From: Arthur David Olson
Date: Wed, 17 Jan 1990 14:21
Date: Wed, 17 Jan 1990 14:21
53 lines
1972 bytes
1972 bytes
Index: cccp.c
(We're running SunOS 4.0.3 on a Sun 3/280.)
Description:
gcc 1.36 fails to catch repeated #define arguments
Repeat-By:
Script started on Wed Jan 17 09:19:10 1990
elsie$ echo '#define macro(a, a)' > try.c
elsie$ /usr/local/bin/gcc -E -v try.c
gcc version 1.36
/usr/local/lib/gcc-cpp -v -undef -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__mc68000__ -D__sun__ -D__unix__ -D__HAVE_68881__ -Dmc68020 try.c
GNU CPP version 1.36
# 1 "try.c"
elsie$ exit
script done on Wed Jan 17 09:19:28 1990
Fix:
*** 1.3/cccp.c Wed Jan 17 09:19:53 1990
--- 1.4/cccp.c Wed Jan 17 09:19:56 1990
***************
*** 2841,2846 ****
--- 2841,2865 ----
error ("unterminated parameter list in #define");
goto nope;
}
+ {
+ struct arglist *otemp;
+
+ for (otemp = temp->next; otemp != NULL; otemp = otemp->next)
+ if (temp->length == otemp->length &&
+ strncmp(temp->name, otemp->name) == 0) {
+ U_CHAR *msg;
+ char *preamble = "repeated #define argument name (";
+ char *postamble = ")";
+
+ msg = (U_CHAR *) alloca(strlen(preamble) + temp->length +
+ strlen(postamble) + 1);
+ (void) strcpy(msg, preamble);
+ (void) strncat(msg, temp->name, temp->length);
+ (void) strcat(msg, postamble);
+ error (msg);
+ goto nope;
+ }
+ }
}
++bp; /* skip paren */
--
Arthur David Olson ado@alw.nih.gov ADO is a trademark of Ampex.
Technical Details
Message-ID:
<9001171421.AA02258@elsie>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!nih-csl!elsie!adoShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!nih-csl!elsie!ado From: nih-csl!elsie!ado@UUNET.UU.NET (Arthur David Olson) Newsgroups: gnu.gcc.bug Subject: Gnu gcc 1.36 fails to catch repeated #define arguments (with fix) Message-ID: <9001171421.AA02258@elsie> Date: 17 Jan 90 14:21:27 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 53