🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6085

Bug in "cpplib.c" distributed with "gcc 2.7.2" and patch for it

#6085
From: Dieter Maurer
Date: Thu, 19 Dec 1996 00:00
48 lines
1760 bytes
In some cases, a "C" preprocessor build from *CPPLIB.C* distributed
with "gcc 2.7.2" does not expand 'aaa ## <param>' correctly.
The problem does *NOT ARISE* for preprocessors build from *CCCP.C*.

A problem case and a patch are appended to this message.

Best regards,
Dieter

--- Bug case --------------------------------------------------
#define a(c) f(A##c)
#define r(c,o) f(A##c : a(c))

#define f(x) x

#define AB 5

#define B(o) r(B,0)

B(o)


--- Result ----------------------------------------------------
5 : AB

-- the occurrences of "A##c" in 'a' has not been expanded
   although the similar occurence of 'A##c' in 'r' has.


--- Patch -----------------------------------------------------
--- cpplib.c~	Tue Dec 17 19:13:08 1996
+++ cpplib.c	Tue Dec 17 23:29:03 1996
@@ -2960,6 +2960,14 @@
 		  while (p1 != l1 && is_space[*p1]) p1++;
 		  while (p1 != l1 && is_idchar[*p1])
 		    xbuf[totlen++] = *p1++;
+
+		  /* DM 17.12.96: added */
+		  /* Delete any no-reexpansion marker that follows
+		     an identifier at the beginning of the argument
+		     if the argument is concatenated with what precedes it.  */
+		  if (p1[0] == '@' && p1[1] == '-')
+		    p1 += 2;
+		
 		}
 	      if (ap->raw_after)
 		{
Technical Details
Message-ID: <199612192010.VAA00699@lindm.dm>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,e6644e11d1942c90,start
X-Google-Attributes: gid113d02,public
From: dieter@hit.handshake.de (Dieter Maurer)
Subject: Bug in "cpplib.c" distributed with "gcc 2.7.2" and patch for it
Date: 1996/12/19
Message-ID: <199612192010.VAA00699@lindm.dm>
X-Deja-AN: 204973573
sender: bug-gcc-request@prep.ai.mit.edu
x-gateway: relay2.UU.NET from bug-gcc to gnu.gcc.bug; Thu, 19 Dec 1996 15:44:22 EST
newsgroups: gnu.gcc.bug