public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98859] New: pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive
@ 2021-01-27 20:52 richard-gccbugzilla at metafoo dot co.uk
  2021-01-27 20:54 ` [Bug c++/98859] " mpolacek at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2021-01-27 20:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98859
           Summary: pedantic error on use of __VA_OPT__ before C++20 is
                    unnecessary and counterproductive
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

There's no good way in ISO C or C++ to express what the GNU ,##__VA_ARGS__
extension does prior to the addition of __VA_OPT__. However, code targeting new
compilers (that doesn't want to use GNU C / GNU C++) cannot reliably use
__VA_OPT__ instead of the comma paste extension, because GCC's -pedantic-errors
mode rejects it outside C++20.

Such rejection is unnecessary: __VA_OPT__ is a reserved identifier in other
language modes, so there is no conformance reason to issue a diagnostic on its
use. I think it'd be useful for GCC to unconditionally allow using __VA_OPT__
in all language modes. (I'm changing Clang to do the same.)

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

* [Bug c++/98859] pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive
  2021-01-27 20:52 [Bug c++/98859] New: pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive richard-gccbugzilla at metafoo dot co.uk
@ 2021-01-27 20:54 ` mpolacek at gcc dot gnu.org
  2021-07-30 15:49 ` wuyongwei at gmail dot com
  2022-11-19 11:58 ` wjwray at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-01-27 20:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-01-27
           Keywords|                            |diagnostic

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
That sounds reasonable.

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

* [Bug c++/98859] pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive
  2021-01-27 20:52 [Bug c++/98859] New: pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive richard-gccbugzilla at metafoo dot co.uk
  2021-01-27 20:54 ` [Bug c++/98859] " mpolacek at gcc dot gnu.org
@ 2021-07-30 15:49 ` wuyongwei at gmail dot com
  2022-11-19 11:58 ` wjwray at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wuyongwei at gmail dot com @ 2021-07-30 15:49 UTC (permalink / raw)
  To: gcc-bugs

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

Yongwei Wu <wuyongwei at gmail dot com> changed:

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

--- Comment #2 from Yongwei Wu <wuyongwei at gmail dot com> ---
Here is anotehr good reason:

https://stackoverflow.com/questions/48045470/portably-detect-va-opt-support/48045656

People can detect the presence of __VA_OPT__ support. Currently, the detection
code would cause warnings when -std is set to something like "c++17" (though
luckily not "gnu++17").

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

* [Bug c++/98859] pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive
  2021-01-27 20:52 [Bug c++/98859] New: pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive richard-gccbugzilla at metafoo dot co.uk
  2021-01-27 20:54 ` [Bug c++/98859] " mpolacek at gcc dot gnu.org
  2021-07-30 15:49 ` wuyongwei at gmail dot com
@ 2022-11-19 11:58 ` wjwray at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: wjwray at gmail dot com @ 2022-11-19 11:58 UTC (permalink / raw)
  To: gcc-bugs

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

Will Wray <wjwray at gmail dot com> changed:

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

--- Comment #3 from Will Wray <wjwray at gmail dot com> ---
Linking the related MSVC issue

/Zc:preprocessor __VA_OPT__ is not enabled with /std:c++17
https://developercommunity.visualstudio.com/t/Zc:preprocessor-__VA_OPT__-is-not-enabl

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

end of thread, other threads:[~2022-11-19 11:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-27 20:52 [Bug c++/98859] New: pedantic error on use of __VA_OPT__ before C++20 is unnecessary and counterproductive richard-gccbugzilla at metafoo dot co.uk
2021-01-27 20:54 ` [Bug c++/98859] " mpolacek at gcc dot gnu.org
2021-07-30 15:49 ` wuyongwei at gmail dot com
2022-11-19 11:58 ` wjwray 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).