Skip to content

Commit 4aba4bf

Browse files
committed
[flang][OpenMP] Deprecation message for DESTROY with no argument
[5.2:625:17] The syntax of the DESTROY clause on the DEPOBJ construct with no argument was deprecated.
1 parent 6070aeb commit 4aba4bf

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

flang/lib/Semantics/check-omp-structure.cpp

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2648,11 +2648,21 @@ void OmpStructureChecker::Enter(const parser::OmpClause::Destroy &x) {
26482648
llvm::omp::Directive dir{GetContext().directive};
26492649
unsigned version{context_.langOptions().OpenMPVersion};
26502650
if (dir == llvm::omp::Directive::OMPD_depobj) {
2651-
if (version < 52) {
2652-
context_.Say(GetContext().clauseSource,
2653-
"The object parameter in DESTROY clause in DEPOPJ construct "
2654-
"was introduced in %s"_port_en_US,
2655-
ThisVersion(52));
2651+
unsigned argSince{52}, noargDeprecatedIn{52};
2652+
if (x.v) {
2653+
if (version < argSince) {
2654+
context_.Say(GetContext().clauseSource,
2655+
"The object parameter in DESTROY clause on DEPOPJ construct "
2656+
"is not allowed in %s, %s"_warn_en_US,
2657+
ThisVersion(version), TryVersion(argSince));
2658+
}
2659+
} else {
2660+
if (version >= noargDeprecatedIn) {
2661+
context_.Say(GetContext().clauseSource,
2662+
"The DESTROY clause without argument on DEPOBJ construct "
2663+
"is deprecated in %s"_warn_en_US,
2664+
ThisVersion(noargDeprecatedIn));
2665+
}
26562666
}
26572667
}
26582668
}

flang/test/Semantics/OpenMP/depobj-construct-v50.f90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ subroutine f02
2323
subroutine f03
2424
integer :: obj, jbo
2525
!ERROR: The DESTROY clause must refer to the same object as the DEPOBJ construct
26-
!PORTABILITY: The object parameter in DESTROY clause in DEPOPJ construct was introduced in OpenMP v5.2
26+
!WARNING: The object parameter in DESTROY clause on DEPOPJ construct is not allowed in OpenMP v5.0, try -fopenmp-version=52
2727
!$omp depobj(obj) destroy(jbo)
2828
end

flang/test/Semantics/OpenMP/depobj-construct-v52.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ subroutine f03
1313
!ERROR: The DESTROY clause must refer to the same object as the DEPOBJ construct
1414
!$omp depobj(obj) destroy(jbo)
1515
end
16+
17+
subroutine f06
18+
integer :: obj
19+
!WARNING: The DESTROY clause without argument on DEPOBJ construct is deprecated in OpenMP v5.2
20+
!$omp depobj(obj) destroy
21+
end

0 commit comments

Comments
 (0)