public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
       [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
@ 2013-05-17  7:22 ` skannan at redhat dot com
  2013-05-17  7:30 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: skannan at redhat dot com @ 2013-05-17  7:22 UTC (permalink / raw)
  To: gcc-bugs

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

Shakthi Kannan <skannan at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |skannan at redhat dot com

--- Comment #1 from Shakthi Kannan <skannan at redhat dot com> ---
Confirmed.

Tested with cpp (GCC) 4.7.2 20121109.


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

* [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
       [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
  2013-05-17  7:22 ` [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x skannan at redhat dot com
@ 2013-05-17  7:30 ` jakub at gcc dot gnu.org
  2013-05-17  9:15 ` manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-05-17  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Because the eating of comma is a GNU extension.  So it is enabled in GNU
compilation modes (the default, for C -std=gnu89, -std=gnu99, -std=gnu11, for
C++ -std=gnu++98, -std=gnu++03, -std=gnu++11, -std=gnu++0x, -std=gnu++1y) but
not in the more strict standard modes (-std=c{89,99,11},
-std=c++{98,03,11,0x,1y}).


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

* [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
       [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
  2013-05-17  7:22 ` [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x skannan at redhat dot com
  2013-05-17  7:30 ` jakub at gcc dot gnu.org
@ 2013-05-17  9:15 ` manu at gcc dot gnu.org
  2014-07-10 19:24 ` 3dw4rd at verizon dot net
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2013-05-17  9:15 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|INVALID                     |---

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Because the eating of comma is a GNU extension.  So it is enabled in GNU
> compilation modes (the default, for C -std=gnu89, -std=gnu99, -std=gnu11,
> for C++ -std=gnu++98, -std=gnu++03, -std=gnu++11, -std=gnu++0x,
> -std=gnu++1y) but not in the more strict standard modes (-std=c{89,99,11},
> -std=c++{98,03,11,0x,1y}).

But g++ does not warn with -Wpedantic, as it should. Instead it gives a very
strange message about C99 in C++:

test.cc:7:17: warning: ISO C99 requires rest arguments to be used [enabled by
default]
   ASSERT( false );
                 ^

Clang++ does the right thing:

test.cc:2:39: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension
[-Wgnu]
#define ASSERT( cnd, ... ) SomeClass(),##__VA_ARGS__
                                      ^
test.cc:3:39: warning: token pasting of ',' and __VA_ARGS__ is a GNU extension
[-Wgnu]
#define FAIL( ... )        SomeClass(),##__VA_ARGS__
                                      ^
>From gcc-bugs-return-422507-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 17 09:18:45 2013
Return-Path: <gcc-bugs-return-422507-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16709 invoked by alias); 17 May 2013 09:18:45 -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 16680 invoked by uid 48); 17 May 2013 09:18:42 -0000
From: "manu at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/47254] ICE: unspellable token PRAGMA_EOL with #pragma redefine_extname and -fdirectives-only
Date: Fri, 17 May 2013 09:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 4.6.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: manu at gcc dot gnu.org
X-Bugzilla-Status: NEW
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:
Message-ID: <bug-47254-4-VQ1e4Wjwt3@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-47254-4@http.gcc.gnu.org/bugzilla/>
References: <bug-47254-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-05/txt/msg01180.txt.bz2
Content-length: 443

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

--- Comment #4 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Shakthi Kannan from comment #3)
> Sorry, I don't have a gcc.gnu.org account. Can you please change the status
> to "Confirmed"?

It is easy to get one and it is needed for commit access:

http://gcc.gnu.org/svnwrite.html#authenticated

so don't be shy! ;-)

NEW means confirmed, so done!
>From gcc-bugs-return-422508-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri May 17 09:23:43 2013
Return-Path: <gcc-bugs-return-422508-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 18911 invoked by alias); 17 May 2013 09:23:42 -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 18865 invoked by uid 48); 17 May 2013 09:23:38 -0000
From: "dodji at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/56782] [4.8/4.9 Regression] Regression with empty pack expansions
Date: Fri, 17 May 2013 09:23: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.8.0
X-Bugzilla-Keywords: rejects-valid
X-Bugzilla-Severity: normal
X-Bugzilla-Who: dodji at gcc dot gnu.org
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: dodji at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 4.8.1
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_status resolution
Message-ID: <bug-56782-4-SB5s5sDvji@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-56782-4@http.gcc.gnu.org/bugzilla/>
References: <bug-56782-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-05/txt/msg01181.txt.bz2
Content-length: 458

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

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

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

--- Comment #4 from Dodji Seketeli <dodji at gcc dot gnu.org> ---
This has been committed to trunk and 4.8.


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

