public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: Neil Booth <neil@daikokuya.co.uk> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, Subject: Re: preprocessor/8120: cpp concatenation doesn't work as described Date: Fri, 04 Oct 2002 15:16:00 -0000 [thread overview] Message-ID: <20021004221601.10883.qmail@sources.redhat.com> (raw) The following reply was made to PR preprocessor/8120; it has been noted by GNATS. From: Neil Booth <neil@daikokuya.co.uk> To: Peter Breitenlohner <peb@mppmu.mpg.de> Cc: gcc-gnats@gcc.gnu.org Subject: Re: preprocessor/8120: cpp concatenation doesn't work as described Date: Fri, 4 Oct 2002 23:08:38 +0100 Peter Breitenlohner wrote:- > I was using the following code, cut down to the bare essentials and > replacing `#include' by `include' in order to (a) get some output from the > preprocessor and (b) make visible what happens. > ################## start of input file bug.c #################### > #define XXX_H(name) XXX_I(prefix_ ## name ## .h) > #define XXX_I(file) #file > > include XXX_H(all) > ################### end of input file bug.c ##################### > The command `gcc -E bug.c -o bug.i' yields > ################## start of output file bug.i ################### > # 1 "bug.c" > # 1 "<built-in>" > # 1 "<command line>" > # 1 "bug.c" > > > > include "prefix_all .h" > ################### end of output file bug.i #################### > together with the warning: > bug.c:4:18: warning: pasting "prefix_all" and "." does not give a valid > preprocessing token > > The warning is in agreement with the above quote, but the output is not, > since the two tokens `prefix_all' and `.' are separated by a space (and > subsequently stringified). > > This construct used to produce "prefix_all.h" with gcc-2.95.3 (without > warning). With gcc-3.1.1 and 3.2 I got the desired result (with a warning) when > I replaced `name ## .h' by `name ##.h' or by `name##.h', but not with > `name## .h'. I would think something funny happens here with the handling of > whitespace!! I will correct the documentation to say "gives undefined behaviour" shortly. 3.3 gives a hard error. To get the result you want, remove the offending ##. Neil.
next reply other threads:[~2002-10-04 22:16 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2002-10-04 15:16 Neil Booth [this message] -- strict thread matches above, loose matches on Subject: below -- 2002-10-05 2:39 neil 2002-10-02 2:46 Peter Breitenlohner
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20021004221601.10883.qmail@sources.redhat.com \ --to=neil@daikokuya.co.uk \ --cc=gcc-prs@gcc.gnu.org \ --cc=nobody@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).