diff options
Diffstat (limited to 'test/Lexer')
27 files changed, 381 insertions, 23 deletions
diff --git a/test/Lexer/Inputs/bad-header-guard-defined.h b/test/Lexer/Inputs/bad-header-guard-defined.h new file mode 100644 index 0000000..b28f1a8 --- /dev/null +++ b/test/Lexer/Inputs/bad-header-guard-defined.h @@ -0,0 +1,4 @@ +#if !defined(foo) +#define goo +int n; +#endif diff --git a/test/Lexer/Inputs/bad-header-guard.h b/test/Lexer/Inputs/bad-header-guard.h new file mode 100644 index 0000000..601da09 --- /dev/null +++ b/test/Lexer/Inputs/bad-header-guard.h @@ -0,0 +1,4 @@ +#ifndef bad_header_guard +#define bad_guard + +#endif diff --git a/test/Lexer/Inputs/different-define.h b/test/Lexer/Inputs/different-define.h new file mode 100644 index 0000000..f23454b --- /dev/null +++ b/test/Lexer/Inputs/different-define.h @@ -0,0 +1,4 @@ +#ifndef different_define +#define FOO 5 + +#endif diff --git a/test/Lexer/Inputs/good-header-guard.h b/test/Lexer/Inputs/good-header-guard.h new file mode 100644 index 0000000..664a479 --- /dev/null +++ b/test/Lexer/Inputs/good-header-guard.h @@ -0,0 +1,4 @@ +#ifndef good_header_guard +#define good_header_guard + +#endif diff --git a/test/Lexer/Inputs/multiple.h b/test/Lexer/Inputs/multiple.h new file mode 100644 index 0000000..5dfb327 --- /dev/null +++ b/test/Lexer/Inputs/multiple.h @@ -0,0 +1,4 @@ +#ifndef multiple +#define multi + +#endif diff --git a/test/Lexer/Inputs/no-define.h b/test/Lexer/Inputs/no-define.h new file mode 100644 index 0000000..591a66b --- /dev/null +++ b/test/Lexer/Inputs/no-define.h @@ -0,0 +1,3 @@ +#ifndef no_define + +#endif diff --git a/test/Lexer/Inputs/out-of-order-define.h b/test/Lexer/Inputs/out-of-order-define.h new file mode 100644 index 0000000..d38e93f --- /dev/null +++ b/test/Lexer/Inputs/out-of-order-define.h @@ -0,0 +1,7 @@ +#ifndef out_of_order + +#define something_else + +#define out_of_order + +#endif diff --git a/test/Lexer/Inputs/tokens-between-ifndef-and-define.h b/test/Lexer/Inputs/tokens-between-ifndef-and-define.h new file mode 100644 index 0000000..ce8d770 --- /dev/null +++ b/test/Lexer/Inputs/tokens-between-ifndef-and-define.h @@ -0,0 +1,7 @@ +#ifndef tokens_between + +const int pi = 3; + +#define pi_is_bad + +#endif diff --git a/test/Lexer/Inputs/unlikely-to-be-header-guard.h b/test/Lexer/Inputs/unlikely-to-be-header-guard.h new file mode 100644 index 0000000..098fc3c --- /dev/null +++ b/test/Lexer/Inputs/unlikely-to-be-header-guard.h @@ -0,0 +1,5 @@ +#ifndef data_rep_h +#define use_alternate_data_rep +/* #include "data_rep.h" */ +#endif + diff --git a/test/Lexer/builtin_redef.c b/test/Lexer/builtin_redef.c index c9351dc..b0bb2a0 100644 --- a/test/Lexer/builtin_redef.c +++ b/test/Lexer/builtin_redef.c @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -E 2>&1 | FileCheck %s --check-prefix=CHECK-OUT // RUN: %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -E 2>&1 | FileCheck %s --check-prefix=CHECK-WARN -// RUN: %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -E 2>&1 -pedantic-errors | FileCheck %s --check-prefix=CHECK-ERR +// RUN: not %clang_cc1 %s -D__TIME__=1234 -U__DATE__ -E 2>&1 -pedantic-errors | FileCheck %s --check-prefix=CHECK-ERR // CHECK-WARN: <command line>:{{.*}} warning: redefining builtin macro // CHECK-WARN: <command line>:{{.*}} warning: undefining builtin macro diff --git a/test/Lexer/char-literal.cpp b/test/Lexer/char-literal.cpp index b2fab34..1cd14a9 100644 --- a/test/Lexer/char-literal.cpp +++ b/test/Lexer/char-literal.cpp @@ -36,8 +36,4 @@ char16_t p[2] = u"\U0000FFFF"; char16_t q[2] = u"\U00010000"; #ifdef __cplusplus // expected-error@-2 {{too long}} -#else -// FIXME: The above should be accepted in C11 mode. -// expected-error@-6 {{must be an initializer list}} -// expected-error@-6 {{must be an initializer list}} #endif diff --git a/test/Lexer/constants.c b/test/Lexer/constants.c index 2903885..f0cd4d7 100644 --- a/test/Lexer/constants.c +++ b/test/Lexer/constants.c @@ -13,7 +13,12 @@ float Y = 08.123456; // PR2252 #if -0x8000000000000000 // should not warn. #endif - +#if -01000000000000000000000 // should not warn. +#endif +#if 9223372036854775808 // expected-warning {{integer constant is larger than the largest signed integer type}} +#endif +#if 0x10000000000000000 // expected-error {{integer constant is larger than the largest unsigned integer type}} +#endif int c[] = { 'df', // expected-warning {{multi-character character constant}} diff --git a/test/Lexer/cxx-features.cpp b/test/Lexer/cxx-features.cpp new file mode 100644 index 0000000..1202ecb --- /dev/null +++ b/test/Lexer/cxx-features.cpp @@ -0,0 +1,89 @@ +// RUN: %clang_cc1 -std=c++98 -verify %s +// RUN: %clang_cc1 -std=c++11 -verify %s +// RUN: %clang_cc1 -std=c++1y -verify %s + +// expected-no-diagnostics + +#if __cplusplus < 201103L +#define check(macro, cxx98, cxx11, cxx1y) cxx98 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx98 +#elif __cplusplus < 201304L +#define check(macro, cxx98, cxx11, cxx1y) cxx11 == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx11 +#else +#define check(macro, cxx98, cxx11, cxx1y) cxx1y == 0 ? defined(__cpp_##macro) : __cpp_##macro != cxx1y +#endif + +#if check(binary_literals, 0, 0, 201304) +#error "wrong value for __cpp_binary_literals" +#endif + +#if check(init_captures, 0, 0, 201304) +#error "wrong value for __cpp_init_captures" +#endif + +#if check(generic_lambdas, 0, 0, 201304) +#error "wrong value for __cpp_generic_lambdas" +#endif + +#if check(constexpr, 0, 200704, 201304) +#error "wrong value for __cpp_constexpr" +#endif + +#if check(decltype_auto, 0, 0, 201304) +#error "wrong value for __cpp_decltype_auto" +#endif + +#if check(return_type_deduction, 0, 0, 201304) +#error "wrong value for __cpp_return_type_deduction" +#endif + +#if check(runtime_arrays, 0, 0, 0) +#error "wrong value for __cpp_runtime_arrays" +#endif + +#if check(aggregate_nsdmi, 0, 0, 201304) +#error "wrong value for __cpp_aggregate_nsdmi" +#endif + +#if check(variable_templates, 0, 0, 201304) +#error "wrong value for __cpp_variable_templates" +#endif + +#if check(unicode_characters, 0, 200704, 200704) +#error "wrong value for __cpp_unicode_characters" +#endif + +#if check(raw_strings, 0, 200710, 200710) +#error "wrong value for __cpp_raw_strings" +#endif + +#if check(unicode_literals, 0, 200710, 200710) +#error "wrong value for __cpp_unicode_literals" +#endif + +#if check(user_defined_literals, 0, 200809, 200809) +#error "wrong value for __cpp_user_defined_literals" +#endif + +#if check(lambdas, 0, 200907, 200907) +#error "wrong value for __cpp_lambdas" +#endif + +#if check(static_assert, 0, 200410, 200410) +#error "wrong value for __cpp_static_assert" +#endif + +#if check(decltype, 0, 200707, 200707) +#error "wrong value for __cpp_decltype" +#endif + +#if check(attributes, 0, 200809, 200809) +#error "wrong value for __cpp_attributes" +#endif + +#if check(rvalue_references, 0, 200610, 200610) +#error "wrong value for __cpp_rvalue_references" +#endif + +#if check(variadic_templates, 0, 200704, 200704) +#error "wrong value for __cpp_variadic_templates" +#endif diff --git a/test/Lexer/cxx0x_raw_string_unterminated.cpp b/test/Lexer/cxx0x_raw_string_unterminated.cpp index dfbaaee..be134f8 100644 --- a/test/Lexer/cxx0x_raw_string_unterminated.cpp +++ b/test/Lexer/cxx0x_raw_string_unterminated.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -std=c++11 -E %s 2>&1 | grep 'error: raw string missing terminating delimiter )foo"' +// RUN: not %clang_cc1 -std=c++11 -E %s 2>&1 | grep 'error: raw string missing terminating delimiter )foo"' const char *str = R"foo(abc def)bar"; diff --git a/test/Lexer/cxx1y_binary_literal.cpp b/test/Lexer/cxx1y_binary_literal.cpp index 96dce3d..662e99d 100644 --- a/test/Lexer/cxx1y_binary_literal.cpp +++ b/test/Lexer/cxx1y_binary_literal.cpp @@ -17,3 +17,4 @@ int k1 = 0b1234; // expected-error {{invalid digit '2' in binary constant}} // we'll need to rework our binary literal parsing rules. int k2 = 0b10010f; // expected-error {{invalid digit 'f' in binary constant}} int k3 = 0b10010g; // expected-error {{invalid suffix 'g' on integer constant}} +int k4 = 0b; // expected-error {{invalid digit 'b' in octal constant}} diff --git a/test/Lexer/cxx1y_digit_separators.cpp b/test/Lexer/cxx1y_digit_separators.cpp new file mode 100644 index 0000000..39ea3e7 --- /dev/null +++ b/test/Lexer/cxx1y_digit_separators.cpp @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -std=c++1y -verify %s + +int operator""ms(unsigned long long); // expected-warning {{reserved}} +float operator""ms(long double); // expected-warning {{reserved}} + +int operator""_foo(unsigned long long); + +namespace integral { + static_assert(1'2'3 == 12'3, ""); + static_assert(1'000'000 == 0xf'4240, ""); + static_assert(0'004'000'000 == 0x10'0000, ""); + static_assert(0b0101'0100 == 0x54, ""); + + int a = 123'; //'; // expected-error {{expected ';'}} + int b = 0'xff; // expected-error {{digit separator cannot appear at end of digit sequence}} expected-error {{suffix 'xff' on integer}} + int c = 0x'ff; // expected-error {{suffix 'x'ff' on integer}} + int d = 0'1234; // ok, octal + int e = 0'b1010; // expected-error {{digit 'b' in octal constant}} + int f = 0b'1010; // expected-error {{invalid digit 'b' in octal}} + int g = 123'ms; // expected-error {{digit separator cannot appear at end of digit sequence}} + + int z = 0'123'_foo; //'; // expected-error {{cannot appear at end of digit seq}} +} + +namespace floating { + static_assert(0'123.456'7 == 123.4567, ""); + static_assert(1e1'0 == 10'000'000'000, ""); + + float a = 1'e1; // expected-error {{digit separator cannot appear at end of digit sequence}} + float b = 1'0e1; + float c = 1.'0e1; // expected-error {{digit separator cannot appear at start of digit sequence}} + float d = 1.0'e1; // expected-error {{digit separator cannot appear at end of digit sequence}} + float e = 1e'1; // expected-error {{digit separator cannot appear at start of digit sequence}} + float f = 1e1'ms; // expected-error {{digit separator cannot appear at end of digit sequence}} +} + +#line 123'456 +static_assert(__LINE__ == 123456, ""); + +// x has value 0 in C++11 and 34 in C++1y. +#define M(x, ...) __VA_ARGS__ +constexpr int x = { M(1'2,3'4) }; +static_assert(x == 34, ""); diff --git a/test/Lexer/dollar-idents.c b/test/Lexer/dollar-idents.c index e57ee86..a1263b4 100644 --- a/test/Lexer/dollar-idents.c +++ b/test/Lexer/dollar-idents.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -dump-tokens %s 2>&1 | FileCheck %s -// RUN: %clang_cc1 -dump-tokens -x assembler-with-cpp %s 2>&1 | FileCheck %s --check-prefix=ASM +// RUN: %clang_cc1 -dump-tokens -x assembler-with-cpp %s 2>&1 | FileCheck %s --check-prefix=CHECK-ASM // PR3808 // CHECK: identifier '$A' diff --git a/test/Lexer/gnu-flags.c b/test/Lexer/gnu-flags.c new file mode 100644 index 0000000..6e47547 --- /dev/null +++ b/test/Lexer/gnu-flags.c @@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE +// RUN: %clang_cc1 -fsyntax-only -verify %s -DALL -Wgnu +// RUN: %clang_cc1 -fsyntax-only -verify %s -DALL \ +// RUN: -Wgnu-zero-variadic-macro-arguments \ +// RUN: -Wgnu-imaginary-constant -Wgnu-binary-literal -Wgnu-zero-line-directive +// RUN: %clang_cc1 -fsyntax-only -verify %s -DNONE -Wgnu \ +// RUN: -Wno-gnu-zero-variadic-macro-arguments \ +// RUN: -Wno-gnu-imaginary-constant -Wno-gnu-binary-literal -Wno-gnu-zero-line-directive +// Additional disabled tests: +// %clang_cc1 -fsyntax-only -verify %s -DZEROARGS -Wgnu-zero-variadic-macro-arguments +// %clang_cc1 -fsyntax-only -verify %s -DIMAGINARYCONST -Wgnu-imaginary-constant +// %clang_cc1 -fsyntax-only -verify %s -DBINARYLITERAL -Wgnu-binary-literal +// %clang_cc1 -fsyntax-only -verify %s -DLINE0 -Wgnu-zero-line-directive + +#if NONE +// expected-no-diagnostics +#endif + + +#if ALL || ZEROARGS +// expected-warning@+9 {{must specify at least one argument for '...' parameter of variadic macro}} +// expected-note@+4 {{macro 'efoo' defined here}} +// expected-warning@+3 {{token pasting of ',' and __VA_ARGS__ is a GNU extension}} +#endif + +#define efoo(format, args...) foo(format , ##args) + +void foo( const char* c ) +{ + efoo("6"); +} + + +#if ALL || IMAGINARYCONST +// expected-warning@+3 {{imaginary constants are a GNU extension}} +#endif + +float _Complex c = 1.if; + + +#if ALL || BINARYLITERAL +// expected-warning@+3 {{binary integer literals are a GNU extension}} +#endif + +int b = 0b0101; + + +// This case is handled differently because lit has a bug whereby #line 0 is reported to be on line 4294967295 +// http://llvm.org/bugs/show_bug.cgi?id=16952 +#if ALL || LINE0 +#line 0 // expected-warning {{#line directive with zero argument is a GNU extension}} +#else +#line 0 +#endif + +// WARNING: Do not add more tests after the #line 0 line! Add them before the LINE0 test diff --git a/test/Lexer/has_extension_cxx.cpp b/test/Lexer/has_extension_cxx.cpp index 68b542f..d3483df 100644 --- a/test/Lexer/has_extension_cxx.cpp +++ b/test/Lexer/has_extension_cxx.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -E %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++98 -E %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -E %s -o - | FileCheck %s --check-prefix=CHECK11 // CHECK: c_static_assert #if __has_extension(c_static_assert) @@ -40,16 +41,23 @@ int has_reference_qualified_functions(); int has_rvalue_references(); #endif +// CHECK: has_local_type_template_args #if __has_extension(cxx_local_type_template_args) int has_local_type_template_args(); -#else -int no_local_type_template_args(); #endif -// CHECK: has_local_type_template_args - +// CHECK: has_binary_literals #if __has_extension(cxx_binary_literals) int has_binary_literals(); #endif -// CHECK: has_binary_literals +// CHECK: has_variable_templates +#if __has_extension(cxx_variable_templates) +int has_variable_templates(); +#endif + +// CHECK-NOT: has_init_captures +// CHECK11: has_init_captures +#if __has_extension(cxx_init_captures) +int has_init_captures(); +#endif diff --git a/test/Lexer/has_feature_cxx0x.cpp b/test/Lexer/has_feature_cxx0x.cpp index 62a965c..b2fe842 100644 --- a/test/Lexer/has_feature_cxx0x.cpp +++ b/test/Lexer/has_feature_cxx0x.cpp @@ -346,3 +346,53 @@ int no_aggregate_nsdmi(); // CHECK-1Y: has_aggregate_nsdmi // CHECK-11: no_aggregate_nsdmi // CHECK-NO-11: no_aggregate_nsdmi + +#if __has_feature(cxx_return_type_deduction) +int has_return_type_deduction(); +#else +int no_return_type_deduction(); +#endif + +// CHECK-1Y: has_return_type_deduction +// CHECK-11: no_return_type_deduction +// CHECK-NO-11: no_return_type_deduction + +#if __has_feature(cxx_contextual_conversions) +int has_contextual_conversions(); +#else +int no_contextual_conversions(); +#endif + +// CHECK-1Y: has_contextual_conversions +// CHECK-11: no_contextual_conversions +// CHECK-NO-11: no_contextual_conversions + +#if __has_feature(cxx_relaxed_constexpr) +int has_relaxed_constexpr(); +#else +int no_relaxed_constexpr(); +#endif + +// CHECK-1Y: has_relaxed_constexpr +// CHECK-11: no_relaxed_constexpr +// CHECK-NO-11: no_relaxed_constexpr + +#if __has_feature(cxx_variable_templates) +int has_variable_templates(); +#else +int no_variable_templates(); +#endif + +// CHECK-1Y: has_variable_templates +// CHECK-11: no_variable_templates +// CHECK-NO-11: no_variable_templates + +#if __has_feature(cxx_init_captures) +int has_init_captures(); +#else +int no_init_captures(); +#endif + +// CHECK-1Y: has_init_captures +// CHECK-11: no_init_captures +// CHECK-NO-11: no_init_captures diff --git a/test/Lexer/header.cpp b/test/Lexer/header.cpp new file mode 100644 index 0000000..f02b1e6 --- /dev/null +++ b/test/Lexer/header.cpp @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -fsyntax-only -Wno-header-guard %s +// RUN: %clang_cc1 -fsyntax-only -Wheader-guard %s 2>&1 | FileCheck %s + +#include "Inputs/good-header-guard.h" +#include "Inputs/no-define.h" +#include "Inputs/different-define.h" +#include "Inputs/out-of-order-define.h" +#include "Inputs/tokens-between-ifndef-and-define.h" +#include "Inputs/unlikely-to-be-header-guard.h" + +#include "Inputs/bad-header-guard.h" +// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}: +// CHECK: {{.*}}bad-header-guard.h:1:9: warning: 'bad_header_guard' is used as a header guard here, followed by #define of a different macro +// CHECK: {{^}}#ifndef bad_header_guard +// CHECK: {{^}} ^~~~~~~~~~~~~~~~ +// CHECK: {{.*}}bad-header-guard.h:2:9: note: 'bad_guard' is defined here; did you mean 'bad_header_guard'? +// CHECK: {{^}}#define bad_guard +// CHECK: {{^}} ^~~~~~~~~ +// CHECK: {{^}} bad_header_guard + +#include "Inputs/bad-header-guard-defined.h" +// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}: +// CHECK: {{.*}}bad-header-guard-defined.h:1:2: warning: 'foo' is used as a header guard here, followed by #define of a different macro +// CHECK: {{^}}#if !defined(foo) +// CHECK: {{^}} ^~ +// CHECK: {{.*}}bad-header-guard-defined.h:2:9: note: 'goo' is defined here; did you mean 'foo'? +// CHECK: {{^}}#define goo +// CHECK: {{^}} ^~~ +// CHECK: {{^}} foo + +#include "Inputs/multiple.h" +#include "Inputs/multiple.h" +#include "Inputs/multiple.h" +#include "Inputs/multiple.h" +// CHECK: In file included from {{.*}}header.cpp:{{[0-9]*}}: +// CHECK: {{.*}}multiple.h:1:9: warning: 'multiple' is used as a header guard here, followed by #define of a different macro +// CHECK: {{^}}#ifndef multiple +// CHECK: {{^}} ^~~~~~~~ +// CHECK: {{.*}}multiple.h:2:9: note: 'multi' is defined here; did you mean 'multiple'? +// CHECK: {{^}}#define multi +// CHECK: {{^}} ^~~~~ +// CHECK: {{^}} multiple + +// CHECK: 3 warnings generated. diff --git a/test/Lexer/newline-eof-c++11.cpp b/test/Lexer/newline-eof-c++11.cpp deleted file mode 100644 index eeabe8b..0000000 --- a/test/Lexer/newline-eof-c++11.cpp +++ /dev/null @@ -1,5 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wnewline-eof -verify %s -// expected-no-diagnostics - -// The following line isn't terminated, don't fix it. -void foo() {}
\ No newline at end of file diff --git a/test/Lexer/newline-eof-c++98-compat.cpp b/test/Lexer/newline-eof-c++98-compat.cpp index 3e5c8e2..9af0b88 100644 --- a/test/Lexer/newline-eof-c++98-compat.cpp +++ b/test/Lexer/newline-eof-c++98-compat.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -Wc++98-compat-pedantic -std=c++11 -verify %s +// RUN: %clang_cc1 -fsyntax-only -Wc++98-compat-pedantic -Wnewline-eof -std=c++11 -verify %s // The following line isn't terminated, don't fix it. void foo() {} // expected-warning{{C++98 requires newline at end of file}}
\ No newline at end of file diff --git a/test/Lexer/newline-eof.c b/test/Lexer/newline-eof.c index a4a1883..340d9de 100644 --- a/test/Lexer/newline-eof.c +++ b/test/Lexer/newline-eof.c @@ -1,9 +1,15 @@ // RUN: %clang_cc1 -fsyntax-only -Wnewline-eof -verify %s +// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++03 -pedantic -verify %s // RUN: %clang_cc1 -fsyntax-only -Wnewline-eof %s 2>&1 | FileCheck %s // rdar://9133072 +// In C++11 mode, this is allowed, so don't warn in pedantic mode. +// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -Wnewline-eof -verify %s +// RUN: %clang_cc1 -fsyntax-only -x c++ -std=c++11 -Werror -pedantic %s + // Make sure the diagnostic shows up properly at the end of the last line. -// CHECK: newline-eof.c:9:63 +// CHECK: newline-eof.c:[[@LINE+3]]:63 // The following line isn't terminated, don't fix it. void foo() {} // expected-warning{{no newline at end of file}}
\ No newline at end of file diff --git a/test/Lexer/pragma-operators.cpp b/test/Lexer/pragma-operators.cpp index 6a5a498..7270f1e 100644 --- a/test/Lexer/pragma-operators.cpp +++ b/test/Lexer/pragma-operators.cpp @@ -35,3 +35,25 @@ B(foo) // CHECK: #pragma message("\042Hello\042, world!") // CHECK: 0; int n = pragma_L pragma_u8 pragma_u pragma_U pragma_R pragma_UR pragma_hello 0; + +#pragma warning(disable : 1 2L 3U ; error : 4 5 6 ; suppress : 7 8 9) +// CHECK: #pragma warning(disable: 1 2 3) +// CHECK: #line [[@LINE-2]] +// CHECK: #pragma warning(error: 4 5 6) +// CHECK: #line [[@LINE-4]] +// CHECK: #pragma warning(suppress: 7 8 9) + +#pragma warning(push) +#pragma warning(push, 1L) +#pragma warning(push, 4U) +#pragma warning(push, 0x1) +#pragma warning(push, 03) +#pragma warning(push, 0b10) +#pragma warning(push, 1i8) +// CHECK: #pragma warning(push) +// CHECK: #pragma warning(push, 1) +// CHECK: #pragma warning(push, 4) +// CHECK: #pragma warning(push, 1) +// CHECK: #pragma warning(push, 3) +// CHECK: #pragma warning(push, 2) +// CHECK: #pragma warning(push, 1) diff --git a/test/Lexer/string-literal-errors.cpp b/test/Lexer/string-literal-errors.cpp index be574c2..d8e2993 100644 --- a/test/Lexer/string-literal-errors.cpp +++ b/test/Lexer/string-literal-errors.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s +// RUN: not %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -strict-whitespace %s void foo() { (void)"\q \u123z \x \U \U123 \U12345 \u123 \xyzzy \777 \U" diff --git a/test/Lexer/wchar-signedness.c b/test/Lexer/wchar-signedness.c index fea0eca..b5d4ac8 100644 --- a/test/Lexer/wchar-signedness.c +++ b/test/Lexer/wchar-signedness.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple x86_64-none-linux-gnu | FileCheck %s --check-prefix=X86 -// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple armv7-none-eabi | FileCheck %s --check-prefix=ARM +// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple x86_64-none-linux-gnu | FileCheck %s --check-prefix=CHECK-X86 +// RUN: %clang_cc1 -fsyntax-only -dM -E %s -triple armv7-none-eabi | FileCheck %s --check-prefix=CHECK-ARM // CHECK-X86-NOT: #define __WCHAR_UNSIGNED__ // CHECK-X86: #define __WINT_UNSIGNED__ 1 |