[all-commits] [llvm/llvm-project] 844e95: [Lex] Only warn on defining or undefining language...

john-brawn-arm via All-commits all-commits at lists.llvm.org
Thu Jun 1 09:38:08 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 844e9534c6d99ddb6bada740839760fa24d17cb6
      https://github.com/llvm/llvm-project/commit/844e9534c6d99ddb6bada740839760fa24d17cb6
  Author: John Brawn <john.brawn at arm.com>
  Date:   2023-06-01 (Thu, 01 Jun 2023)

  Changed paths:
    M clang/lib/Lex/PPDirectives.cpp
    M clang/test/Preprocessor/macro-reserved.c
    A clang/test/Preprocessor/undef-x86.c

  Log Message:
  -----------
  [Lex] Only warn on defining or undefining language-defined builtins

D144654 made it so that we warn on any defining or undefining of
builtin macros. However the C and C++ standards only forbid the
defining or undefining of macros defined in the language standard
itself, but clang defines more macros than those and warning on those
may not be helpful.

Resolve this by only warning if the builtin macro name is the name of
a macro defined by the language. This is done in a way that removes
some of the existing checks, as those were made redundant by
restricting the warning in this way.

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




More information about the All-commits mailing list