public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/58057] New: gcc lexer cannot parse  extern "\x43" void blah();
@ 2013-08-02  8:36 schnoerr at mailzone dot com
  2013-08-02  8:48 ` [Bug c++/58057] " mpolacek at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: schnoerr at mailzone dot com @ 2013-08-02  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58057
           Summary: gcc lexer cannot parse  extern "\x43" void blah();
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: schnoerr at mailzone dot com

g++ 4.7.3 fails to compile 
    extern "\x43" void blah();
which is obfuscated and equivalent to
    extern "C" void blah();

This is no problem for the g++ 4.6.3 so it must have been newly introduced in
g++.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah();
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
@ 2013-08-02  8:48 ` mpolacek at gcc dot gnu.org
  2013-08-02  8:50 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-08-02  8:48 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I can't seem to reproduce it with 4.7/4.8/trunk (if you really parse it using
the C++ compiler).


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah();
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
  2013-08-02  8:48 ` [Bug c++/58057] " mpolacek at gcc dot gnu.org
@ 2013-08-02  8:50 ` paolo.carlini at oracle dot com
  2013-08-02 11:30 ` [Bug c++/58057] gcc lexer cannot parse extern "\x43" void blah() with option -std=c++0x; mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-02  8:50 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Indeed.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
  2013-08-02  8:48 ` [Bug c++/58057] " mpolacek at gcc dot gnu.org
  2013-08-02  8:50 ` paolo.carlini at oracle dot com
@ 2013-08-02 11:30 ` mpolacek at gcc dot gnu.org
  2013-08-02 11:31 ` paolo.carlini at oracle dot com
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2013-08-02 11:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Weird, even with -std=c++0x I still see no failures at all.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (2 preceding siblings ...)
  2013-08-02 11:30 ` [Bug c++/58057] gcc lexer cannot parse extern "\x43" void blah() with option -std=c++0x; mpolacek at gcc dot gnu.org
@ 2013-08-02 11:31 ` paolo.carlini at oracle dot com
  2013-08-02 12:32 ` schnoerr at mailzone dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-02 11:31 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Yep.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (3 preceding siblings ...)
  2013-08-02 11:31 ` paolo.carlini at oracle dot com
@ 2013-08-02 12:32 ` schnoerr at mailzone dot com
  2013-08-02 13:47 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: schnoerr at mailzone dot com @ 2013-08-02 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

schnoerr at mailzone dot com changed:

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

--- Comment #6 from schnoerr at mailzone dot com ---
I'm sorry again, the cause of the error seemed to be so obvious.

The removed spaces are the reason.
Here is a small program I could isolate the problem:

------------------------------
//command: g++ -std=c++0x test.cc -o test
//version: g++ (GCC) 4.7.3

extern "C" void * blah_1( void * );  //ok

extern "\x43" void*blah_2(void*);    //ok

extern"\x43"void*blah_3(void*);      //<-- error only here with -std=c++0x and
g++4.7.3
                                     //    no error with g++4.6.3

int main() {

}

error message: test.cc:7:7: error: expected unqualified-id before
‘STRING_USERDEF’ token
>From gcc-bugs-return-427194-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Aug 02 12:45:08 2013
Return-Path: <gcc-bugs-return-427194-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 27251 invoked by alias); 2 Aug 2013 12:45:08 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 27183 invoked by uid 48); 2 Aug 2013 12:45:06 -0000
From: "paolo.carlini at oracle dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
Date: Fri, 02 Aug 2013 12:45:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 4.7.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: paolo.carlini at oracle dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-58057-4-WOm8qdsvH6@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-58057-4@http.gcc.gnu.org/bugzilla/>
References: <bug-58057-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-08/txt/msg00118.txt.bz2
Content-length: 465

http://gcc.gnu.org/bugzilla/show_bug.cgi?idX057

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|schnoerr at mailzone dot com       |3dw4rd at verizon dot net

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> ---
The error message could be better, but I don't think this is valid.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (4 preceding siblings ...)
  2013-08-02 12:32 ` schnoerr at mailzone dot com
@ 2013-08-02 13:47 ` paolo.carlini at oracle dot com
  2013-08-02 15:41 ` 3dw4rd at verizon dot net
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-02 13:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Among the compilers I have at hand, only the latest Icc accepts this.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (5 preceding siblings ...)
  2013-08-02 13:47 ` paolo.carlini at oracle dot com
