-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[OpenMP][clang] 6.0: parsing/sema for message/severity for parallel #146093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// RUN: %clang_cc1 -verify=expected -fopenmp -fopenmp-version=60 -ferror-limit 100 %s -Wuninitialized | ||
// RUN: %clang_cc1 -verify=expected -fopenmp-simd -fopenmp-version=60 -ferror-limit 100 %s -Wuninitialized | ||
|
||
void foo() {} | ||
|
||
template <class T, typename S, int N> | ||
T tmain(T argc, S **argv) { | ||
// Correct usage | ||
#pragma omp parallel message("correct message") | ||
|
||
// Missing parentheses | ||
#pragma omp parallel message // expected-error {{expected '(' after 'message'}} | ||
|
||
// Empty parentheses | ||
#pragma omp parallel message() // expected-error {{expected expression}} | ||
|
||
// Non-string literal | ||
#pragma omp parallel message(123) // expected-warning {{expected string literal in 'clause message' - ignoring}} | ||
#pragma omp parallel message(argc) // expected-warning {{expected string literal in 'clause message' - ignoring}} | ||
#pragma omp parallel message(argv[0]) // expected-warning {{expected string literal in 'clause message' - ignoring}} | ||
|
||
// Multiple arguments | ||
#pragma omp parallel message("msg1", "msg2") // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
|
||
// Unterminated string | ||
// expected-error@+1 {{expected expression}} expected-error@+1 {{expected ')'}} expected-warning@+1 {{missing terminating '"' character}} expected-note@+1 {{to match this '('}} | ||
#pragma omp parallel message("unterminated | ||
|
||
// Unterminated clause | ||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
#pragma omp parallel message("msg" | ||
|
||
// Extra tokens after clause | ||
#pragma omp parallel message("msg") extra // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} | ||
|
||
// Multiple message clauses | ||
#pragma omp parallel message("msg1") message("msg2") // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'message' clause}} | ||
|
||
// Message clause with other clauses (should be valid, but test for interaction) | ||
#pragma omp parallel message("msg") num_threads(2) | ||
|
||
// Message clause with invalid clause | ||
#pragma omp parallel message("msg") invalid_clause // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} | ||
|
||
// Message clause with missing string and other clause | ||
#pragma omp parallel message() num_threads(2) // expected-error {{expected expression}} | ||
|
||
// Message clause with macro that is not a string | ||
#define NOT_A_STRING 123 | ||
#pragma omp parallel message(NOT_A_STRING) // expected-warning {{expected string literal in 'clause message' - ignoring}} | ||
|
||
// Message clause with template parameter that is not a string | ||
#pragma omp parallel message(N) // expected-warning {{expected string literal in 'clause message' - ignoring}} | ||
|
||
// Message clause with macro that is a string | ||
#define A_STRING "macro string" | ||
#pragma omp parallel message(A_STRING) | ||
|
||
// Message clause with concatenated string literals | ||
#pragma omp parallel message("hello" " world") | ||
|
||
// Message clause with wide string literal | ||
#pragma omp parallel message(L"wide string") | ||
|
||
// Message clause with UTF-8 string literal | ||
#pragma omp parallel message(u8"utf8 string") | ||
|
||
// Message clause with raw string literal | ||
#pragma omp parallel message(R"(raw string)") | ||
|
||
foo(); | ||
|
||
return argc; | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
// Correct usage | ||
#pragma omp parallel message("main correct") | ||
|
||
// Invalid: missing string | ||
#pragma omp parallel message() // expected-error {{expression}} | ||
|
||
// Invalid: non-string | ||
#pragma omp parallel message(argc) // expected-warning {{expected string literal in 'clause message' - ignoring}} | ||
|
||
foo(); | ||
|
||
return tmain<int, char, 3>(argc, argv); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// RUN: %clang_cc1 -verify=expected -fopenmp -fopenmp-version=60 -ferror-limit 100 %s -Wuninitialized | ||
// RUN: %clang_cc1 -verify=expected -fopenmp-simd -fopenmp-version=60 -ferror-limit 100 %s -Wuninitialized | ||
|
||
void foo() {} | ||
|
||
template <class T, typename S, int N> | ||
T tmain(T argc, S **argv) { | ||
// Correct usages | ||
#pragma omp parallel severity(fatal) | ||
#pragma omp parallel severity(warning) | ||
|
||
// Missing parentheses | ||
#pragma omp parallel severity // expected-error {{expected '(' after 'severity'}} | ||
|
||
// Empty parentheses | ||
#pragma omp parallel severity() // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
|
||
// Invalid value | ||
#pragma omp parallel severity(error) // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
#pragma omp parallel severity(unknown) // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
|
||
// Multiple arguments | ||
#pragma omp parallel severity(fatal, warning) // expected-error {{expected ')'}} expected-note {{to match this '('}} | ||
|
||
// Unterminated clause | ||
// expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} | ||
#pragma omp parallel severity(fatal | ||
|
||
// Extra tokens after clause | ||
#pragma omp parallel severity(fatal) extra // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} | ||
|
||
// Multiple severity clauses | ||
#pragma omp parallel severity(fatal) severity(warning) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'severity' clause}} | ||
|
||
// Severity clause with other clauses (should be valid) | ||
#pragma omp parallel severity(warning) num_threads(2) | ||
|
||
// Severity clause with invalid clause | ||
#pragma omp parallel severity(fatal) invalid_clause // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} | ||
|
||
// Severity clause with macro that is not a valid value | ||
#define NOT_A_SEVERITY 123 | ||
#pragma omp parallel severity(NOT_A_SEVERITY) // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
|
||
// Severity clause with macro that is a valid value | ||
#define FATAL fatal | ||
#pragma omp parallel severity(FATAL) | ||
|
||
// Severity clause with template parameter that is not a valid value | ||
#pragma omp parallel severity(N) // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
|
||
foo(); | ||
|
||
return argc; | ||
} | ||
|
||
int main(int argc, char **argv) { | ||
// Correct usage | ||
#pragma omp parallel severity(fatal) | ||
|
||
// Invalid: missing value | ||
#pragma omp parallel severity() // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
|
||
// Invalid: non-keyword | ||
#pragma omp parallel severity(argc) // expected-error {{expected 'fatal' or 'warning' in OpenMP clause 'severity'}} | ||
|
||
foo(); | ||
|
||
return tmain<int, char, 3>(argc, argv); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.