[cfe-commits] r160070 - /cfe/trunk/test/Preprocessor/has_include.c

Jordan Rose jordan_rose at apple.com
Wed Jul 11 13:12:19 PDT 2012


Author: jrose
Date: Wed Jul 11 15:12:19 2012
New Revision: 160070

URL: http://llvm.org/viewvc/llvm-project?rev=160070&view=rev
Log:
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.

Modified:
    cfe/trunk/test/Preprocessor/has_include.c

Modified: cfe/trunk/test/Preprocessor/has_include.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/has_include.c?rev=160070&r1=160069&r2=160070&view=diff
==============================================================================
--- cfe/trunk/test/Preprocessor/has_include.c (original)
+++ cfe/trunk/test/Preprocessor/has_include.c Wed Jul 11 15:12:19 2012
@@ -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 at +1 {{missing '(' after '__has_include'}} expected-error at +1 {{expected end of line}}
+#if __has_include "stdint.h")
+#endif
+
+// expected-error at +1 {{expected "FILENAME" or <FILENAME>}} expected-error at +1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include(stdint.h)
+#endif
+
+// expected-error at +1 {{expected "FILENAME" or <FILENAME>}}
+#if __has_include()
+#endif
+
+// expected-error at +1 {{missing '(' after '__has_include'}}
+#if __has_include)
+#endif
+
+// expected-error at +1 {{missing '(' after '__has_include'}} expected-error at +1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include<stdint.h>)
+#endif
+
+// expected-error at +1 {{expected "FILENAME" or <FILENAME>}} expected-warning at +1 {{missing terminating '"' character}}
+#if __has_include("stdint.h)
+#endif
+
+// expected-error at +1 {{expected "FILENAME" or <FILENAME>}} expected-warning at +1 {{missing terminating '"' character}} expected-error at +1 {{token is not a valid binary operator in a preprocessor subexpression}}
+#if __has_include(stdint.h")
+#endif
+
+// expected-error at +1 {{expected "FILENAME" or <FILENAME>}} expected-error at +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>)
+





More information about the cfe-commits mailing list