John Brawn 844e9534c6 [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
2023-06-01 17:37:50 +01:00

13 lines
342 B
C

// RUN: %clang_cc1 -triple=i386-none-none -fsyntax-only -verify %s
// RUN: %clang_cc1 -triple=x86_64-none-none -fsyntax-only -verify %s
// Check that we can undefine triple-specific defines without warning
// expected-no-diagnostics
#undef __i386
#undef __i386__
#undef i386
#undef __amd64
#undef __amd64__
#undef __x86_64
#undef __x86_64__