diff options
author | Alp Toker <alp@nuanti.com> | 2013-11-26 01:30:10 +0000 |
---|---|---|
committer | Alp Toker <alp@nuanti.com> | 2013-11-26 01:30:10 +0000 |
commit | d8a96a63a331f5486e88ade9f98195b9ef44c954 (patch) | |
tree | 3d9621896e67cca96028861c7319983d92ec7907 /test/Sema/ms-keyword-system-header.c | |
parent | 9a3700283b0f4cabfd149919ece5767fe5cc5d9e (diff) | |
download | clang-d8a96a63a331f5486e88ade9f98195b9ef44c954.tar.gz |
Unbreak -fms-extensions with GNU libc headers
GNU libc uses '__uptr' as a member name in C mode, conflicting with the
eponymous MSVC pointer modifier keyword.
Detect and mark the token as an identifier when these specific conditions are
met. __uptr will continue to work as a keyword for the remainder of the
translation unit.
Fixes PR17824.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195710 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/ms-keyword-system-header.c')
-rw-r--r-- | test/Sema/ms-keyword-system-header.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Sema/ms-keyword-system-header.c b/test/Sema/ms-keyword-system-header.c new file mode 100644 index 0000000000..bf7a9f4c8e --- /dev/null +++ b/test/Sema/ms-keyword-system-header.c @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -fms-extensions -D MS -isystem %S/Inputs %s -fsyntax-only -verify +// RUN: %clang_cc1 -isystem %S/Inputs %s -fsyntax-only -verify + +// PR17824: GNU libc uses MS keyword __uptr as an identifier in C mode +#include <ms-keyword-system-header.h> + +void fn() { + WS ws; + ws.__uptr = 0; +#ifdef MS + // expected-error@-2 {{expected identifier}} +#else + // expected-no-diagnostics +#endif +} |