[all-commits] [llvm/llvm-project] f45379: Suppress non-conforming GNU paste extension in all...

Harald van Dijk via All-commits all-commits at lists.llvm.org
Sun Jan 24 16:57:09 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f4537935dcdbf390c863591cf556e76c3abab9c1
      https://github.com/llvm/llvm-project/commit/f4537935dcdbf390c863591cf556e76c3abab9c1
  Author: Harald van Dijk <harald at gigawatt.nl>
  Date:   2021-01-25 (Mon, 25 Jan 2021)

  Changed paths:
    M clang/lib/Lex/TokenLexer.cpp
    M clang/test/Preprocessor/macro_fn_comma_swallow2.c

  Log Message:
  -----------
  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




More information about the All-commits mailing list