@ 2013-08-02 15:41 ` 3dw4rd at verizon dot net
  2013-08-02 17:31 ` 3dw4rd at verizon dot net
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: 3dw4rd at verizon dot net @ 2013-08-02 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
I think I need to test for keyword in addition to testing for macro in
libcpp/lex.c

I'll look at this.

I'll also look at getting a better error.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (6 preceding siblings ...)
  2013-08-02 15:41 ` 3dw4rd at verizon dot net
@ 2013-08-02 17:31 ` 3dw4rd at verizon dot net
  2013-08-02 17:47 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: 3dw4rd at verizon dot net @ 2013-08-02 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
No, I remember now.  This code *cannot* be right.

With the addition of user-defined literals in C++11 and DR1473
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3675.html#1473)
placing keywords immediately after a string literal forms a valid user-defined
string literal.

As an extension we admit macros so placed with a warning.  We do this not to
break user code with inttypes.h and other user-created string macros.

See http://gcc.gnu.org/ml/gcc/2013-06/msg00119.html and onwards - especially
http://gcc.gnu.org/ml/gcc/2013-06/msg00121.html.

This is not a bug.  I vote close INVALID.


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (7 preceding siblings ...)
  2013-08-02 17:31 ` 3dw4rd at verizon dot net
@ 2013-08-02 17:47 ` paolo.carlini at oracle dot com
  2013-08-03  3:30 ` 3dw4rd at verizon dot net
  2013-08-03 17:51 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-02 17:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ed, your analysis matches my intuition, but the error message is still very
poor: to the user something like "... before STRING_USERDEF..." makes no sense
at all. Can we improve it?


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (8 preceding siblings ...)
  2013-08-02 17:47 ` paolo.carlini at oracle dot com
@ 2013-08-03  3:30 ` 3dw4rd at verizon dot net
  2013-08-03 17:51 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: 3dw4rd at verizon dot net @ 2013-08-03  3:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
On 08/02/2013 01:47 PM, paolo.carlini at oracle dot com wrote:
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58057
>
> --- Comment #11 from Paolo Carlini <paolo.carlini at oracle dot com> ---
> Ed, your analysis matches my intuition, but the error message is still very
> poor: to the user something like "... before STRING_USERDEF..." makes no sense
> at all. Can we improve it?
>
I agree that a better message is desirable.
I am starting to track this down and fix it.
(Any ideas?)

Ed


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

* [Bug c++/58057] gcc lexer cannot parse  extern "\x43" void blah() with option -std=c++0x;
  2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
                   ` (9 preceding siblings ...)
  2013-08-03  3:30 ` 3dw4rd at verizon dot net
@ 2013-08-03 17:51 ` paolo.carlini at oracle dot com
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-08-03 17:51 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

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

--- Comment #13 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Ok, let's close this one. The diagnostic issue is tracked in PR58072.


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

end of thread, other threads:[~2013-08-03 17:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-02  8:36 [Bug c++/58057] New: gcc lexer cannot parse extern "\x43" void blah(); schnoerr at mailzone dot com
2013-08-02  8:48 ` [Bug c++/58057] " mpolacek at gcc dot gnu.org
2013-08-02  8:50 ` paolo.carlini at oracle dot com
2013-08-02 11:30 ` [Bug c++/58057] gcc lexer cannot parse extern "\x43" void blah() with option -std=c++0x; mpolacek at gcc dot gnu.org
2013-08-02 11:31 ` paolo.carlini at oracle dot com
2013-08-02 12:32 ` schnoerr at mailzone dot com
2013-08-02 13:47 ` paolo.carlini at oracle dot com
2013-08-02 15:41 ` 3dw4rd at verizon dot net
2013-08-02 17:31 ` 3dw4rd at verizon dot net
2013-08-02 17:47 ` paolo.carlini at oracle dot com
2013-08-03  3:30 ` 3dw4rd at verizon dot net
2013-08-03 17:51 ` paolo.carlini at oracle dot com

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