public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/17539] New: preprocessor puts space after wide string prefix L.
@ 2004-09-17 20:43 anuj dot goyal at gmail dot com
  2004-09-17 22:55 ` [Bug preprocessor/17539] " neil at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: anuj dot goyal at gmail dot com @ 2004-09-17 20:43 UTC (permalink / raw)
  To: gcc-bugs

preprocessor puts space after wide string prefix.    eg. L "8"  instead of L"8"
which then causes compiler to bail.

This is pretty straightforward, other compilers (visual age, forte, aCC, etc.)
concatenate the way I except, maybe user error on my part?



$ cat w3.cpp
#include <cwchar>

#define VER(a) L#a

int main()
{
    wchar_t buf[8] = VER(8);
    return 0;
}



$ g++ -E w3.cpp >a.txt



$ tail a.txt
}
# 2 "w3.cpp" 2



int main()
{
    wchar_t buf[8] = L "8";  // <-- shouldn't be space between L and "8"
    return 0;
}




















gcc -v
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr
--with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man
--enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib
--enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib
--with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)

-- 
           Summary: preprocessor puts space after wide string prefix L.
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: critical
          Priority: P1
         Component: preprocessor
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anuj dot goyal at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: Linux anaclst06 2.6.5-7.104-default #1 Wed Jul 28
                    16:42:13 UTC 2
  GCC host triplet: Linux anaclst06 2.6.5-7.104-default #1 Wed Jul 28
                    16:42:13 UTC 2
GCC target triplet: Linux anaclst06 2.6.5-7.104-default #1 Wed Jul 28
                    16:42:13 UTC 2


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


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

* [Bug preprocessor/17539] preprocessor puts space after wide string prefix L.
  2004-09-17 20:43 [Bug preprocessor/17539] New: preprocessor puts space after wide string prefix L anuj dot goyal at gmail dot com
@ 2004-09-17 22:55 ` neil at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: neil at gcc dot gnu dot org @ 2004-09-17 22:55 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From neil at gcc dot gnu dot org  2004-09-17 22:55 -------
GCC is correct and the other compilers could be considered wrong.  L and the
result of #x are two separate tokens; GCC ensures that the output preserves that
property.

A correct version of your macro

#define WIDE_STR(x) L ## x
#define VER(a) WIDE_STR (#a)

should work for all compilers.

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


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


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

end of thread, other threads:[~2004-09-17 22:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-17 20:43 [Bug preprocessor/17539] New: preprocessor puts space after wide string prefix L anuj dot goyal at gmail dot com
2004-09-17 22:55 ` [Bug preprocessor/17539] " neil at gcc dot gnu 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).