public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/60492] New: Using the L#param in a macro fails
@ 2014-03-10 19:17 jr at heisey dot org
  2014-03-10 19:18 ` [Bug preprocessor/60492] " jr at heisey dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jr at heisey dot org @ 2014-03-10 19:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

            Bug ID: 60492
           Summary: Using the L#param in a macro fails
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jr at heisey dot org

#define DEFINE_XML_TOKEN_STRING(n, s) const char n##a[] = #s; const wchar_t
n##w[] = L#s;

//defines for tags
DEFINE_XML_TOKEN_STRING(CONFIG_ELM, config)

The preprocessor inserts a space resulting in 
L "config"
rather than
L"config"

First saw this on gcc on Windows.
[D:\Proj\Synaptics\tools]"d:\Program Files
(x86)\CodeBlocks.13\MinGW\bin\gcc.exe
" --version
gcc.exe (tdm-2) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reproduced it on GCC 4.5.1 on Fedora.
[jrheisey@usu-fury CDCIApi]$ g++ --version
g++ (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


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

* [Bug preprocessor/60492] Using the L#param in a macro fails
  2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
@ 2014-03-10 19:18 ` jr at heisey dot org
  2014-03-10 21:13 ` jr at heisey dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jr at heisey dot org @ 2014-03-10 19:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

--- Comment #1 from J.R. Heisey <jr at heisey dot org> ---
Created attachment 32327
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32327&action=edit
preprocessor results for GCC 4.5.1


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

* [Bug preprocessor/60492] Using the L#param in a macro fails
  2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
  2014-03-10 19:18 ` [Bug preprocessor/60492] " jr at heisey dot org
@ 2014-03-10 21:13 ` jr at heisey dot org
  2014-03-10 22:39 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jr at heisey dot org @ 2014-03-10 21:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

--- Comment #2 from J.R. Heisey <jr at heisey dot org> ---
Created attachment 32330
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32330&action=edit
Source file

gcc -save-temps Bug_L_in_macro.c


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

* [Bug preprocessor/60492] Using the L#param in a macro fails
  2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
  2014-03-10 19:18 ` [Bug preprocessor/60492] " jr at heisey dot org
  2014-03-10 21:13 ` jr at heisey dot org
@ 2014-03-10 22:39 ` redi at gcc dot gnu.org
  2014-03-11  2:17 ` duncan_roe at acslink dot net.au
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2014-03-10 22:39 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I'm pretty sure GCC is correct, you cannot construct a wide-character string
literal like that using the preprocessor


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

* [Bug preprocessor/60492] Using the L#param in a macro fails
  2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
                   ` (2 preceding siblings ...)
  2014-03-10 22:39 ` redi at gcc dot gnu.org
@ 2014-03-11  2:17 ` duncan_roe at acslink dot net.au
  2014-03-11  2:19 ` pinskia at gcc dot gnu.org
  2014-03-14  7:10 ` jr at heisey dot org
  5 siblings, 0 replies; 7+ messages in thread
From: duncan_roe at acslink dot net.au @ 2014-03-11  2:17 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

--- Comment #4 from duncan_roe at acslink dot net.au <duncan_roe at acslink dot net.au> ---
This works:
#define DEFINE_XML_TOKEN_STRING(n, s) const char n##a[] = #s; const wchar_t
n##w[] = L###s;


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

* [Bug preprocessor/60492] Using the L#param in a macro fails
  2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
                   ` (3 preceding siblings ...)
  2014-03-11  2:17 ` duncan_roe at acslink dot net.au
@ 2014-03-11  2:19 ` pinskia at gcc dot gnu.org
  2014-03-14  7:10 ` jr at heisey dot org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-03-11  2:19 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
You could most likely also use L"" #s too due to string concatenating rules.


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

* [Bug preprocessor/60492] Using the L#param in a macro fails
  2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
                   ` (4 preceding siblings ...)
  2014-03-11  2:19 ` pinskia at gcc dot gnu.org
@ 2014-03-14  7:10 ` jr at heisey dot org
  5 siblings, 0 replies; 7+ messages in thread
From: jr at heisey dot org @ 2014-03-14  7:10 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60492

--- Comment #6 from J.R. Heisey <jr at heisey dot org> ---
Really? What rule would make this behavior expected?


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

end of thread, other threads:[~2014-03-14  7:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-10 19:17 [Bug preprocessor/60492] New: Using the L#param in a macro fails jr at heisey dot org
2014-03-10 19:18 ` [Bug preprocessor/60492] " jr at heisey dot org
2014-03-10 21:13 ` jr at heisey dot org
2014-03-10 22:39 ` redi at gcc dot gnu.org
2014-03-11  2:17 ` duncan_roe at acslink dot net.au
2014-03-11  2:19 ` pinskia at gcc dot gnu.org
2014-03-14  7:10 ` jr at heisey dot org

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