* [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
       [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2013-05-17  9:15 ` manu at gcc dot gnu.org
@ 2014-07-10 19:24 ` 3dw4rd at verizon dot net
  2014-07-14 15:13 ` manu at gcc dot gnu.org
  2022-04-21 22:07 ` kkylheku at gmail dot com
  5 siblings, 0 replies; 6+ messages in thread
From: 3dw4rd at verizon dot net @ 2014-07-10 19:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44317

--- Comment #4 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
After the fix for PR61389 goes in we'll get:

[ed@localhost tr2]$ /home/ed/bin/bin/g++ -std=gnu++11 -Wpedantic -c
test_pr44317.cpp
test_pr44317.cpp:7:17: warning: ISO C++11 requires at least one argument for
the "..." in a variadic macro
   ASSERT( false );

It still doesn't point to the macro definition though.


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

* [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
       [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-07-10 19:24 ` 3dw4rd at verizon dot net
@ 2014-07-14 15:13 ` manu at gcc dot gnu.org
  2022-04-21 22:07 ` kkylheku at gmail dot com
  5 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2014-07-14 15:13 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 2804 bytes --]

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44317

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-07-14
     Ever confirmed|0                           |1

--- Comment #5 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Confirmed. Perhaps the locations are added after the warning is emitted. Or the
incorrect location is passed to the warning. Needs further debugging.
>From gcc-bugs-return-456308-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 14 15:18:16 2014
Return-Path: <gcc-bugs-return-456308-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 16086 invoked by alias); 14 Jul 2014 15:18:15 -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 15544 invoked by uid 48); 14 Jul 2014 15:18:07 -0000
From: "emsr at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
Date: Mon, 14 Jul 2014 15:18:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: preprocessor
X-Bugzilla-Version: 4.4.4
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: emsr at gcc dot gnu.org
X-Bugzilla-Status: NEW
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: emsr at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: attachments.created
Message-ID: <bug-44317-4-RVRbFjPQjt@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-44317-4@http.gcc.gnu.org/bugzilla/>
References: <bug-44317-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: 2014-07/txt/msg00899.txt.bz2
Content-length: 375

https://gcc.gnu.org/bugzilla/show_bug.cgi?idD317

--- Comment #6 from emsr at gcc dot gnu.org ---
Created attachment 33119
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id3119&actioníit
Patch to pedwarn.

This doesn't have the right column pointed out.
Also, the message (and that given by clang) is, in my opinion, obscure.
At least this starts the ball rolling.


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

* [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x
       [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-07-14 15:13 ` manu at gcc dot gnu.org
@ 2022-04-21 22:07 ` kkylheku at gmail dot com
  5 siblings, 0 replies; 6+ messages in thread
From: kkylheku at gmail dot com @ 2022-04-21 22:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44317

Kaz Kylheku <kkylheku at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kkylheku at gmail dot com

--- Comment #12 from Kaz Kylheku <kkylheku at gmail dot com> ---
(In reply to Harald van Dijk from comment #9)
> The comma should not be eaten, as the invocation of FAIL() is valid in
> standard C++. The rules of concatenation of empty pp-token sequences are
> well-defined: the empty sequences are replaced by placemarker preprocessor
> tokens, and concatenating any non-placeholder token with a placemarker
> preprocessor token produces the former, see [cpp.concat]. 

And thus, more directly to the point, here is the fix:

    cpp -std=gnu++0x test.cpp

The behavior does not reproduce then; the comma eating works.

If you want GNU extensions, request the GNU dialect which most closely
corresponds to the ISO dialect you want.

The issue here is that ## __VA_ARGS__ is a conforming extension in C,
and so it can work even when an ISO dialect is selected.
The documentation does not mention that ## __VA_ARGS__ might be
valid in some dialects of C++ and so has to be enabled as a nonconforming
extension.

Also this is an opton. The following workaround also works for me,
on gcc 10.x on Debian 11:

    #define ASSERT( cnd, ... ) SomeClass() __VA_OPT__(,) __VA_ARGS__
    #define FAIL( ... )        SomeClass() __VA_OPT__(,) __VA_ARGS__

This works with "cpp" with no options, with "-std=gnu++0x",
and with "-std=c++0x".

This may be a better workaround for someone who doesn't want to broadly
switch to the GNU dialect. __VA_OPT__ didn't exist when this bug was opened.

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

end of thread, other threads:[~2022-04-21 22:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44317-4@http.gcc.gnu.org/bugzilla/>
2013-05-17  7:22 ` [Bug preprocessor/44317] ,##__VA_ARGS__ comma not eaten with -std=c++0x skannan at redhat dot com
2013-05-17  7:30 ` jakub at gcc dot gnu.org
2013-05-17  9:15 ` manu at gcc dot gnu.org
2014-07-10 19:24 ` 3dw4rd at verizon dot net
2014-07-14 15:13 ` manu at gcc dot gnu.org
2022-04-21 22:07 ` kkylheku at gmail 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).