public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
@ 2007-01-28  2:41 ` manu at gcc dot gnu dot org
  2007-01-28  4:11 ` gdr at cs dot tamu dot edu
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-01-28  2:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from manu at gcc dot gnu dot org  2007-01-28 02:41 -------
(In reply to comment #7)
> I seem to recall that when Giovanni worked on these digraph thingies,
> it was pointed out that our CPP is able to mark a pp-token whether it
> is a digraph or not.
> 

Actually, it is marked as token->flags & NAMED_OP. This can be easily tested.
However, the way the C++ front-end handles parser errors makes that totally
useless. Once we reach c-common.c (c_parse_error), the actual cp_token is lost
and we only keep the type. Also, it seems that it should be using
cpp_token_as_text rather than cpp_type2name. However, the change does not seem
trivial at all.

Unless someone decides to fix the whole C++ parser error handling, this and PR
28152 won't be fixed.

Any brave volunteer?


-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
  2007-01-28  2:41 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token manu at gcc dot gnu dot org
@ 2007-01-28  4:11 ` gdr at cs dot tamu dot edu
  2007-02-01 12:16 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: gdr at cs dot tamu dot edu @ 2007-01-28  4:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from gdr at cs dot tamu dot edu  2007-01-28 04:11 -------
Subject: Re:  When using 'or' keyword, the error message speaks of a '||' token

"manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| Unless someone decides to fix the whole C++ parser error handling,
| this and PR 28152 won't be fixed.

I would refrain from sweeping generalization like the above.
Diagnostics with carret do not necessary require "fixing" the parser;
and, yet they can be implemented in a way that resolves this issue. 

-- Gaby


-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
  2007-01-28  2:41 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token manu at gcc dot gnu dot org
  2007-01-28  4:11 ` gdr at cs dot tamu dot edu
@ 2007-02-01 12:16 ` manu at gcc dot gnu dot org
  2007-11-22  8:39 ` spiridenok at tut dot by
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2007-02-01 12:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from manu at gcc dot gnu dot org  2007-02-01 12:16 -------
(In reply to comment #9)
> Subject: Re:  When using 'or' keyword, the error message speaks of a '||' token
> 
> "manu at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> writes:
> 
> | Unless someone decides to fix the whole C++ parser error handling,
> | this and PR 28152 won't be fixed.
> 
> I would refrain from sweeping generalization like the above.
> Diagnostics with carret do not necessary require "fixing" the parser;
> and, yet they can be implemented in a way that resolves this issue. 
> 

I am not talking about the parser itself but about the way it handles errors.
token->flags gets lost inside the machinery launched by a call to
cp_parse_error. So I would like to know how you think this can be implemented
(honestly!), perhaps I missed some other way to distinguish the 'or' token from
'||'.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2007-02-01 12:16 ` manu at gcc dot gnu dot org
@ 2007-11-22  8:39 ` spiridenok at tut dot by
  2009-02-07 20:29 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: spiridenok at tut dot by @ 2007-11-22  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from spiridenok at tut dot by  2007-11-22 08:39 -------
Since when are "or"/"and"/"xor" C++ keywords?

(In reply to comment #1)
> In C++ or is a keyword for |, so this is invalid.
> 
> Also the follow are keywords:
> and    &
> xor    ^


-- 

spiridenok at tut dot by changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |spiridenok at tut dot by


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2007-11-22  8:39 ` spiridenok at tut dot by
@ 2009-02-07 20:29 ` manu at gcc dot gnu dot org
  2009-04-22 15:32 ` manu at gcc dot gnu dot org
  2009-04-22 15:33 ` manu at gcc dot gnu dot org
  6 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-02-07 20:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from manu at gcc dot gnu dot org  2009-02-07 20:29 -------
Patch here:

http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00971.html


-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2009-02-07 20:29 ` manu at gcc dot gnu dot org
@ 2009-04-22 15:32 ` manu at gcc dot gnu dot org
  2009-04-22 15:33 ` manu at gcc dot gnu dot org
  6 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-04-22 15:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from manu at gcc dot gnu dot org  2009-04-22 15:32 -------
Subject: Bug 14875

Author: manu
Date: Wed Apr 22 15:32:18 2009
New Revision: 146589

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146589
Log:
2009-04-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR c++/14875
        * c-common.c (c_parse_error): Take a token_flags parameter.
        Use token_type for the token type instead.
        Pass token_flags to cpp_type2name.
        * c-common.h (c_parse_error): Update declaration.
        * c-parser.c (c_parser_error): Pass 0 as token flags.
libcpp/
        * lex.c (cpp_type2name): Take a flags parameter. Call
        cpp_named_operator2name for named operators and cpp_digraph2name
        for digraphs.
        (cpp_digraph2name): New.
        (cpp_spell_token): Use it.
        (cpp_output_token): Likewise.
        * include/cpplib.h (cpp_type2name): Update declaration.
        * init.c (cpp_named_operator2name): New.
        * internal.h (cpp_named_operator2name): Declare.
cp/     
        * parser.c (cp_parser_error): Pass token->flags to c_parse_error.
testsuite/
        * g++.dg/parse/parser-pr14875.C: New.
        * g++.dg/parse/parser-pr14875-2.C: New.
        * g++.dg/parse/error6.C: Update match string.

Added:
    trunk/gcc/testsuite/g++.dg/parse/parser-pr14875-2.C
    trunk/gcc/testsuite/g++.dg/parse/parser-pr14875.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c-common.h
    trunk/gcc/c-parser.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/parse/error6.C
    trunk/libcpp/ChangeLog
    trunk/libcpp/include/cpplib.h
    trunk/libcpp/init.c
    trunk/libcpp/internal.h
    trunk/libcpp/lex.c


-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
       [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2009-04-22 15:32 ` manu at gcc dot gnu dot org
@ 2009-04-22 15:33 ` manu at gcc dot gnu dot org
  6 siblings, 0 replies; 13+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-04-22 15:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from manu at gcc dot gnu dot org  2009-04-22 15:33 -------
FIXED in GCC 4.5.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
  2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
                   ` (3 preceding siblings ...)
  2004-04-08 18:53 ` zack at codesourcery dot com
@ 2004-04-08 19:54 ` gdr at integrable-solutions dot net
  4 siblings, 0 replies; 13+ messages in thread
From: gdr at integrable-solutions dot net @ 2004-04-08 19:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at integrable-solutions dot net  2004-04-08 19:53 -------
Subject: Re:  When using 'or' keyword, the error message speaks of a '||' token

"bangerth at dealii dot org" <gcc-bugzilla@gcc.gnu.org> writes:

| The problem is that the token is already converted by the preprocessor.
| This is why the error message has the '||' token in it. So I assume there
| is not so much the compiler can do anymore, since it doesn't even get to
| see the original token.

I seem to recall that when Giovanni worked on these digraph thingies,
it was pointed out that our CPP is able to mark a pp-token whether it
is a digraph or not.

-- Gaby


-- 


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


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

* Re: [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
  2004-04-08 18:34 ` bangerth at dealii dot org
@ 2004-04-08 18:53   ` Zack Weinberg
  0 siblings, 0 replies; 13+ messages in thread
From: Zack Weinberg @ 2004-04-08 18:53 UTC (permalink / raw)
  To: gcc-bugzilla; +Cc: gcc-bugs


The preprocessor will have marked the token with the NAMED_OP flag,
it might be possible to expose that to the diagnostics.

zw


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
  2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
                   ` (2 preceding siblings ...)
  2004-04-08 18:34 ` bangerth at dealii dot org
@ 2004-04-08 18:53 ` zack at codesourcery dot com
  2004-04-08 19:54 ` gdr at integrable-solutions dot net
  4 siblings, 0 replies; 13+ messages in thread
From: zack at codesourcery dot com @ 2004-04-08 18:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From zack at codesourcery dot com  2004-04-08 18:53 -------
Subject: Re:  When using 'or' keyword, the error message
 speaks of a '||' token


The preprocessor will have marked the token with the NAMED_OP flag,
it might be possible to expose that to the diagnostics.

zw


-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
  2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
  2004-04-07 13:23 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token giovannibajo at libero dot it
  2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
@ 2004-04-08 18:34 ` bangerth at dealii dot org
  2004-04-08 18:53   ` Zack Weinberg
  2004-04-08 18:53 ` zack at codesourcery dot com
  2004-04-08 19:54 ` gdr at integrable-solutions dot net
  4 siblings, 1 reply; 13+ messages in thread
From: bangerth at dealii dot org @ 2004-04-08 18:34 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-04-08 18:34 -------
The problem is that the token is already converted by the preprocessor.
This is why the error message has the '||' token in it. So I assume there
is not so much the compiler can do anymore, since it doesn't even get to
see the original token.

W.

-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
  2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
  2004-04-07 13:23 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token giovannibajo at libero dot it
@ 2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
  2004-04-08 18:34 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-04-07 13:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-04-07 13:31 -------
Just for comparision here is what ICC 6.0 says:
pr14875.cc(5): warning #470: qualified name is not allowed in member declaration
    Sample::Sample(); 
    ^

pr14875.cc(6): error: expected an identifier
    void Sample::or(long Digital); 
                 ^

pr14875.cc(6): warning #470: qualified name is not allowed in member declaration
    void Sample::or(long Digital); 
         ^

pr14875.cc(6): error: expected a ";"
    void Sample::or(long Digital); 
                 ^

compilation aborted for pr14875.cc (code 2)

-- 


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


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

* [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token
  2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
@ 2004-04-07 13:23 ` giovannibajo at libero dot it
  2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: giovannibajo at libero dot it @ 2004-04-07 13:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-04-07 13:22 -------
Keeping this as a diagnostic enchancement: we should emit a proper error 
message.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2004-04-07 13:22:54
               date|                            |
            Summary|No or in function names     |When using 'or' keyword, the
                   |allowed                     |error message speaks of a
                   |                            |'||' token


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


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

end of thread, other threads:[~2009-04-22 15:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-14875-8295@http.gcc.gnu.org/bugzilla/>
2007-01-28  2:41 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token manu at gcc dot gnu dot org
2007-01-28  4:11 ` gdr at cs dot tamu dot edu
2007-02-01 12:16 ` manu at gcc dot gnu dot org
2007-11-22  8:39 ` spiridenok at tut dot by
2009-02-07 20:29 ` manu at gcc dot gnu dot org
2009-04-22 15:32 ` manu at gcc dot gnu dot org
2009-04-22 15:33 ` manu at gcc dot gnu dot org
2004-04-07 11:58 [Bug c++/14875] New: No or in function names allowed j dot werner at physik dot uni-stuttgart dot de
2004-04-07 13:23 ` [Bug c++/14875] When using 'or' keyword, the error message speaks of a '||' token giovannibajo at libero dot it
2004-04-07 13:31 ` pinskia at gcc dot gnu dot org
2004-04-08 18:34 ` bangerth at dealii dot org
2004-04-08 18:53   ` Zack Weinberg
2004-04-08 18:53 ` zack at codesourcery dot com
2004-04-08 19:54 ` gdr at integrable-solutions dot net

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