diff --git a/clang/test/AST/Interp/c.c b/clang/test/AST/Interp/c.c index 3605462f78bbb..337a7cf9458a4 100644 --- a/clang/test/AST/Interp/c.c +++ b/clang/test/AST/Interp/c.c @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify -std=c11 %s -// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -pedantic -verify=pedantic-expected -std=c11 %s -// RUN: %clang_cc1 -verify=ref -std=c11 %s -// RUN: %clang_cc1 -pedantic -verify=pedantic-ref -std=c11 %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -verify=expected,all -std=c11 %s +// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -pedantic -verify=pedantic-expected,all -std=c11 %s +// RUN: %clang_cc1 -verify=ref,all -std=c11 %s +// RUN: %clang_cc1 -pedantic -verify=pedantic-ref,all -std=c11 %s typedef __INTPTR_TYPE__ intptr_t; typedef __PTRDIFF_TYPE__ ptrdiff_t; @@ -22,10 +22,7 @@ _Static_assert(!!1.0, ""); // pedantic-ref-warning {{not an integer constant exp _Static_assert(!!1, ""); int a = (1 == 1 ? 5 : 3); -_Static_assert(a == 5, ""); // ref-error {{not an integral constant expression}} \ - // pedantic-ref-error {{not an integral constant expression}} \ - // expected-error {{not an integral constant expression}} \ - // pedantic-expected-error {{not an integral constant expression}} +_Static_assert(a == 5, ""); // all-error {{not an integral constant expression}} const int b = 3; @@ -67,25 +64,17 @@ _Static_assert((&a - 100) != 0, ""); // pedantic-ref-warning {{is a GNU extensio /// extern variable of a composite type. /// FIXME: The 'cast from void*' note is missing in the new interpreter. extern struct Test50S Test50; -_Static_assert(&Test50 != (void*)0, ""); // ref-warning {{always true}} \ - // pedantic-ref-warning {{always true}} \ +_Static_assert(&Test50 != (void*)0, ""); // all-warning {{always true}} \ // pedantic-ref-warning {{is a GNU extension}} \ // pedantic-ref-note {{cast from 'void *' is not allowed}} \ - // expected-warning {{always true}} \ - // pedantic-expected-warning {{always true}} \ // pedantic-expected-warning {{is a GNU extension}} struct y {int x,y;}; -int a2[(intptr_t)&((struct y*)0)->y]; // expected-warning {{folded to constant array}} \ - // pedantic-expected-warning {{folded to constant array}} \ - // ref-warning {{folded to constant array}} \ - // pedantic-ref-warning {{folded to constant array}} +int a2[(intptr_t)&((struct y*)0)->y]; // all-warning {{folded to constant array}} const struct y *yy = (struct y*)0; -const intptr_t L = (intptr_t)(&(yy->y)); // expected-error {{not a compile-time constant}} \ - // pedantic-expected-error {{not a compile-time constant}} \ - // ref-error {{not a compile-time constant}} \ - // pedantic-ref-error {{not a compile-time constant}} +const intptr_t L = (intptr_t)(&(yy->y)); // all-error {{not a compile-time constant}} + const ptrdiff_t m = &m + 137 - &m; _Static_assert(m == 137, ""); // pedantic-ref-warning {{GNU extension}} \ // pedantic-expected-warning {{GNU extension}} @@ -93,10 +82,7 @@ _Static_assert(m == 137, ""); // pedantic-ref-warning {{GNU extension}} \ /// from test/Sema/switch.c, used to cause an assertion failure. void f (int z) { while (z) { - default: z--; // expected-error {{'default' statement not in switch}} \ - // pedantic-expected-error {{'default' statement not in switch}} \ - // ref-error {{'default' statement not in switch}} \ - // pedantic-ref-error {{'default' statement not in switch}} + default: z--; // all-error {{'default' statement not in switch}} } } @@ -104,15 +90,8 @@ int expr; int chooseexpr[__builtin_choose_expr(1, 1, expr)]; int somefunc(int i) { - return (i, 65537) * 65537; // expected-warning {{left operand of comma operator has no effect}} \ - // expected-warning {{overflow in expression; result is 131073}} \ - // pedantic-expected-warning {{left operand of comma operator has no effect}} \ - // pedantic-expected-warning {{overflow in expression; result is 131073}} \ - // ref-warning {{left operand of comma operator has no effect}} \ - // ref-warning {{overflow in expression; result is 131073}} \ - // pedantic-ref-warning {{left operand of comma operator has no effect}} \ - // pedantic-ref-warning {{overflow in expression; result is 131073}} - + return (i, 65537) * 65537; // all-warning {{left operand of comma operator has no effect}} \ + // all-warning {{overflow in expression; result is 131073}} } /// FIXME: The following test is incorrect in the new interpreter. @@ -130,7 +109,4 @@ _Static_assert(sizeof(name2) == 0, ""); // expected-error {{failed}} \ // pedantic-expected-error {{failed}} \ // pedantic-expected-note {{evaluates to}} -void *PR28739d = &(&PR28739d)[(__int128)(unsigned long)-1]; // expected-warning {{refers past the last possible element}} \ - // pedantic-expected-warning {{refers past the last possible element}} \ - // ref-warning {{refers past the last possible element}} \ - // pedantic-ref-warning {{refers past the last possible element}} +void *PR28739d = &(&PR28739d)[(__int128)(unsigned long)-1]; // all-warning {{refers past the last possible element}}