public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Another incompatibility of a CPPLIB based cpp?
@ 1999-07-03  7:06 Manfred Hollstein
  0 siblings, 0 replies; 3+ messages in thread
From: Manfred Hollstein @ 1999-07-03  7:06 UTC (permalink / raw)
  To: Zack Weinberg, egcs-bugs

Zack,

I used to  generate my window manager's rc  files depending on various
stuff, e.g. the screen's geometry...

The following file    when preprocessed using   the  old cccp.c  based
preprocessor produces a    "reasonable" output that is   understood by
fvwm* and its modules:

/* foo - preprocess with: `gcc --print-file-name=cpp` foo */
#define GEOM_doit(w,h,x_pos,y_pos) w##x##h##x_pos##y_pos
#define GEOM(w,h,x_pos,y_pos) GEOM_doit(w,h,x_pos,y_pos)

#define APP_YPOS	-0

*FvwmButtonsGeometry	GEOM(210,70,-108,APP_YPOS)
/* END of foo. */

This is from the "old" cccp based preprocessor:

# 1 "foo"
 





*FvwmButtonsGeometry      210x70-108-0     
 
While this is produced by the cpplib based preprocessor:
# 1 "foo"
 





*FvwmButtonsGeometry    210x70-108 -0
 
Note the ' ' before the -0 in the last line!  Do you know which one is
correct, or do you know a work-around?

Thanks,
manfred
>From law@cygnus.com Sat Jul 03 07:22:00 1999
From: Jeffrey A Law <law@cygnus.com>
To: mts@vmware.com
Cc: egcs-bugs@egcs.cygnus.com
Subject: Re: egcs-2.91.66 bug (Debian potato) 
Date: Sat, 03 Jul 1999 07:22:00 -0000
Message-id: <4915.931011638@upchuck.cygnus.com>
References: <fzbtdu7gwu.fsf@Larmor.vmware.com>
X-SW-Source: 1999-07/msg00112.html
Content-length: 484

  In message < fzbtdu7gwu.fsf@Larmor.vmware.com >you write:
  > 
  > Sirs,
  > 
  > I think I have found a bug in the version of egcs included in
  > the potato distribution of Debian:
  > 
  > bug description:
  >  The compiler optimizes too much and doesn't execute correct code. In
  >  the following example, the correct result should be 12345678 instead
  >  of just 5678
Thanks. I just tested this with the gcc-2.95 prerelease sources and it seems to
be working fine now.
jeff


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Another incompatibility of a CPPLIB based cpp?
  1999-07-31 23:33 Zack Weinberg
@ 1999-07-31 23:33 ` Manfred Hollstein
  0 siblings, 0 replies; 3+ messages in thread
From: Manfred Hollstein @ 1999-07-31 23:33 UTC (permalink / raw)
  To: zack; +Cc: egcs-bugs, egcs-patches

Zack,

thanks for your patch; it fixes my problem indeed! I just ran a full
bootstrap and check without a regression to the sources without your
patch being applied.

BTW, I just saw that you installed a testcase for this problem; although
it was semantically correct, it failed to compile properly due to a
missing ';' after a variable's definition. I installed a patch for
that under the "fixes obvious prob" rule.

Later,
manfred

On Sun, 4 July 1999, 17:41:04, zack@rabi.columbia.edu wrote:

 > 
 > I'm not sure you should be counting on this behavior; 210x70-108-0 is
 > not a legal C token.  However, please try this patch.
 > 
 > zw
 > 
 >  p.s. I haven't received your mail for some reason (I'm not on the list right
 > now).
 > 
 > 1999-07-04 Zack Weinberg <zack@rabi.columbia.edu>
 > 
 > 	* cpphash.c (unsafe_chars): Correct rule about extending a
 > 	pp-number with + or -.
 > 	(macroexpand): If raw_before, trim leading space and markers
 > 	from argument.
 > 

gcc/testsuite/ChangeLog:

1999-07-05  Manfred Hollstein  <mhollstein@cygnus.com>

	* gcc.dg/990703-1.c (y): Terminate definition syntactically correctly.

1999-07-04  Zack Weinberg  <zack@rabi.columbia.edu>

	* gcc.dg/990703-1.c: New test.

diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19990704.orig/gcc/testsuite/gcc.dg/990703-1.c egcs-19990704/gcc/testsuite/gcc.dg/990703-1.c
--- egcs-19990704.orig/gcc/testsuite/gcc.dg/990703-1.c	Sun Jul  4 18:28:56 1999
+++ egcs-19990704/gcc/testsuite/gcc.dg/990703-1.c	Mon Jul  5 09:39:21 1999
@@ -15,7 +15,7 @@ int
 main(void)
 {
     char *x = SP1(0,MZ);
-    char *y = "0-0"  /* should be the expansion of SP1(0,MZ) */
+    char *y = "0-0";  /* should be the expansion of SP1(0,MZ) */
 
     if(strcmp(x, y))
 	return 1;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Another incompatibility of a CPPLIB based cpp?
@ 1999-07-31 23:33 Zack Weinberg
  1999-07-31 23:33 ` Manfred Hollstein
  0 siblings, 1 reply; 3+ messages in thread
