diomidis@AMES.ARC.NASA.GOV (Diomidis Spinellis) (05/09/89)
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