-
Notifications
You must be signed in to change notification settings - Fork 14.2k
[OpenMP 5.2] Deprecate old syntax of linear clause #70152
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
[OpenMP 5.2] Deprecate old syntax of linear clause #70152
Conversation
@alexey-bataev, I'll add more tests as soon as we finalize the proper error message. |
@llvm/pr-subscribers-clang Author: Fazlay Rabbi (mdfazlay) ChangesThe syntax of the linear clause that specifies its argument and linear-modifier as linear-modifier(list) was deprecated since OpenMP 5.2 and the step modifier was added for specifying the linear step. Reference: OpenMP 5.2 Spec, Page 627, Line 15 Full diff: https://github.com/llvm/llvm-project/pull/70152.diff 3 Files Affected:
diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index d6652e6a610c1be..0621a61c2edb6a4 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1350,6 +1350,8 @@ def warn_omp_extra_tokens_at_eol : Warning<
InGroup<ExtraTokens>;
def err_omp_multiple_step_or_linear_modifier : Error<
"multiple %select{'step size'|'linear modifier'}0 found in linear clause">;
+def err_omp_deprecate_old_syntax : Error<
+ "old syntax '%0' on '%1' clause was deprecated, use new syntax '%2'">;
def warn_pragma_expected_colon_r_paren : Warning<
"missing ':' or ')' after %0 - ignoring">, InGroup<IgnoredPragmas>;
def err_omp_unknown_directive : Error<
diff --git a/clang/lib/Parse/ParseOpenMP.cpp b/clang/lib/Parse/ParseOpenMP.cpp
index 4f3b8a28ee47ef3..3e7d8274aeefc52 100644
--- a/clang/lib/Parse/ParseOpenMP.cpp
+++ b/clang/lib/Parse/ParseOpenMP.cpp
@@ -4573,6 +4573,10 @@ bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind,
Data.ExtraModifierLoc = ConsumeToken();
LinearT.consumeOpen();
NeedRParenForLinear = true;
+ if (getLangOpts().OpenMP >= 52)
+ Diag(Data.ExtraModifierLoc, diag::err_omp_deprecate_old_syntax)
+ << "linear-modifier(list)" << getOpenMPClauseName(Kind)
+ << "linear(list: [linear-modifier,] step(step-size))";
}
} else if (Kind == OMPC_lastprivate) {
// Try to parse modifier if any.
diff --git a/clang/test/OpenMP/for_linear_messages.cpp b/clang/test/OpenMP/for_linear_messages.cpp
index 03c5c763d7b5c1d..d8d3391c0c27150 100644
--- a/clang/test/OpenMP/for_linear_messages.cpp
+++ b/clang/test/OpenMP/for_linear_messages.cpp
@@ -215,6 +215,8 @@ int main(int argc, char **argv) {
int i;
#pragma omp for linear(i)
for (int k = 0; k < argc; ++k) ++k;
+ #pragma omp for linear(val(i)) // omp52-error {{old syntax 'linear-modifier(list)' on 'linear' clause was deprecated, use new syntax 'linear(list: [linear-modifier,] step(step-size))'}}
+ for (int k = 0; k < argc; ++k) ++k;
#ifdef OMP52
#pragma omp for linear(i : step(4))
#else
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG
5d36f0e
to
f13a552
Compare
The syntax of the linear clause that specifies its argument and linear-modifier as linear-modifier(list) was deprecated since OpenMP 5.2 and the step modifier was added for specifying the linear step. Reference: OpenMP 5.2 Spec, Page 627, Line 15
f13a552
to
afec5a9
Compare
The syntax of the linear clause that specifies its argument and linear-modifier as linear-modifier(list) was deprecated since OpenMP 5.2 and the step modifier was added for specifying the linear step. Reference: OpenMP 5.2 Spec, Page 627, Line 15
The syntax of the linear clause that specifies its argument and linear-modifier as linear-modifier(list) was deprecated since OpenMP 5.2 and the step modifier was added for specifying the linear step.
Reference: OpenMP 5.2 Spec, Page 627, Line 15