public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/7457: failure preprocessing ## directive
@ 2002-07-31 13:16 Zack Weinberg
  0 siblings, 0 replies; 4+ messages in thread
From: Zack Weinberg @ 2002-07-31 13:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/7457; it has been noted by GNATS.

From: Zack Weinberg <zack@codesourcery.com>
To: gnicholls@bluephoenixsolutions.com
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: preprocessor/7457: failure preprocessing ## directive
Date: Wed, 31 Jul 2002 13:15:00 -0700

 On Wed, Jul 31, 2002 at 07:50:39PM -0000, gnicholls@bluephoenixsolutions.com wrote:
 > >Description:
 > The following construct fails compilation:-
 > #define LIB_SUFF ".so"
 > #define SV_MODULE_NAME_STR "libdrv"##LIB_SUFF
 
 The ## is completely unnecessary in this case.  Remove it and your
 code will work again.
 
 The C standard specifies that the result of a token-paste is undefined
 if the two tokens cannot be combined into a single token.  This is
 always true of two string constants.  That is what the warning is
 telling you.
 
 zw


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: preprocessor/7457: failure preprocessing ## directive
@ 2002-08-01  5:46 Gregory Nicholls
  0 siblings, 0 replies; 4+ messages in thread
From: Gregory Nicholls @ 2002-08-01  5:46 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR preprocessor/7457; it has been noted by GNATS.

From: Gregory Nicholls <gnicholls@bluephoenixsolutions.com>
To: neil@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
 	gnicholls@bluephoenixsolutions.com, nobody@gcc.gnu.org,
 	gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: preprocessor/7457: failure preprocessing ## directive
