🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #2615

Cccp stringification bug

#2615
From: Diomidis Spinellis
Date: Tue, 09 May 1989 09:17
64 lines
2185 bytes
Gcc version: 1.34
Machine: Sun 3
Operating system: SunOS 4.0.1_Export
Description: 
According to the pANS, the texinfo documentation of the preprocessor, and an 
e-mail from Karl Heuer, when an argument of a macro is stringified all white
space occuring in the argument is converted to a single space.  This is not
the case with newlines:

Script started on Tue May  9 11:10:19 1989
cygnus% /usr/local/lib/gcc-cpp -v -T
GNU CPP version 1.34
#define s(x) #x
s(a

b)
^D
# 1 ""

"ab" 


cygnus% exit
script done on Tue May  9 11:11:07 1989

The correct result should be "a b"

Fix: Apparently you do it intentionaly, I can't understand how the code to
do it crept in, thus some code needs to be deleted!

*** cccp.c.orig	Tue May  9 10:53:29 1989
--- cccp.c	Tue May  9 10:53:43 1989
***************
*** 4003,4015 ****
  	  for (; i < arglen; i++) {
  	    c = arg->raw[i];
  
- 	    /* Special markers Newline Space and Newline Newline
- 	       generate nothing for a stringified argument.  */
- 	    if (c == '\n') {
- 	      i++;
- 	      continue;
- 	    }
- 
  	    /* Internal sequences of whitespace are replaced by one space.  */
  	    if (is_space[c]) {
  	      while (c = arg->raw[i+1], is_space[c]) i++;
--- 4003,4008 ----

Caveat:  I am not sure (since I haven't pANS handy) how things like a
backslash at an end of a line should be stringified and how my fix
affects that.


Have fun

Diomidis

--
Diomidis Spinellis                   European Computer-Industry Research Centre
Arabellastrasse 17, D-8000 Muenchen 81, West Germany          +49 (89) 92699199
USA: diomidis%ecrcvax.uucp@pyramid.pyramid.com     ...!pyramid!ecrcvax!diomidis
Europe: diomidis@ecrcvax.uucp                        ...!unido!ecrcvax!diomidis
Technical Details
Message-ID: <8905090917.AA26958@cygnus.ecrc>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!AMES.ARC.NASA.GOV!ecrcvax!diomidis

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!uunet!tut.cis.ohio-state.edu!AMES.ARC.NASA.GOV!ecrcvax!diomidis
From: ecrcvax!diomidis@AMES.ARC.NASA.GOV (Diomidis Spinellis)
Newsgroups: gnu.gcc.bug
Subject: Cccp stringification bug
Message-ID: <8905090917.AA26958@cygnus.ecrc>
Date: 9 May 89 09:17:50 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 64