diff --git a/test/OpenMP/for_loop_messages.cpp b/test/OpenMP/for_loop_messages.cpp index deed0ec31b8f3773e291df13a7a01cf08b0ac9c5..8cc882e13a9fa9a6cc7cca9732480da8d5c7bf7b 100644 --- a/test/OpenMP/for_loop_messages.cpp +++ b/test/OpenMP/for_loop_messages.cpp @@ -678,3 +678,17 @@ void test_loop_firstprivate_lastprivate() { for (int i = 0; i < 16; ++i) ; } + +void test_ordered() { +#pragma omp parallel +#pragma omp for ordered ordered // expected-error {{directive '#pragma omp for' cannot contain more than one 'ordered' clause}} + for (int i = 0; i < 16; ++i) + ; +} + +void test_nowait() { +#pragma omp parallel +#pragma omp for nowait nowait // expected-error {{directive '#pragma omp for' cannot contain more than one 'nowait' clause}} + for (int i = 0; i < 16; ++i) + ; +} diff --git a/test/OpenMP/parallel_for_messages.cpp b/test/OpenMP/parallel_for_messages.cpp index c9f4df46165d4b9357f2bd00625972b70157b107..e4ea0d5e2d938bdd689e2bbd3edf4d5b20793059 100644 --- a/test/OpenMP/parallel_for_messages.cpp +++ b/test/OpenMP/parallel_for_messages.cpp @@ -6,65 +6,81 @@ void foo() { #pragma omp parallel for // expected-error {{unexpected OpenMP directive '#pragma omp parallel for'}} int main(int argc, char **argv) { - #pragma omp parallel for { // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for [ // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for ] // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for ) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for } // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for - for(int i = 0; i < argc; ++i) foo(); - // expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} - #pragma omp parallel for unknown() - for(int i = 0; i < argc; ++i) foo(); - L1: - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for - for(int i = 0; i < argc; ++i) foo(); - #pragma omp parallel for - for(int i = 0; i < argc; ++i) - { +#pragma omp parallel for { // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for ( // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for[ // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for] // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for) // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for } // expected-warning {{extra tokens at the end of '#pragma omp parallel for' are ignored}} + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for + for (int i = 0; i < argc; ++i) + foo(); +// expected-warning@+1 {{extra tokens at the end of '#pragma omp parallel for' are ignored}} +#pragma omp parallel for unknown() + for (int i = 0; i < argc; ++i) + foo(); +L1: + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for + for (int i = 0; i < argc; ++i) + foo(); +#pragma omp parallel for + for (int i = 0; i < argc; ++i) { goto L1; // expected-error {{use of undeclared label 'L1'}} argc++; } for (int i = 0; i < 10; ++i) { - switch(argc) { - case (0): - #pragma omp parallel for - for(int i = 0; i < argc; ++i) - { + switch (argc) { + case (0): +#pragma omp parallel for + for (int i = 0; i < argc; ++i) { foo(); break; // expected-error {{'break' statement cannot be used in OpenMP for loop}} continue; } - default: - break; + default: + break; } } - #pragma omp parallel for default(none) +#pragma omp parallel for default(none) for (int i = 0; i < 10; ++i) - ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} + ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} goto L2; // expected-error {{use of undeclared label 'L2'}} - #pragma omp parallel for - for(int i = 0; i < argc; ++i) L2:foo(); - #pragma omp parallel for - for(int i = 0; i < argc; ++i) - { +#pragma omp parallel for + for (int i = 0; i < argc; ++i) + L2: + foo(); +#pragma omp parallel for + for (int i = 0; i < argc; ++i) { return 1; // expected-error {{cannot return from OpenMP region}} } [[]] // expected-error {{an attribute list cannot appear here}} - #pragma omp parallel for - for (int n = 0; n < 100; ++n) {} +#pragma omp parallel for + for (int n = 0; n < 100; ++n) { + } return 0; } +void test_ordered() { +#pragma omp parallel for ordered ordered // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}} + for (int i = 0; i < 16; ++i) + ; +} + diff --git a/test/OpenMP/parallel_sections_messages.cpp b/test/OpenMP/parallel_sections_messages.cpp index f6ee2fc448dd0eaf003c7d6b425f14dcbd557d3d..f5875098e82ba70f642547010b8ea7a91d266ee2 100644 --- a/test/OpenMP/parallel_sections_messages.cpp +++ b/test/OpenMP/parallel_sections_messages.cpp @@ -83,4 +83,3 @@ int main(int argc, char **argv) { return 0; } - diff --git a/test/OpenMP/sections_misc_messages.c b/test/OpenMP/sections_misc_messages.c index 977d154156f5b23cfbdcb3f0cb6b69677bd62bf2..0297513543a96242160c127f08f7d00594c56e2a 100644 --- a/test/OpenMP/sections_misc_messages.c +++ b/test/OpenMP/sections_misc_messages.c @@ -24,7 +24,6 @@ void test_no_clause() { foo(); foo(); // expected-error {{statement in 'omp sections' directive must be enclosed into a section region}} } - } void test_branch_protected_scope() { @@ -291,3 +290,10 @@ void test_firstprivate() { } } +void test_nowait() { +#pragma omp parallel +#pragma omp sections nowait nowait // expected-error {{directive '#pragma omp sections' cannot contain more than one 'nowait' clause}} + { + ; + } +} diff --git a/test/OpenMP/single_misc_messages.c b/test/OpenMP/single_misc_messages.c index 8667b50469c8bc492f31765eb8fc6e790fd0a563..7c10ca0a2887d90f44d65f278f37689ad842f432 100644 --- a/test/OpenMP/single_misc_messages.c +++ b/test/OpenMP/single_misc_messages.c @@ -149,3 +149,8 @@ void test_firstprivate() { foo(); } +void test_nowait() { +#pragma omp single nowait nowait // expected-error {{directive '#pragma omp single' cannot contain more than one 'nowait' clause}} + for (int i = 0; i < 16; ++i) + ; +}