Date: Thu, 01 Aug 2002 08:36:29 -0400

 --------------1234E970CAB8843E2902E53D
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
   OK thanks,
         This was some old (10yr) code that used to work and then didn't. I wondered about the concat but confess that I'm a bit vague on the pre-processor stuff.
     Sorry for the trouble.
             G.
 
 neil@gcc.gnu.org wrote:
 
 > Synopsis: failure preprocessing ## directive
 >
 > State-Changed-From-To: open->closed
 > State-Changed-By: neil
 > State-Changed-When: Wed Jul 31 15:20:59 2002
 > State-Changed-Why:
 >     Not a bug - please understand what ## means.
 >
 >     It means: "take the spelling of the LHS, and the spelling
 >     of the RHS, and concatenate the two to form a new token.  If the concatenation does not form a valid token, anything goes.".  You are trying to create a token
 >
 >        "libdrv"".so"
 >
 >     which is not a token (it's two tokens).  However, if you just drop the !@#$%^& ##, then you're OK: two strings
 >     concatenate to become one string by the rules of C (post
 >     macro expansion and preprocessing).
 >
 >     Please read a good description of what ## does.
 >
 >     Yes, GCC is getting more picky.  That's a good thing.
 >
 > http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7457
 
 --------------1234E970CAB8843E2902E53D
 Content-Type: text/html; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
 <html>
 &nbsp; OK thanks,
 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; This was some old (10yr)
 code that used to work and then didn't. I wondered about the concat but
 confess that I'm a bit vague on the pre-processor stuff.
 <br>&nbsp;&nbsp;&nbsp; Sorry for the trouble.
 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 G.
 <p>neil@gcc.gnu.org wrote:
 <blockquote TYPE=CITE>Synopsis: failure preprocessing ## directive
 <p>State-Changed-From-To: open->closed
 <br>State-Changed-By: neil
 <br>State-Changed-When: Wed Jul 31 15:20:59 2002
 <br>State-Changed-Why:
 <br>&nbsp;&nbsp;&nbsp; Not a bug - please understand what ## means.
 <p>&nbsp;&nbsp;&nbsp; It means: "take the spelling of the LHS, and the
 spelling
 <br>&nbsp;&nbsp;&nbsp; of the RHS, and concatenate the two to form a new
 token.&nbsp; If the concatenation does not form a valid token, anything
 goes.".&nbsp; You are trying to create a token
 <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "libdrv"".so"
 <p>&nbsp;&nbsp;&nbsp; which is not a token (it's two tokens).&nbsp; However,
 if you just drop the !@#$%^&amp; ##, then you're OK: two strings
 <br>&nbsp;&nbsp;&nbsp; concatenate to become one string by the rules of
 C (post
 <br>&nbsp;&nbsp;&nbsp; macro expansion and preprocessing).
 <p>&nbsp;&nbsp;&nbsp; Please read a good description of what ## does.
 <p>&nbsp;&nbsp;&nbsp; Yes, GCC is getting more picky.&nbsp; That's a good
 thing.
 <p><a href="http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7457">http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&amp;database=gcc&amp;pr=7457</a></blockquote>
 </html>
 
 --------------1234E970CAB8843E2902E53D--
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: preprocessor/7457: failure preprocessing ## directive
@ 2002-07-31 15:21 neil
  0 siblings, 0 replies; 4+ messages in thread
From: neil @ 2002-07-31 15:21 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gnicholls, nobody

Synopsis: failure preprocessing ## directive

State-Changed-From-To: open->closed
State-Changed-By: neil
State-Changed-When: Wed Jul 31 15:20:59 2002
State-Changed-Why:
    Not a bug - please understand what ## means.
    
    It means: "take the spelling of the LHS, and the spelling
    of the RHS, and concatenate the two to form a new token.  If the concatenation does not form a valid token, anything goes.".  You are trying to create a token
    
       "libdrv"".so"
    
    which is not a token (it's two tokens).  However, if you just drop the !@#$%^& ##, then you're OK: two strings
    concatenate to become one string by the rules of C (post
    macro expansion and preprocessing).
    
    Please read a good description of what ## does.
    
    Yes, GCC is getting more picky.  That's a good thing.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7457


^ permalink raw reply	[flat|nested] 4+ messages in thread

* preprocessor/7457: failure preprocessing ## directive
@ 2002-07-31 12:56 gnicholls
  0 siblings, 0 replies; 4+ messages in thread
From: gnicholls @ 2002-07-31 12:56 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7457
>Category:       preprocessor
>Synopsis:       failure preprocessing ## directive
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 31 12:56:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gregory Nicholls
>Release:        gcc v3.1
>Organization:
>Environment:
hpux11 and solaris
>Description:
The following construct fails compilation:-
#define LIB_SUFF ".so"
#define SV_MODULE_NAME_STR "libdrv"##LIB_SUFF

 This used to work on an earlier gcc and it also works on native
aix c89 as well as native hpux cc. This is old code so I'm not sure if 
it's really a gcc bug or 'undefined behaviour'. In any case it's
easy to repeat.
>How-To-Repeat:
compile supplied test program. Should fail with the following:
gcc_test.c:6:29: warning: pasting ""libdrv"" and "LIB_SUFF" does not give a vali
d preprocessing token
>Fix:
Dont' know <grin>.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-unknown-content-type-cfile; name="gcc_test.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gcc_test.c"

I2RlZmluZSBMSUJfU1VGRiAiLnNvIg0KI2RlZmluZSBTVl9NT0RVTEVfTkFNRV9TVFIgImxpYmRy
diIjI0xJQl9TVUZGDQoNCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikNCnsNCiBwcmlu
dGYoIk1vZHVsZSBOYW1lWyVzXVxuIixTVl9NT0RVTEVfTkFNRV9TVFIpOw0KIHJldHVybigwKTsN
Cn0NCg==


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-08-01 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-31 13:16 preprocessor/7457: failure preprocessing ## directive Zack Weinberg
  -- strict thread matches above, loose matches on Subject: below --
2002-08-01  5:46 Gregory Nicholls
2002-07-31 15:21 neil
2002-07-31 12:56 gnicholls

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).