[flang-commits] [flang] [Flang] Fix -Wopen-mp-* and -Wopen-acc-* flag spellings (PR #188434)
Michael Klemm via flang-commits
flang-commits at lists.llvm.org
Thu Mar 26 04:59:26 PDT 2026
https://github.com/mjklemm updated https://github.com/llvm/llvm-project/pull/188434
>From e9272b41905d5865bb20a0cfefe600b329d55000 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Tue, 24 Mar 2026 10:02:56 +0100
Subject: [PATCH 1/4] [flang] Fix -Wopen-mp-* and -Wopen-acc-* flag spellings
to -Wopenmp-* and -Wopenacc-*
The CamelCase-to-hyphenated conversion was incorrectly splitting "OpenMP"
and "OpenACC" into "open-mp" and "open-acc", producing wrong -W flag names
like -Wopen-mp-usage instead of -Wopenmp-usage. Fix the conversion to
treat these as compound names, keep the old spellings as deprecated
aliases, and emit a warning when deprecated spellings are used.
Co-Authored-By: Claude Opus 4.6 <noreply at anthropic.com>
---
.../include/flang/Support/Fortran-features.h | 15 ++++
flang/lib/Frontend/CompilerInvocation.cpp | 12 +++
flang/lib/Support/Fortran-features.cpp | 76 +++++++++++++++++--
flang/test/Driver/deprecated-w-spelling.f90 | 17 +++++
.../OpenACC/acc-declare-validity.f90 | 2 +-
.../Semantics/OpenMP/allocate-align01.f90 | 2 +-
flang/test/Semantics/OpenMP/allocate01.f90 | 2 +-
.../Semantics/OpenMP/clause-validity01.f90 | 4 +-
.../OpenMP/declarative-directive01.f90 | 8 +-
.../Semantics/OpenMP/declare-target01.f90 | 26 +++----
.../Semantics/OpenMP/declare-target02.f90 | 30 ++++----
.../Semantics/OpenMP/declare-target06.f90 | 2 +-
flang/test/Semantics/OpenMP/deprecation.f90 | 12 +--
flang/test/Semantics/OpenMP/nested-target.f90 | 14 ++--
flang/test/Semantics/OpenMP/requires04.f90 | 2 +-
flang/test/Semantics/OpenMP/requires05.f90 | 2 +-
flang/test/Semantics/OpenMP/simd-aligned.f90 | 4 +-
flang/test/Semantics/OpenMP/single03.f90 | 2 +-
flang/test/Semantics/OpenMP/single04.f90 | 12 +--
flang/test/Semantics/OpenMP/target01.f90 | 8 +-
.../test/Semantics/OpenMP/use_device_ptr1.f90 | 2 +-
.../unittests/Common/FortranFeaturesTest.cpp | 8 +-
22 files changed, 185 insertions(+), 77 deletions(-)
create mode 100644 flang/test/Driver/deprecated-w-spelling.f90
diff --git a/flang/include/flang/Support/Fortran-features.h b/flang/include/flang/Support/Fortran-features.h
index f2bd0d21f25b6..10a901b8cb5c2 100644
--- a/flang/include/flang/Support/Fortran-features.h
+++ b/flang/include/flang/Support/Fortran-features.h
@@ -148,6 +148,19 @@ class LanguageFeatureControl {
void AddAlternativeCliSpelling(UsageWarning w, std::string input) {
cliOptions_.insert({input, {w}});
}
+ void AddDeprecatedCliSpelling(
+ LanguageFeature f, std::string deprecated, std::string canonical) {
+ cliOptions_.insert({deprecated, {f}});
+ deprecatedCliOptions_.insert({std::move(deprecated), std::move(canonical)});
+ }
+ void AddDeprecatedCliSpelling(
+ UsageWarning w, std::string deprecated, std::string canonical) {
+ cliOptions_.insert({deprecated, {w}});
+ deprecatedCliOptions_.insert({std::move(deprecated), std::move(canonical)});
+ }
+ // Returns the canonical spelling if the input is a deprecated spelling.
+ std::optional<std::string_view> GetCanonicalSpelling(
+ std::string_view input) const;
void ReplaceCliCanonicalSpelling(LanguageFeature f, std::string input);
void ReplaceCliCanonicalSpelling(UsageWarning w, std::string input);
std::string_view getDefaultCliSpelling(LanguageFeature f) const {
@@ -164,6 +177,8 @@ class LanguageFeatureControl {
// Map from Cli syntax of language features and usage warnings to their enum
// values.
std::unordered_map<std::string, LanguageFeatureOrWarning> cliOptions_;
+ // Map from deprecated Cli spellings to their canonical replacements.
+ std::unordered_map<std::string, std::string> deprecatedCliOptions_;
// These two arrays map the enum values to their cannonical Cli spellings.
// Since each of the CanonicalSpelling is a string in the domain of the map
// above we just use a view of the string instead of another copy.
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 36791201825ce..5462289b30f77 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1048,6 +1048,18 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
const unsigned diagID = diags.getCustomDiagID(
clang::DiagnosticsEngine::Error, "Unknown diagnostic option: -W%0");
diags.Report(diagID) << wArg;
+ } else {
+ if (auto canonical{features.GetCanonicalSpelling(wArg)}) {
+ std::string suggestion{*canonical};
+ if (wArg.size() > 3 &&
+ wArg.substr(0, 3) == "no-") {
+ suggestion = "no-" + suggestion;
+ }
+ const unsigned diagID = diags.getCustomDiagID(
+ clang::DiagnosticsEngine::Warning,
+ "-W%0 is deprecated; use -W%1 instead");
+ diags.Report(diagID) << wArg << suggestion;
+ }
}
}
}
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 4201f0b9b1e49..18616fdb2fb35 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -11,6 +11,7 @@
#include "flang/Parser/characters.h"
#include "flang/Support/Fortran.h"
#include <string>
+#include <cstring>
#include <string_view>
namespace Fortran::common {
@@ -35,6 +36,26 @@ static std::vector<std::string_view> SplitCamelCase(std::string_view x) {
return result;
}
+// Compound names whose hyphenated CamelCase splitting is wrong.
+// Each entry maps the incorrect (deprecated) hyphenated form produced by
+// SplitCamelCase to the correct (canonical) form.
+static constexpr std::pair<std::string_view, std::string_view>
+ compoundNameFixups[]{{"open-mp", "openmp"}, {"open-acc", "openacc"}};
+
+// Replace all occurrences of 'from' with 'to' in 's', but only when the
+// match is at a word boundary (end of string or followed by '-') to avoid
+// e.g. "open-access" -> "openaccess".
+static void ReplaceAtWordBoundary(
+ std::string &s, std::string_view from, std::string_view to) {
+ for (size_t pos = s.find(from); pos != std::string::npos;
+ pos = s.find(from, pos + to.size())) {
+ size_t end = pos + from.size();
+ if (end == s.size() || s[end] == '-') {
+ s.replace(pos, from.size(), to);
+ }
+ }
+}
+
// Namespace for helper functions for parsing Cli options used instead of static
// so that there can be unit tests for this function.
namespace details {
@@ -47,6 +68,10 @@ std::string CamelCaseToLowerCaseHyphenated(std::string_view x) {
result += i == 0 ? "" : "-";
result += word;
}
+ // Fix known compound names that should not be hyphen-separated.
+ for (auto [deprecated, canonical] : compoundNameFixups) {
+ ReplaceAtWordBoundary(result, deprecated, canonical);
+ }
return result;
}
} // namespace details
@@ -70,12 +95,38 @@ LanguageFeatureControl::LanguageFeatureControl() {
std::move(cliOption);
});
- // Fix CLI spellings where the auto-generated hyphenation is wrong.
- // TODO: -Wopen-mp-* should be fixed in a central place. See
- // see Discourse at
- // https://discourse.llvm.org/t/openmp-misspelling-of-wopen-mp/90196.
- ReplaceCliCanonicalSpelling(LanguageFeature::OpenMPThreadprivateEquivalence,
- "openmp-threadprivate-equivalence");
+ // Register deprecated "open-mp-*" and "open-acc-*" spellings as aliases.
+ // The canonical spellings are now "openmp-*" and "openacc-*".
+ auto makeDeprecatedSpelling = [](std::string_view canonical) {
+ std::string deprecated{canonical};
+ bool replaced{false};
+ for (auto [deprecatedForm, canonicalForm] : compoundNameFixups) {
+ // Reverse direction: canonical -> deprecated.
+ for (auto pos{deprecated.find(canonicalForm)};
+ pos != std::string::npos;
+ pos = deprecated.find(canonicalForm, pos + deprecatedForm.size())) {
+ deprecated.replace(pos, canonicalForm.size(), deprecatedForm);
+ replaced = true;
+ }
+ }
+ return std::pair{deprecated, replaced};
+ };
+ ForEachLanguageFeature([&](auto feature) {
+ std::string_view canonical{
+ languageFeatureCliCanonicalSpelling_[EnumToInt(feature)]};
+ auto [deprecated, replaced]{makeDeprecatedSpelling(canonical)};
+ if (replaced) {
+ AddDeprecatedCliSpelling(feature, deprecated, std::string{canonical});
+ }
+ });
+ ForEachUsageWarning([&](auto warning) {
+ std::string_view canonical{
+ usageWarningCliCanonicalSpelling_[EnumToInt(warning)]};
+ auto [deprecated, replaced]{makeDeprecatedSpelling(canonical)};
+ if (replaced) {
+ AddDeprecatedCliSpelling(warning, deprecated, std::string{canonical});
+ }
+ });
// These features must be explicitly enabled by command line options.
disable_.set(LanguageFeature::OldDebugLines);
@@ -178,6 +229,19 @@ std::optional<LanguageControlFlag> LanguageFeatureControl::FindWarning(
return std::nullopt;
}
+std::optional<std::string_view> LanguageFeatureControl::GetCanonicalSpelling(
+ std::string_view input) const {
+ // Strip "no-" prefix for lookup, same as FindWarning does.
+ if (input.size() > 3 && input.substr(0, 3) == "no-") {
+ input = input.substr(3);
+ }
+ if (auto it{deprecatedCliOptions_.find(std::string{input})};
+ it != deprecatedCliOptions_.end()) {
+ return it->second;
+ }
+ return std::nullopt;
+}
+
bool LanguageFeatureControl::EnableWarning(std::string_view input) {
if (auto warningAndEnabled{FindWarning(input)}) {
EnableWarning(warningAndEnabled->first, warningAndEnabled->second);
diff --git a/flang/test/Driver/deprecated-w-spelling.f90 b/flang/test/Driver/deprecated-w-spelling.f90
new file mode 100644
index 0000000000000..673cf98b0d236
--- /dev/null
+++ b/flang/test/Driver/deprecated-w-spelling.f90
@@ -0,0 +1,17 @@
+! Test that the deprecated -Wopen-mp-* and -Wopen-acc-* spellings produce
+! deprecation warnings and suggest the canonical -Wopenmp-* / -Wopenacc-*
+! spellings.
+
+! RUN: %flang_fc1 -fsyntax-only -Wopen-mp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=DEPRECATED %s
+! RUN: %flang_fc1 -fsyntax-only -Wno-open-mp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=DEPRECATED-NO %s
+! RUN: %flang_fc1 -fsyntax-only -Wopen-acc-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=DEPRECATED-ACC %s
+! RUN: %flang_fc1 -fsyntax-only -Wopenmp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
+! RUN: %flang_fc1 -fsyntax-only -Wopenacc-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
+
+! DEPRECATED: warning: -Wopen-mp-usage is deprecated; use -Wopenmp-usage instead
+! DEPRECATED-NO: warning: -Wno-open-mp-usage is deprecated; use -Wno-openmp-usage instead
+! DEPRECATED-ACC: warning: -Wopen-acc-usage is deprecated; use -Wopenacc-usage instead
+! CANONICAL-NOT: deprecated
+
+program test
+end program test
diff --git a/flang/test/Semantics/OpenACC/acc-declare-validity.f90 b/flang/test/Semantics/OpenACC/acc-declare-validity.f90
index 5ee61fac0660a..3e40c964b002e 100644
--- a/flang/test/Semantics/OpenACC/acc-declare-validity.f90
+++ b/flang/test/Semantics/OpenACC/acc-declare-validity.f90
@@ -14,7 +14,7 @@ module openacc_declare_validity
!$acc declare create(aa, bb)
- !WARNING: 'aa' in the CREATE clause is already present in the same clause in this module [-Wopen-acc-usage]
+ !WARNING: 'aa' in the CREATE clause is already present in the same clause in this module [-Wopenacc-usage]
!$acc declare create(aa)
!$acc declare link(ab)
diff --git a/flang/test/Semantics/OpenMP/allocate-align01.f90 b/flang/test/Semantics/OpenMP/allocate-align01.f90
index 4a1e60cf73fff..337353463fa25 100644
--- a/flang/test/Semantics/OpenMP/allocate-align01.f90
+++ b/flang/test/Semantics/OpenMP/allocate-align01.f90
@@ -11,7 +11,7 @@ program allocate_align_tree
integer :: z, t, xx
t = 2
z = 3
- !WARNING: The executable form of the OpenMP ALLOCATE directive has been deprecated, please use ALLOCATORS instead [-Wopen-mp-usage]
+ !WARNING: The executable form of the OpenMP ALLOCATE directive has been deprecated, please use ALLOCATORS instead [-Wopenmp-usage]
!ERROR: Must be a constant value
!$omp allocate(j) align(xx)
!ERROR: The alignment should be positive
diff --git a/flang/test/Semantics/OpenMP/allocate01.f90 b/flang/test/Semantics/OpenMP/allocate01.f90
index 5fe4efdd106d9..f445ea3a030a4 100644
--- a/flang/test/Semantics/OpenMP/allocate01.f90
+++ b/flang/test/Semantics/OpenMP/allocate01.f90
@@ -19,7 +19,7 @@ subroutine sema()
!$omp allocate(y)
print *, a
- !WARNING: The executable form of the OpenMP ALLOCATE directive has been deprecated, please use ALLOCATORS instead [-Wopen-mp-usage]
+ !WARNING: The executable form of the OpenMP ALLOCATE directive has been deprecated, please use ALLOCATORS instead [-Wopenmp-usage]
!$omp allocate(x) allocator(omp_default_mem_alloc)
allocate ( x(a), darray(a, b) )
end subroutine sema
diff --git a/flang/test/Semantics/OpenMP/clause-validity01.f90 b/flang/test/Semantics/OpenMP/clause-validity01.f90
index 9371a2fc6fd58..fba9f4ac75fa1 100644
--- a/flang/test/Semantics/OpenMP/clause-validity01.f90
+++ b/flang/test/Semantics/OpenMP/clause-validity01.f90
@@ -483,14 +483,14 @@
! 2.13.1 master
!$omp parallel
- !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopen-mp-usage]
+ !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopenmp-usage]
!$omp master
a=3.14
!$omp end master
!$omp end parallel
!$omp parallel
- !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopen-mp-usage]
+ !WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopenmp-usage]
!ERROR: NUM_THREADS clause is not allowed on the MASTER directive
!$omp master num_threads(4)
a=3.14
diff --git a/flang/test/Semantics/OpenMP/declarative-directive01.f90 b/flang/test/Semantics/OpenMP/declarative-directive01.f90
index 9e6e6021ffab2..c213d0ae7a6f2 100644
--- a/flang/test/Semantics/OpenMP/declarative-directive01.f90
+++ b/flang/test/Semantics/OpenMP/declarative-directive01.f90
@@ -56,10 +56,10 @@ module m2
contains
subroutine foo
!$omp declare target
- !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopen-mp-usage]
- !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopen-mp-usage]
+ !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopenmp-usage]
+ !WARNING: The entity with PARAMETER attribute is used in a DECLARE TARGET directive [-Wopenmp-usage]
!$omp declare target (foo, N, M)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
@@ -68,7 +68,7 @@ subroutine foo
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter(Q, S) link(R)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!ERROR: MAP clause is not allowed on the DECLARE TARGET directive
!$omp declare target to(Q) map(from:Q)
diff --git a/flang/test/Semantics/OpenMP/declare-target01.f90 b/flang/test/Semantics/OpenMP/declare-target01.f90
index 9e9510d57c098..9bbd66ad5ec43 100644
--- a/flang/test/Semantics/OpenMP/declare-target01.f90
+++ b/flang/test/Semantics/OpenMP/declare-target01.f90
@@ -51,84 +51,84 @@ module declare_target01
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target (y%KIND)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (my_var)
!$omp declare target enter (my_var)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (my_var) device_type(host)
!$omp declare target enter (my_var) device_type(host)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (my_var%t_i)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%t_i)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (my_var%t_arr)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%t_arr)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (my_var%kind_param)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%kind_param)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (my_var%len_param)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (my_var%len_param)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr)
!$omp declare target enter (arr)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr) device_type(nohost)
!$omp declare target enter (arr) device_type(nohost)
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr(1))
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (arr(1))
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr(1:2))
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
!$omp declare target enter (arr(1:2))
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (x%KIND)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (x%KIND)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (w%LEN)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
!$omp declare target enter (w%LEN)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (y%KIND)
!ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
diff --git a/flang/test/Semantics/OpenMP/declare-target02.f90 b/flang/test/Semantics/OpenMP/declare-target02.f90
index 8240d5d9eccc1..1dddb62231d82 100644
--- a/flang/test/Semantics/OpenMP/declare-target02.f90
+++ b/flang/test/Semantics/OpenMP/declare-target02.f90
@@ -16,17 +16,17 @@ program declare_target02
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a1)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr1_to)
!$omp declare target enter (arr1_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (blk1_to)
!$omp declare target enter (blk1_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a1_to)
@@ -44,7 +44,7 @@ program declare_target02
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target (eq_a)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target to (eq_a)
@@ -57,7 +57,7 @@ program declare_target02
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target (eq_c)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement
!$omp declare target to (eq_c)
@@ -87,26 +87,26 @@ subroutine func()
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a3)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target to (arr2_to)
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter (arr2_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr3_to)
!$omp declare target enter (arr3_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a2_to)
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target enter (a2_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a3_to)
@@ -137,16 +137,16 @@ module mod4
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a4)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (arr4_to)
!$omp declare target enter (arr4_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to (blk4_to)
!$omp declare target enter (blk4_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a4_to)
@@ -174,21 +174,21 @@ subroutine func5()
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target (a5)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target to (arr5_to)
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter (arr5_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target to (blk5_to)
!ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly
!$omp declare target enter (blk5_to)
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block
!$omp declare target to (a5_to)
diff --git a/flang/test/Semantics/OpenMP/declare-target06.f90 b/flang/test/Semantics/OpenMP/declare-target06.f90
index 08fe531af6953..5ad2377d3fcfd 100644
--- a/flang/test/Semantics/OpenMP/declare-target06.f90
+++ b/flang/test/Semantics/OpenMP/declare-target06.f90
@@ -12,7 +12,7 @@ module test_0
!ERROR: No explicit type declared for 'no_implicit_materialization_2'
!$omp declare target link(no_implicit_materialization_2)
-!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+!WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!ERROR: No explicit type declared for 'no_implicit_materialization_3'
!$omp declare target to(no_implicit_materialization_3)
diff --git a/flang/test/Semantics/OpenMP/deprecation.f90 b/flang/test/Semantics/OpenMP/deprecation.f90
index 4acccb1bf4b7f..35e08423f8894 100644
--- a/flang/test/Semantics/OpenMP/deprecation.f90
+++ b/flang/test/Semantics/OpenMP/deprecation.f90
@@ -4,7 +4,7 @@
subroutine test_master()
integer :: c = 1
-!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopen-mp-usage]
+!WARNING: OpenMP directive MASTER has been deprecated, please use MASKED instead. [-Wopenmp-usage]
!$omp master
c = c + 1
!$omp end master
@@ -12,7 +12,7 @@ subroutine test_master()
subroutine test_parallel_master
integer :: c = 2
-!WARNING: OpenMP directive PARALLEL MASTER has been deprecated, please use PARALLEL MASKED instead. [-Wopen-mp-usage]
+!WARNING: OpenMP directive PARALLEL MASTER has been deprecated, please use PARALLEL MASKED instead. [-Wopenmp-usage]
!$omp parallel master
c = c + 2
!$omp end parallel master
@@ -20,7 +20,7 @@ subroutine test_parallel_master
subroutine test_master_taskloop_simd()
integer :: i, j = 1
-!WARNING: OpenMP directive MASTER TASKLOOP SIMD has been deprecated, please use MASKED TASKLOOP SIMD instead. [-Wopen-mp-usage]
+!WARNING: OpenMP directive MASTER TASKLOOP SIMD has been deprecated, please use MASKED TASKLOOP SIMD instead. [-Wopenmp-usage]
!$omp master taskloop simd
do i=1,10
j = j + 1
@@ -30,7 +30,7 @@ subroutine test_master_taskloop_simd()
subroutine test_master_taskloop
integer :: i, j = 1
-!WARNING: OpenMP directive MASTER TASKLOOP has been deprecated, please use MASKED TASKLOOP instead. [-Wopen-mp-usage]
+!WARNING: OpenMP directive MASTER TASKLOOP has been deprecated, please use MASKED TASKLOOP instead. [-Wopenmp-usage]
!$omp master taskloop
do i=1,10
j = j + 1
@@ -40,7 +40,7 @@ subroutine test_master_taskloop
subroutine test_parallel_master_taskloop_simd
integer :: i, j = 1
-!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP SIMD has been deprecated, please use PARALLEL_MASKED TASKLOOP SIMD instead. [-Wopen-mp-usage]
+!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP SIMD has been deprecated, please use PARALLEL_MASKED TASKLOOP SIMD instead. [-Wopenmp-usage]
!$omp parallel master taskloop simd
do i=1,10
j = j + 1
@@ -50,7 +50,7 @@ subroutine test_parallel_master_taskloop_simd
subroutine test_parallel_master_taskloop
integer :: i, j = 1
-!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP has been deprecated, please use PARALLEL MASKED TASKLOOP instead. [-Wopen-mp-usage]
+!WARNING: OpenMP directive PARALLEL MASTER TASKLOOP has been deprecated, please use PARALLEL MASKED TASKLOOP instead. [-Wopenmp-usage]
!$omp parallel master taskloop
do i=1,10
j = j + 1
diff --git a/flang/test/Semantics/OpenMP/nested-target.f90 b/flang/test/Semantics/OpenMP/nested-target.f90
index a82b6c01b1968..59d891b420ee4 100644
--- a/flang/test/Semantics/OpenMP/nested-target.f90
+++ b/flang/test/Semantics/OpenMP/nested-target.f90
@@ -10,7 +10,7 @@ program main
real, allocatable :: B(:)
!$omp target
- !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!$omp target update from(arrayA) to(arrayB)
do i = 1, 512
arrayA(i) = arrayB(i)
@@ -20,7 +20,7 @@ program main
!$omp parallel
!$omp target
!$omp parallel
- !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET UPDATE directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!$omp target update from(arrayA) to(arrayB)
do i = 1, 512
arrayA(i) = arrayB(i)
@@ -30,7 +30,7 @@ program main
!$omp end parallel
!$omp target
- !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!$omp target data map(to: a)
do i = 1, N
a = 3.14
@@ -40,12 +40,12 @@ program main
allocate(B(N))
!$omp target
- !PORTABILITY: If TARGET ENTER DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET ENTER DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!$omp target enter data map(alloc:B)
!$omp end target
!$omp target
- !PORTABILITY: If TARGET EXIT DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET EXIT DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!$omp target exit data map(delete:B)
!$omp end target
deallocate(B)
@@ -53,7 +53,7 @@ program main
n1 = 10
n2 = 10
!$omp target teams map(to:a)
- !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET DATA directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp target data map(n1,n2)
do i=1, n1
@@ -65,7 +65,7 @@ program main
!$omp end target teams
!$omp target teams map(to:a) map(from:n1,n2)
- !PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified [-Wopen-mp-usage]
+ !PORTABILITY: If TARGET TEAMS DISTRIBUTE PARALLEL DO directive is nested inside TARGET region, the behaviour is unspecified [-Wopenmp-usage]
!ERROR: Only `DISTRIBUTE`, `PARALLEL`, or `LOOP` regions are allowed to be strictly nested inside `TEAMS` region.
!$omp target teams distribute parallel do
do i=1, n1
diff --git a/flang/test/Semantics/OpenMP/requires04.f90 b/flang/test/Semantics/OpenMP/requires04.f90
index 6eb0fb7f046a2..a1647bc5db7a7 100644
--- a/flang/test/Semantics/OpenMP/requires04.f90
+++ b/flang/test/Semantics/OpenMP/requires04.f90
@@ -6,7 +6,7 @@
subroutine f
integer, save :: x
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to(x) device_type(nohost)
!$omp declare target enter(x) device_type(nohost)
end subroutine f
diff --git a/flang/test/Semantics/OpenMP/requires05.f90 b/flang/test/Semantics/OpenMP/requires05.f90
index 0e2352ead0597..ce9138ae94f7f 100644
--- a/flang/test/Semantics/OpenMP/requires05.f90
+++ b/flang/test/Semantics/OpenMP/requires05.f90
@@ -5,7 +5,7 @@
! device constructs, such as declare target with 'to' clause and no device_type.
subroutine f
- !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]
+ !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopenmp-usage]
!$omp declare target to(f)
!$omp declare target enter(f)
end subroutine f
diff --git a/flang/test/Semantics/OpenMP/simd-aligned.f90 b/flang/test/Semantics/OpenMP/simd-aligned.f90
index 4c410a7c4631b..a1c5da1f5bc5c 100644
--- a/flang/test/Semantics/OpenMP/simd-aligned.f90
+++ b/flang/test/Semantics/OpenMP/simd-aligned.f90
@@ -60,13 +60,13 @@ program omp_simd
!$omp end simd
!ERROR: 'd' in ALIGNED clause must be of type C_PTR, POINTER or ALLOCATABLE
- !WARNING: Alignment is not a power of 2, Aligned clause will be ignored [-Wopen-mp-usage]
+ !WARNING: Alignment is not a power of 2, Aligned clause will be ignored [-Wopenmp-usage]
!$omp simd aligned(d:100)
do i = 1, 100
d(i) = i
end do
- !WARNING: Alignment is not a power of 2, Aligned clause will be ignored [-Wopen-mp-usage]
+ !WARNING: Alignment is not a power of 2, Aligned clause will be ignored [-Wopenmp-usage]
!$omp simd aligned(b:65)
do i = 1, 100
b(i) = i
diff --git a/flang/test/Semantics/OpenMP/single03.f90 b/flang/test/Semantics/OpenMP/single03.f90
index 789fcfdd88080..e64155c845c86 100644
--- a/flang/test/Semantics/OpenMP/single03.f90
+++ b/flang/test/Semantics/OpenMP/single03.f90
@@ -39,7 +39,7 @@ subroutine omp_single
!$omp single private(j) copyprivate(j)
print *, "omp single", j
!ERROR: COPYPRIVATE variable 'j' may not appear on a PRIVATE or FIRSTPRIVATE clause on a SINGLE construct
- !WARNING: The COPYPRIVATE clause with 'j' is already used on the SINGLE directive [-Wopen-mp-usage]
+ !WARNING: The COPYPRIVATE clause with 'j' is already used on the SINGLE directive [-Wopenmp-usage]
!$omp end single copyprivate(j)
!$omp single nowait
diff --git a/flang/test/Semantics/OpenMP/single04.f90 b/flang/test/Semantics/OpenMP/single04.f90
index eabfe54b8ee3f..7daa74ab62218 100644
--- a/flang/test/Semantics/OpenMP/single04.f90
+++ b/flang/test/Semantics/OpenMP/single04.f90
@@ -52,20 +52,20 @@ program single
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp single copyprivate(x) nowait
print *, x
- !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
+ !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopenmp-usage]
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
!$omp end single copyprivate(x) nowait
!$omp single copyprivate(x)
print *, x
- !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
+ !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopenmp-usage]
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp end single copyprivate(x) nowait
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp single copyprivate(x, y) nowait
print *, x
- !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
+ !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopenmp-usage]
!ERROR: 'z' appears in more than one COPYPRIVATE clause on the END SINGLE directive
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
!$omp end single copyprivate(x, z) copyprivate(z) nowait
@@ -73,9 +73,9 @@ program single
!ERROR: NOWAIT clause must not be used with COPYPRIVATE clause on the SINGLE directive
!$omp single copyprivate(x) nowait copyprivate(y) copyprivate(z)
print *, x
- !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopen-mp-usage]
- !WARNING: The COPYPRIVATE clause with 'y' is already used on the SINGLE directive [-Wopen-mp-usage]
- !WARNING: The COPYPRIVATE clause with 'z' is already used on the SINGLE directive [-Wopen-mp-usage]
+ !WARNING: The COPYPRIVATE clause with 'x' is already used on the SINGLE directive [-Wopenmp-usage]
+ !WARNING: The COPYPRIVATE clause with 'y' is already used on the SINGLE directive [-Wopenmp-usage]
+ !WARNING: The COPYPRIVATE clause with 'z' is already used on the SINGLE directive [-Wopenmp-usage]
!ERROR: At most one NOWAIT clause can appear on the SINGLE directive
!$omp end single copyprivate(x, y, z) nowait
end program
diff --git a/flang/test/Semantics/OpenMP/target01.f90 b/flang/test/Semantics/OpenMP/target01.f90
index f6e7c6a67d41f..2823859bc47d9 100644
--- a/flang/test/Semantics/OpenMP/target01.f90
+++ b/flang/test/Semantics/OpenMP/target01.f90
@@ -39,19 +39,19 @@ subroutine bar(b1, b2, b3)
type(c_ptr), pointer :: b2
type(c_ptr), value :: b3
- !WARNING: Variable 'c' in IS_DEVICE_PTR clause must be a dummy argument. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
+ !WARNING: Variable 'c' in IS_DEVICE_PTR clause must be a dummy argument. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopenmp-usage]
!$omp target is_device_ptr(c)
y = y + 1
!$omp end target
- !WARNING: Variable 'b1' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
+ !WARNING: Variable 'b1' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopenmp-usage]
!$omp target is_device_ptr(b1)
y = y + 1
!$omp end target
- !WARNING: Variable 'b2' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
+ !WARNING: Variable 'b2' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopenmp-usage]
!$omp target is_device_ptr(b2)
y = y + 1
!$omp end target
- !WARNING: Variable 'b3' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopen-mp-usage]
+ !WARNING: Variable 'b3' in IS_DEVICE_PTR clause must be a dummy argument that does not have the ALLOCATABLE, POINTER or VALUE attribute. This semantic check is deprecated from OpenMP 5.2 and later. [-Wopenmp-usage]
!$omp target is_device_ptr(b3)
y = y + 1
!$omp end target
diff --git a/flang/test/Semantics/OpenMP/use_device_ptr1.f90 b/flang/test/Semantics/OpenMP/use_device_ptr1.f90
index ed0a1d238c96d..2d95b6bf8607d 100644
--- a/flang/test/Semantics/OpenMP/use_device_ptr1.f90
+++ b/flang/test/Semantics/OpenMP/use_device_ptr1.f90
@@ -27,7 +27,7 @@ subroutine omp_target_data
a = arrayB
!$omp end target data
- !WARNING: Use of non-C_PTR type 'a' in USE_DEVICE_PTR is deprecated, use USE_DEVICE_ADDR instead [-Wopen-mp-usage]
+ !WARNING: Use of non-C_PTR type 'a' in USE_DEVICE_PTR is deprecated, use USE_DEVICE_ADDR instead [-Wopenmp-usage]
!$omp target data map(tofrom: a) use_device_ptr(a)
a = 2
!$omp end target data
diff --git a/flang/unittests/Common/FortranFeaturesTest.cpp b/flang/unittests/Common/FortranFeaturesTest.cpp
index 2caacb5f3dacf..dfd88cb8abecd 100644
--- a/flang/unittests/Common/FortranFeaturesTest.cpp
+++ b/flang/unittests/Common/FortranFeaturesTest.cpp
@@ -135,10 +135,10 @@ TEST(FortranFeaturesTest, CamelCaseToLowerCaseHyphenated) {
"pause");
EXPECT_EQ(
CamelCaseToLowerCaseHyphenated(EnumToString(LanguageFeature::OpenACC)),
- "open-acc");
+ "openacc");
EXPECT_EQ(
CamelCaseToLowerCaseHyphenated(EnumToString(LanguageFeature::OpenMP)),
- "open-mp");
+ "openmp");
EXPECT_EQ(CamelCaseToLowerCaseHyphenated(EnumToString(LanguageFeature::CUDA)),
"cuda");
EXPECT_EQ(CamelCaseToLowerCaseHyphenated(
@@ -451,7 +451,7 @@ TEST(FortranFeaturesTest, CamelCaseToLowerCaseHyphenated) {
"scanning");
EXPECT_EQ(
CamelCaseToLowerCaseHyphenated(EnumToString(UsageWarning::OpenAccUsage)),
- "open-acc-usage");
+ "openacc-usage");
EXPECT_EQ(CamelCaseToLowerCaseHyphenated(
EnumToString(UsageWarning::ProcPointerCompatibility)),
"proc-pointer-compatibility");
@@ -489,7 +489,7 @@ TEST(FortranFeaturesTest, CamelCaseToLowerCaseHyphenated) {
"unused-forall-index");
EXPECT_EQ(
CamelCaseToLowerCaseHyphenated(EnumToString(UsageWarning::OpenMPUsage)),
- "open-mp-usage");
+ "openmp-usage");
EXPECT_EQ(
CamelCaseToLowerCaseHyphenated(EnumToString(UsageWarning::DataLength)),
"data-length");
>From 816b4297532130cf52c33ebacf8b7dc8e9bb9a95 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Wed, 25 Mar 2026 10:50:06 +0100
Subject: [PATCH 2/4] Format code and cleanup
---
flang/lib/Frontend/CompilerInvocation.cpp | 9 ++++-----
flang/lib/Support/Fortran-features.cpp | 4 +---
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 5462289b30f77..f0bc61bf0d2c2 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1051,13 +1051,12 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
} else {
if (auto canonical{features.GetCanonicalSpelling(wArg)}) {
std::string suggestion{*canonical};
- if (wArg.size() > 3 &&
- wArg.substr(0, 3) == "no-") {
+ if (wArg.size() > 3 && wArg.substr(0, 3) == "no-") {
suggestion = "no-" + suggestion;
}
- const unsigned diagID = diags.getCustomDiagID(
- clang::DiagnosticsEngine::Warning,
- "-W%0 is deprecated; use -W%1 instead");
+ const unsigned diagID =
+ diags.getCustomDiagID(clang::DiagnosticsEngine::Warning,
+ "-W%0 is deprecated; use -W%1 instead");
diags.Report(diagID) << wArg << suggestion;
}
}
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 18616fdb2fb35..6ccf16e2f169b 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -11,7 +11,6 @@
#include "flang/Parser/characters.h"
#include "flang/Support/Fortran.h"
#include <string>
-#include <cstring>
#include <string_view>
namespace Fortran::common {
@@ -102,8 +101,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
bool replaced{false};
for (auto [deprecatedForm, canonicalForm] : compoundNameFixups) {
// Reverse direction: canonical -> deprecated.
- for (auto pos{deprecated.find(canonicalForm)};
- pos != std::string::npos;
+ for (auto pos{deprecated.find(canonicalForm)}; pos != std::string::npos;
pos = deprecated.find(canonicalForm, pos + deprecatedForm.size())) {
deprecated.replace(pos, canonicalForm.size(), deprecatedForm);
replaced = true;
>From bf6d36623a4d17b3dd26a5fdc4043b1365cb1774 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 26 Mar 2026 10:36:39 +0100
Subject: [PATCH 3/4] Fix up test
---
flang/test/Driver/deprecated-w-spelling.f90 | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/flang/test/Driver/deprecated-w-spelling.f90 b/flang/test/Driver/deprecated-w-spelling.f90
index 673cf98b0d236..8337d6864b70a 100644
--- a/flang/test/Driver/deprecated-w-spelling.f90
+++ b/flang/test/Driver/deprecated-w-spelling.f90
@@ -2,9 +2,9 @@
! deprecation warnings and suggest the canonical -Wopenmp-* / -Wopenacc-*
! spellings.
-! RUN: %flang_fc1 -fsyntax-only -Wopen-mp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=DEPRECATED %s
-! RUN: %flang_fc1 -fsyntax-only -Wno-open-mp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=DEPRECATED-NO %s
-! RUN: %flang_fc1 -fsyntax-only -Wopen-acc-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=DEPRECATED-ACC %s
+! RUN: %flang_fc1 -fsyntax-only -Wopen-mp-usage %s 2>&1 | FileCheck --check-prefix=DEPRECATED %s
+! RUN: %flang_fc1 -fsyntax-only -Wno-open-mp-usage %s 2>&1 | FileCheck --check-prefix=DEPRECATED-NO %s
+! RUN: %flang_fc1 -fsyntax-only -Wopen-acc-usage %s 2>&1 | FileCheck --check-prefix=DEPRECATED-ACC %s
! RUN: %flang_fc1 -fsyntax-only -Wopenmp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
! RUN: %flang_fc1 -fsyntax-only -Wopenacc-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
>From 9bd6ba8707b51e404aff1d20e65e1978897c4615 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 26 Mar 2026 10:51:39 +0100
Subject: [PATCH 4/4] Extend test to also cover flang driver
---
flang/test/Driver/deprecated-w-spelling.f90 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/flang/test/Driver/deprecated-w-spelling.f90 b/flang/test/Driver/deprecated-w-spelling.f90
index 8337d6864b70a..da11c33e4ce51 100644
--- a/flang/test/Driver/deprecated-w-spelling.f90
+++ b/flang/test/Driver/deprecated-w-spelling.f90
@@ -8,6 +8,12 @@
! RUN: %flang_fc1 -fsyntax-only -Wopenmp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
! RUN: %flang_fc1 -fsyntax-only -Wopenacc-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
+! RUN: %flang -fsyntax-only -Wopen-mp-usage %s 2>&1 | FileCheck --check-prefix=DEPRECATED %s
+! RUN: %flang -fsyntax-only -Wno-open-mp-usage %s 2>&1 | FileCheck --check-prefix=DEPRECATED-NO %s
+! RUN: %flang -fsyntax-only -Wopen-acc-usage %s 2>&1 | FileCheck --check-prefix=DEPRECATED-ACC %s
+! RUN: %flang -fsyntax-only -Wopenmp-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
+! RUN: %flang -fsyntax-only -Wopenacc-usage %s 2>&1 | FileCheck --allow-empty --check-prefix=CANONICAL %s
+
! DEPRECATED: warning: -Wopen-mp-usage is deprecated; use -Wopenmp-usage instead
! DEPRECATED-NO: warning: -Wno-open-mp-usage is deprecated; use -Wno-openmp-usage instead
! DEPRECATED-ACC: warning: -Wopen-acc-usage is deprecated; use -Wopenacc-usage instead
More information about the flang-commits
mailing list