Path: utzoo!attcan!uunet!wuarchive!sdd.hp.com!ucsd!network.ucsd.edu!weber.ucsd.edu!pbiron From: pbiron@weber.ucsd.edu (Paul Biron) Newsgroups: comp.sys.next Subject: Re: strange behavior of the C preprocessor Message-ID: <3866@network.ucsd.edu> Date: 15 Oct 90 20:17:47 GMT References: <9060@helios.TAMU.EDU) <9063@helios.TAMU.EDU> Sender: news@network.ucsd.edu Reply-To: pbiron@weber.ucsd.edu (Paul Biron) Lines: 54 Nntp-Posting-Host: weber.ucsd.edu In article <9063@helios.TAMU.EDU>, cnh5730@calvin.tamu.edu (Chuck Herrick) writes: |> In article <9060@helios.TAMU.EDU) cnh5730@calvin.tamu.edu (Chuck Herrick) writes: |> )Does this appear to be a bug in the C preprocessor to you? |> )I ran the following script (extracted from Larry Walls' Configure |> )in patch2) |> )cat <<'EOT' )testcpp.c |> )#define ABC abc |> )#define XYZ xyz |> )ABC.XYZ |> )EOT |> )echo 'Maybe "'$cpp'" will work...' |> )$cpp )inspection of testcpp.out revealed that the file |> )contained |> ) abc .xyz |> )and NOT |> ) abc.xyz |> |> In addition, I ran the script on a Sun SPARC 1+ which has |> version 1.37 of the GNU C compiler/preprocessor |> (cccp and cpp) installed along with the |> vanilla Sun Berkeley C compiler. |> when I ran the Sun C preprocessor (/lib/cpp) I got |> -- |> Chuck Herrick cnh5730@calvin.tamu.edu I posted something simular to this a while back, because I had the same problem (actually I reported it as a bug to NeXT and GNU). The reply I received from RMS was that the behavior of gcc (and hence cc on the NeXT) was the "proper" behavior and that nothing was going to change. The fact that I could produce what *I* thought was the"proper" behavior on an HP (HP-UX 7.0), Sun Sparc (SunOS 4.01), a VAX (BSD 4.3 tahoe), I was a little disappointed in RMS's responce. [Note that none of these C compilers are ANSI compliant, except for HP's with the -Aa switch] So, I posted to comp.lang.c to see what the concensus was there. There answer turned out to be that ANSI compilant preprocessors *ARE REQUIRED* to add the additional space around these tokens. IOW, the Configure script form patch will not run with *ANY* ANSI C. Therefore, the "bug" is with patch, and *NOT* gcc (which is an ANSI compliant compiler). [BTW, when I used the -Aa switch on HP's 7.0 compiler, Configure failed] I sent the whole conversation onto Larry Wall, and he said that in the next distribution of patch, the problem will be fixed. Paul Biron pbiron@ucsd.edu (619) 534-5758 Central University Library, Mail Code C-075-R Social Sciences DataBase Project University of California, San Diego, La Jolla, Ca. 92093