summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor
diff options
context:
space:
mode:
authorYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2015-03-23 20:41:42 +0000
committerYunzhong Gao <Yunzhong_Gao@playstation.sony.com>2015-03-23 20:41:42 +0000
commit99efc0361b2d071d062f8803433a52ab77e8ba15 (patch)
treeb7c33a8d758df9c616e6221124f749f464d016ca /clang/test/Preprocessor
parentae3d78ac1865d6470874cc85de90a2ce4d9c7e80 (diff)
downloadbcm5719-llvm-99efc0361b2d071d062f8803433a52ab77e8ba15.tar.gz
bcm5719-llvm-99efc0361b2d071d062f8803433a52ab77e8ba15.zip
Adds a warning for unrecognized argument to #pragma comment() on PS4.
PS4 target recognizes the #pragma comment() syntax as in -fms-extensions, but only handles the case of #pragma comment(lib). This patch adds a warning if any other arguments are encountered. This patch also refactors the code in ParsePragma.cpp a little bit to make it more obvious that some codes are being shared between -fms-extensions and PS4. llvm-svn: 233015
Diffstat (limited to 'clang/test/Preprocessor')
-rw-r--r--clang/test/Preprocessor/pragma_ps4.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/clang/test/Preprocessor/pragma_ps4.c b/clang/test/Preprocessor/pragma_ps4.c
new file mode 100644
index 00000000000..63651b6a96f
--- /dev/null
+++ b/clang/test/Preprocessor/pragma_ps4.c
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 %s -triple x86_64-scei-ps4 -fsyntax-only -verify -fms-extensions
+
+// On PS4, issue a diagnostic that pragma comments are ignored except:
+// #pragma comment lib
+
+#pragma comment(lib)
+#pragma comment(lib,"foo")
+__pragma(comment(lib, "bar"))
+
+#pragma comment(linker) // expected-warning {{'#pragma comment linker' ignored}}
+#pragma comment(linker,"foo") // expected-warning {{'#pragma comment linker' ignored}}
+__pragma(comment(linker, " bar=" "2")) // expected-warning {{'#pragma comment linker' ignored}}
+
+#pragma comment(user) // expected-warning {{'#pragma comment user' ignored}}
+#pragma comment(user, "Compiled on " __DATE__ " at " __TIME__ ) // expected-warning {{'#pragma comment user' ignored}}
+__pragma(comment(user, "foo")) // expected-warning {{'#pragma comment user' ignored}}
+
+#pragma comment(compiler) // expected-warning {{'#pragma comment compiler' ignored}}
+#pragma comment(compiler, "foo") // expected-warning {{'#pragma comment compiler' ignored}}
+__pragma(comment(compiler, "foo")) // expected-warning {{'#pragma comment compiler' ignored}}
+
+#pragma comment(exestr) // expected-warning {{'#pragma comment exestr' ignored}}
+#pragma comment(exestr, "foo") // expected-warning {{'#pragma comment exestr' ignored}}
+__pragma(comment(exestr, "foo")) // expected-warning {{'#pragma comment exestr' ignored}}
+
+#pragma comment(foo) // expected-error {{unknown kind of pragma comment}}
+__pragma(comment(foo)) // expected-error {{unknown kind of pragma comment}}
OpenPOWER on IntegriCloud