Article View: gnu.gcc.bug
Article #365Re: ANSI C spec and GNU C preprocessing
From: gnu
Date: Sat, 11 Apr 1992 05:23
Date: Sat, 11 Apr 1992 05:23
34 lines
2032 bytes
2032 bytes
Mr. Barnes, you are completely confused about ANSI C. The standard specifies the *input* to a compiler, not the *output* from a preprocessor. The standard doesn't even have the concept of a preprocessor that is separate from a compiler. Applications that depend on the output of an arbitrary C preprocessor are typically broken. X11 expands makefiles that way -- that's a bug. I've seen code in Berkeley Unix that tried to macro-process assembler language files with a C preprocessor. Of course, it broke when the preprocessor was changed to handle ANSI C rules. Save yourself some trouble and use something else, such as "m4" or "sed", to handle your macro or string replacement needs. C preprocessors can do anything that results in a valid C program; they are typically written to feed their output into a particular C compiler, and can pass arbitrary syntax-extensions to it (such as `# 5 "file.c"'); there is no spec for their output. Many compilers don't even have a separate preprocessor. 1) #foo: You have it backwards. > Since the spec doesn't say you can do that, I would read that as you > can't do it, so it would be a fatal error from the preprocessor. On the contrary, if the spec does not have a specific requirement or prohibition, the compiler can do anything. See 2.1.1.3. > 2) A conforming preprocessor must output line directives (3.8.4) You have this backwards too. This section describes the *input* syntax. > 3) An alternate form of the '#line' directive would not use the keyword Irrelevant since you were confused about (2). John Gilmore
Technical Details
Message-ID:
<9204111923.AA02293@toad.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!toad.com!gnuReferences:
<1992Apr9.213900.26576@urbana.mcd.mot.com>Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!toad.com!gnu From: gnu@toad.com Subject: Re: ANSI C spec and GNU C preprocessing Message-ID: <9204111923.AA02293@toad.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet References: <1992Apr9.213900.26576@urbana.mcd.mot.com> Distribution: gnu Date: Sat, 11 Apr 1992 05:23:22 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 37