Skip to content
Snippets Groups Projects
Commit 4b49756f authored by Jordan Rose's avatar Jordan Rose
Browse files

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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160070 91177308-0d34-0410-b5e6-96231b3b80d8
parent 78541c43
No related branches found
No related tags found
Loading
...@@ -65,19 +65,45 @@ ...@@ -65,19 +65,45 @@
#endif #endif
// Try badly formed expressions. // Try badly formed expressions.
// FIXME: I don't quite know how to avoid preprocessor side effects. // FIXME: We can recover better in almost all of these cases. (PR13335)
// Use FileCheck?
// It also assert due to unterminated #if's. // 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(stdint.h)
//#if __has_include()
//#if __has_include( //#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) //#if __has_include(<stdint.h)
//#if __has_include(stdint.h>)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment