diff options
| author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-24 18:19:21 +0000 |
|---|---|---|
| committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-24 18:19:21 +0000 |
| commit | 1cd230570394513774b42158e7d69ca2439f11ca (patch) | |
| tree | 8f40bbef2e0373c2e5b7e4ec938054ef7c3283c3 /clang/test | |
| parent | 43de0f95ed4b63c5e2cab16f6733cbf7c13b1d27 (diff) | |
| download | bcm5719-llvm-1cd230570394513774b42158e7d69ca2439f11ca.tar.gz bcm5719-llvm-1cd230570394513774b42158e7d69ca2439f11ca.zip | |
Change the wording of the extension warning from
> 'long long' is an extension when C99 mode is not enabled
to
> 'long long' is a C++11 extension
while compiling in C++98 mode.
llvm-svn: 164545
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Lexer/long-long.cpp | 22 | ||||
| -rw-r--r-- | clang/test/Sema/c89-2.c | 5 | ||||
| -rw-r--r-- | clang/test/Sema/c89.c | 6 | ||||
| -rw-r--r-- | clang/test/SemaCXX/constant-expression.cpp | 2 | ||||
| -rw-r--r-- | clang/test/SemaCXX/cxx98-compat-pedantic.cpp | 6 |
5 files changed, 35 insertions, 6 deletions
diff --git a/clang/test/Lexer/long-long.cpp b/clang/test/Lexer/long-long.cpp new file mode 100644 index 00000000000..c3f371d17f0 --- /dev/null +++ b/clang/test/Lexer/long-long.cpp @@ -0,0 +1,22 @@ +/* RUN: %clang_cc1 -x c -std=c89 -fsyntax-only -verify -pedantic-errors -Wno-empty-translation-unit %s + * RUN: %clang_cc1 -x c -std=c99 -fsyntax-only -verify -pedantic-errors -Wno-empty-translation-unit %s + * RUN: %clang_cc1 -x c++ -std=c++98 -fsyntax-only -verify -pedantic-errors -Wno-empty-translation-unit %s + * RUN: %clang_cc1 -x c++ -std=c++11 -fsyntax-only -verify -Wc++98-compat-pedantic -Wno-empty-translation-unit %s + */ + +#if !defined(__cplusplus) +# if __STDC_VERSION__ < 199901L +/* expected-error@19 {{'long long' is an extension when C99 mode is not enabled}} */ +# endif +#else +# if __cplusplus < 201103L +/* expected-error@19 {{'long long' is a C++11 extension}} */ +# else +/* expected-warning@19 {{'long long' is incompatible with C++98}} */ +# endif +#endif + +#if 1 > 2LL +# error should not happen +#endif + diff --git a/clang/test/Sema/c89-2.c b/clang/test/Sema/c89-2.c deleted file mode 100644 index 14b955a6a4b..00000000000 --- a/clang/test/Sema/c89-2.c +++ /dev/null @@ -1,5 +0,0 @@ -/* RUN: %clang_cc1 %s -std=c89 -pedantic-errors -Wno-empty-translation-unit -verify - */ - -#if 1LL /* expected-error {{long long}} */ -#endif diff --git a/clang/test/Sema/c89.c b/clang/test/Sema/c89.c index 110d7e13762..a410a626eda 100644 --- a/clang/test/Sema/c89.c +++ b/clang/test/Sema/c89.c @@ -110,3 +110,9 @@ typedef CI *array_of_pointer_to_CI[5]; const array_of_pointer_to_CI mine3; void main() {} /* expected-error {{'main' must return 'int'}} */ + +long long ll1 = /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */ + -42LL; /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */ +unsigned long long ull1 = /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */ + 42ULL; /* expected-warning {{'long long' is an extension when C99 mode is not enabled}} */ + diff --git a/clang/test/SemaCXX/constant-expression.cpp b/clang/test/SemaCXX/constant-expression.cpp index ec50cb7d92f..942bf414742 100644 --- a/clang/test/SemaCXX/constant-expression.cpp +++ b/clang/test/SemaCXX/constant-expression.cpp @@ -115,7 +115,7 @@ int array2[recurse2]; // expected-warning {{variable length array}} expected-war namespace FloatConvert { typedef int a[(int)42.3]; typedef int a[(int)42.997]; - typedef int b[(long long)4e20]; // expected-warning {{variable length}} expected-error {{variable length}} expected-warning {{'long long' is an extension}} + typedef int b[(long long)4e20]; // expected-warning {{variable length}} expected-error {{variable length}} expected-warning {{'long long' is a C++11 extension}} } // PR12626 diff --git a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp index c07f64e614d..18fd1520ec4 100644 --- a/clang/test/SemaCXX/cxx98-compat-pedantic.cpp +++ b/clang/test/SemaCXX/cxx98-compat-pedantic.cpp @@ -32,3 +32,9 @@ int *ArraySizeConversion = new int[ConvertToInt()]; // expected-warning {{implic template<typename T> class ExternTemplate {}; extern template class ExternTemplate<int>; // expected-warning {{extern templates are incompatible with C++98}} + +long long ll1 = // expected-warning {{'long long' is incompatible with C++98}} + -42LL; // expected-warning {{'long long' is incompatible with C++98}} +unsigned long long ull1 = // expected-warning {{'long long' is incompatible with C++98}} + 42ULL; // expected-warning {{'long long' is incompatible with C++98}} + |

