summaryrefslogtreecommitdiff
path: root/test/Sema/ms-keyword-system-header.c
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-11-26 01:30:10 +0000
committerAlp Toker <alp@nuanti.com>2013-11-26 01:30:10 +0000
commitd8a96a63a331f5486e88ade9f98195b9ef44c954 (patch)
tree3d9621896e67cca96028861c7319983d92ec7907 /test/Sema/ms-keyword-system-header.c
parent9a3700283b0f4cabfd149919ece5767fe5cc5d9e (diff)
downloadclang-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.c15
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
+}