This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
cpp -dD broken (patch)
- To: gcc-patches at gcc dot gnu dot org
- Subject: cpp -dD broken (patch)
- From: Craig Newell <CraigN at savaJe dot com>
- Date: Mon, 6 Mar 2000 14:19:41 -0500 (EST)
Hi All,
cpp -dD is currently broken in the CVS tree. A simple test case to show
this is:
---- test.h ----
#define macro(x,y) (x) + (y)
----------------
Which when processed with "cpp -dD -P test.h" results in:
---- test.i ----
#define macro(, x) () + (x)
----------------
I would have to guess that this is just a simple logic error wrt. to the
recent cpp reorganisation ... so here is a quick patch to make it work
again (assuming that "cpp -dD" is the only thing broken).
Index: cpphash.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cpphash.c,v
retrieving revision 1.45
diff -u -r1.45 cpphash.c
--- cpphash.c 2000/03/04 01:42:56 1.45
+++ cpphash.c 2000/03/06 19:15:45
@@ -1609,19 +1609,18 @@
/* First extract the argument list. */
x = argnames;
- i = defn->nargs;
- while (i--)
- {
- argv[i] = x;
- while (*x != ',' && *x != '\0') x++;
- argl[i] = x - argv[i];
- if (*x == ',')
- {
- *x = '\0';
- x += 2; /* skip the space after the comma */
- }
- }
-
+ for (i = 0; i < defn->nargs; i++)
+ {
+ argv[i] = x;
+ while (*x != ',' && *x != '\0') x++;
+ argl[i] = x - argv[i];
+ if (*x == ',')
+ {
+ *x++ = '\0';
+ while ((*x == ',' || *x == ' ') && *x != '\0') x++;
+ }
+ }
+
/* Now print out the argument list. */
CPP_PUTC_Q (pfile, '(');
for (i = 0; i < defn->nargs; i++)
Thanks,
CraigN
--
Craig Newell email: CraigN@savaJe.com
Founder and Kernel Engineer icbm: anywhere in NJ, USA
savaJe technologies, inc. voice: +1 732 558 0018