From: Zack Weinberg @ 1999-07-31 23:33 UTC (permalink / raw)
  To: Manfred Hollstein, egcs-bugs

I'm not sure you should be counting on this behavior; 210x70-108-0 is
not a legal C token.  However, please try this patch.

zw

 p.s. I haven't received your mail for some reason (I'm not on the list right
now).

1999-07-04 Zack Weinberg <zack@rabi.columbia.edu>

	* cpphash.c (unsafe_chars): Correct rule about extending a
	pp-number with + or -.
	(macroexpand): If raw_before, trim leading space and markers
	from argument.

Index: cpphash.c
===================================================================
RCS file: /cvs/egcs/egcs/gcc/cpphash.c,v
retrieving revision 1.22
diff -u -r1.22 cpphash.c
--- cpphash.c	1999/06/07 10:35:24	1.22
+++ cpphash.c	1999/07/04 21:36:47
@@ -1337,10 +1337,17 @@
 	      U_CHAR *l1 = p1 + arg->raw_length;
 	      if (ap->raw_before)
 		{
-		  while (p1 != l1 && is_space[*p1])
-		    p1++;
-		  while (p1 != l1 && is_idchar[*p1])
-		    xbuf[totlen++] = *p1++;
+		  /* Arg is concatenated before: delete leading whitespace,
+		     whitespace markers, and no-reexpansion markers.  */
+		  while (p1 != l1)
+		    {
+		      if (is_space[p1[0]])
+			p1++;
+		      else if (p1[0] == '\r')
+			p1 += 2;
+		      else
+			break;
+		    }
 		}
 	      if (ap->raw_after)
 		{
@@ -1460,15 +1467,12 @@
 {
   switch (c1)
     {
-    case '+':
-    case '-':
+    case '+':  case '-':
       if (c2 == c1 || c2 == '=')
 	return 1;
       goto letter;
 
-    case '.':    case '0':    case '1':    case '2':    case '3':
-    case '4':    case '5':    case '6':    case '7':    case '8':
-    case '9':    case 'e':    case 'E':    case 'p':    case 'P':
+    case 'e':  case 'E':  case 'p':  case 'P':
       if (c2 == '-' || c2 == '+')
 	return 1;		/* could extend a pre-processing number */
       goto letter;
@@ -1478,6 +1482,8 @@
 	return 1;		/* Could turn into L"xxx" or L'xxx'.  */
       goto letter;
 
+    case '.':  case '0':  case '1':  case '2':  case '3':
+    case '4':  case '5':  case '6':  case '7':  case '8':  case '9':
     case '_':  case 'a':  case 'b':  case 'c':  case 'd':  case 'f':
     case 'g':  case 'h':  case 'i':  case 'j':  case 'k':  case 'l':
     case 'm':  case 'n':  case 'o':  case 'q':  case 'r':  case 's':


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-07-31 23:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-03  7:06 Another incompatibility of a CPPLIB based cpp? Manfred Hollstein
1999-07-31 23:33 Zack Weinberg
1999-07-31 23:33 ` Manfred Hollstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).