summaryrefslogtreecommitdiffstats
path: root/clang/test/Preprocessor/has_include.c
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-07-11 20:12:19 +0000
committerJordan Rose <jordan_rose@apple.com>2012-07-11 20:12:19 +0000
commit1fa2acaed477d6aeb54ad4cb2c5e753ed91b0e80 (patch)
treea187b9794741ac6a6ca6562fff3285ca82a50a92 /clang/test/Preprocessor/has_include.c
parent8446ede0236cb45748aeacac4ffdbb32d1510f10 (diff)
downloadbcm5719-llvm-1fa2acaed477d6aeb54ad4cb2c5e753ed91b0e80.tar.gz
bcm5719-llvm-1fa2acaed477d6aeb54ad4cb2c5e753ed91b0e80.zip
Start testing some commented-out cases of badly-formed __has_include.
Filed PR13334 for the cases that cause the compiler to crash, and PR13335 for the cases where we should be recovering more gracefully. llvm-svn: 160070
Diffstat (limited to 'clang/test/Preprocessor/has_include.c')
-rw-r--r--clang/test/Preprocessor/has_include.c48
1 files changed, 37 insertions, 11 deletions
diff --git a/clang/test/Preprocessor/has_include.c b/clang/test/Preprocessor/has_include.c
index fdcae78b751..13c8d566223 100644
--- a/clang/test/Preprocessor/has_include.c
+++ b/clang/test/Preprocessor/has_include.c
@@ -65,19 +65,45 @@
#endif
// Try badly formed expressions.
-// FIXME: I don't quite know how to avoid preprocessor side effects.
-// Use FileCheck?
-// It also assert due to unterminated #if's.
+// FIXME: We can recover better in almost all of these cases. (PR13335)
+
+// expected-error@+1 {{missing '(' after '__has_include'}} expected-error@+1 {{expected end of line}}
+#if __has_include "stdint.h")
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include(stdint.h)
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME>}}
+#if __has_include()
+#endif
+
+// expected-error@+1 {{missing '(' after '__has_include'}}
+#if __has_include)
+#endif
+
+// expected-error@+1 {{missing '(' after '__has_include'}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include<stdint.h>)
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-warning@+1 {{missing terminating '"' character}}
+#if __has_include("stdint.h)
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-warning@+1 {{missing terminating '"' character}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include(stdint.h")
+#endif
+
+// expected-error@+1 {{expected "FILENAME" or <FILENAME>}} expected-error@+1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include(stdint.h>)
+#endif
+
+
+// FIXME: These test cases cause the compiler to crash. (PR13334)
//#if __has_include("stdint.h"
-//#if __has_include "stdint.h")
-//#if __has_include(stdint.h)
-//#if __has_include()
//#if __has_include(
-//#if __has_include)
//#if __has_include
//#if __has_include(<stdint.h>
-//#if __has_include<stdint.h>)
-//#if __has_include("stdint.h)
-//#if __has_include(stdint.h")
//#if __has_include(<stdint.h)
-//#if __has_include(stdint.h>)
+
OpenPOWER on IntegriCloud