HomePhabricator

Suppress non-conforming GNU paste extension in all standard-conforming modes

Authored by hvdijk on Jan 24 2021, 4:56 PM.

Description

Suppress non-conforming GNU paste extension in all standard-conforming modes

The GNU token paste extension that removes the comma in , ## VA_ARGS
conflicts with C99/C++11's requirements when a variadic macro has no
named parameters: according to the standard, an invocation as FOO()
gives it a single empty argument, and concatenation of anything with an
empty argument is well-defined. For this reason, the GNU extension was
already disabled in C99 standard-conforming mode. It was not yet
disabled in C++11 standard-conforming mode.

The associated comment suggested that GCC keeps this extension enabled
in C90/C++03 standard-conforming mode, but it actually does not, so
rather than adding a check for C++ language version, this change simply
removes the check for C language version.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D91913