[flang-commits] [flang] 5f8b83e - [flang][OpenMP] Deprecation message for DESTROY with no argument (#114988)
via flang-commits
flang-commits at lists.llvm.org
Tue Nov 5 10:21:57 PST 2024
Author: Krzysztof Parzyszek
Date: 2024-11-05T12:21:53-06:00
New Revision: 5f8b83e40cfe36c376e44ef4459becb64458cdba
URL: https://github.com/llvm/llvm-project/commit/5f8b83e40cfe36c376e44ef4459becb64458cdba
DIFF: https://github.com/llvm/llvm-project/commit/5f8b83e40cfe36c376e44ef4459becb64458cdba.diff
LOG: [flang][OpenMP] Deprecation message for DESTROY with no argument (#114988)
[5.2:625:17] The syntax of the DESTROY clause on the DEPOBJ construct
with no argument was deprecated.
Added:
Modified:
flang/lib/Semantics/check-omp-structure.cpp
flang/test/Semantics/OpenMP/depobj-construct-v50.f90
flang/test/Semantics/OpenMP/depobj-construct-v52.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-omp-structure.cpp b/flang/lib/Semantics/check-omp-structure.cpp
index cdbda1a86e1cb5..014604627f2cd1 100644
--- a/flang/lib/Semantics/check-omp-structure.cpp
+++ b/flang/lib/Semantics/check-omp-structure.cpp
@@ -2687,11 +2687,19 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Destroy &x) {
llvm::omp::Directive dir{GetContext().directive};
unsigned version{context_.langOptions().OpenMPVersion};
if (dir == llvm::omp::Directive::OMPD_depobj) {
- if (version < 52) {
- context_.Say(GetContext().clauseSource,
- "The object parameter in DESTROY clause in DEPOPJ construct "
- "was introduced in %s"_port_en_US,
- ThisVersion(52));
+ unsigned argSince{52}, noargDeprecatedIn{52};
+ if (x.v) {
+ if (version < argSince) {
+ context_.Say(GetContext().clauseSource,
+ "The object parameter in DESTROY clause on DEPOPJ construct is not allowed in %s, %s"_warn_en_US,
+ ThisVersion(version), TryVersion(argSince));
+ }
+ } else {
+ if (version >= noargDeprecatedIn) {
+ context_.Say(GetContext().clauseSource,
+ "The DESTROY clause without argument on DEPOBJ construct is deprecated in %s"_warn_en_US,
+ ThisVersion(noargDeprecatedIn));
+ }
}
}
}
diff --git a/flang/test/Semantics/OpenMP/depobj-construct-v50.f90 b/flang/test/Semantics/OpenMP/depobj-construct-v50.f90
index e7fa24d521b63b..e87d86ca54bee7 100644
--- a/flang/test/Semantics/OpenMP/depobj-construct-v50.f90
+++ b/flang/test/Semantics/OpenMP/depobj-construct-v50.f90
@@ -23,6 +23,6 @@ subroutine f02
subroutine f03
integer :: obj, jbo
!ERROR: The DESTROY clause must refer to the same object as the DEPOBJ construct
-!PORTABILITY: The object parameter in DESTROY clause in DEPOPJ construct was introduced in OpenMP v5.2
+!WARNING: The object parameter in DESTROY clause on DEPOPJ construct is not allowed in OpenMP v5.0, try -fopenmp-version=52
!$omp depobj(obj) destroy(jbo)
end
diff --git a/flang/test/Semantics/OpenMP/depobj-construct-v52.f90 b/flang/test/Semantics/OpenMP/depobj-construct-v52.f90
index 3e2345e445c0ae..42a2102500ea75 100644
--- a/flang/test/Semantics/OpenMP/depobj-construct-v52.f90
+++ b/flang/test/Semantics/OpenMP/depobj-construct-v52.f90
@@ -13,3 +13,9 @@ subroutine f03
!ERROR: The DESTROY clause must refer to the same object as the DEPOBJ construct
!$omp depobj(obj) destroy(jbo)
end
+
+subroutine f06
+ integer :: obj
+!WARNING: The DESTROY clause without argument on DEPOBJ construct is deprecated in OpenMP v5.2
+ !$omp depobj(obj) destroy
+end
More information about the flang-commits
mailing list