clang converts keywords to identifiers for compatibility with various system headers such as GNU libc. Implement a -Wkeyword-compat extension warning to diagnose those cases. The warning is on by default but will generally be ignored in system headers. It can however be enabled globally to aid standards conformance testing. This also changes the __uptr keyword avoidance from r195710 to no longer special-case system headers, bringing it in line with other similar workarounds in clang. Implementation returns bool for symmetry with token annotation functions. Some examples: warning: keyword '__is_pod' will be treated as an identifier for the remainder of the translation unit [-Wkeyword-compat] struct __is_pod warning: keyword '__uptr' will be treated as an identifier here [-Wkeyword-compat] union w *__uptr; llvm-svn: 196212
16 lines
554 B
C++
16 lines
554 B
C++
// Test this without pch.
|
|
// RUN: %clang_cc1 -include %S/cxx-traits.h -std=c++11 -fsyntax-only -verify %s
|
|
|
|
// RUN: %clang_cc1 -x c++-header -std=c++11 -emit-pch -o %t %S/cxx-traits.h
|
|
// RUN: %clang_cc1 -std=c++11 -include-pch %t -DPCH -fsyntax-only -verify %s
|
|
|
|
#ifdef PCH
|
|
// expected-no-diagnostics
|
|
#endif
|
|
|
|
bool _Is_pod_comparator = __is_pod<int>::__value;
|
|
bool _Is_empty_check = __is_empty<int>::__value;
|
|
|
|
bool default_construct_int = is_trivially_constructible<int>::value;
|
|
bool copy_construct_int = is_trivially_constructible<int, const int&>::value;
|