[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 Apr 16 02:11:53 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 01/13] [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 02/13] 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 03/13] 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 04/13] 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

>From e000b22839ffbc9f8d9d4baa4139c88239c184b9 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 26 Mar 2026 20:04:37 +0100
Subject: [PATCH 05/13] Use references to pass std::string

---
 flang/include/flang/Support/Fortran-features.h | 14 +++++++-------
 flang/lib/Frontend/CompilerInvocation.cpp      | 13 +++++++------
 flang/lib/Support/Fortran-features.cpp         |  4 +++-
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/flang/include/flang/Support/Fortran-features.h b/flang/include/flang/Support/Fortran-features.h
index 10a901b8cb5c2..7a9667562c5e4 100644
--- a/flang/include/flang/Support/Fortran-features.h
+++ b/flang/include/flang/Support/Fortran-features.h
@@ -148,18 +148,18 @@ class LanguageFeatureControl {
   void AddAlternativeCliSpelling(UsageWarning w, std::string input) {
     cliOptions_.insert({input, {w}});
   }
-  void AddDeprecatedCliSpelling(
-      LanguageFeature f, std::string deprecated, std::string canonical) {
+  void AddDeprecatedCliSpelling(LanguageFeature f,
+      const std::string &deprecated, const std::string &canonical) {
     cliOptions_.insert({deprecated, {f}});
-    deprecatedCliOptions_.insert({std::move(deprecated), std::move(canonical)});
+    deprecatedCliOptions_.insert({deprecated, canonical});
   }
-  void AddDeprecatedCliSpelling(
-      UsageWarning w, std::string deprecated, std::string canonical) {
+  void AddDeprecatedCliSpelling(UsageWarning w, const std::string &deprecated,
+      const std::string &canonical) {
     cliOptions_.insert({deprecated, {w}});
-    deprecatedCliOptions_.insert({std::move(deprecated), std::move(canonical)});
+    deprecatedCliOptions_.insert({deprecated, canonical});
   }
   // Returns the canonical spelling if the input is a deprecated spelling.
-  std::optional<std::string_view> GetCanonicalSpelling(
+  std::optional<std::string_view> CheckDeprecatedSpelling(
       std::string_view input) const;
   void ReplaceCliCanonicalSpelling(LanguageFeature f, std::string input);
   void ReplaceCliCanonicalSpelling(UsageWarning w, std::string input);
diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index f0bc61bf0d2c2..d080107690302 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1044,13 +1044,10 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
       } else if (wArg == "fatal-errors") {
         res.setMaxErrors(1);
         // -W[no-]<feature>
-      } else if (!features.EnableWarning(wArg)) {
-        const unsigned diagID = diags.getCustomDiagID(
-            clang::DiagnosticsEngine::Error, "Unknown diagnostic option: -W%0");
-        diags.Report(diagID) << wArg;
-      } else {
-        if (auto canonical{features.GetCanonicalSpelling(wArg)}) {
+      } else if (features.EnableWarning(wArg)) {
+        if (auto canonical{features.CheckDeprecatedSpelling(wArg)}) {
           std::string suggestion{*canonical};
+          // TODO: replace with starts_with when moving to C++20
           if (wArg.size() > 3 && wArg.substr(0, 3) == "no-") {
             suggestion = "no-" + suggestion;
           }
@@ -1059,6 +1056,10 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
                                     "-W%0 is deprecated; use -W%1 instead");
           diags.Report(diagID) << wArg << suggestion;
         }
+      } else {
+        const unsigned diagID = diags.getCustomDiagID(
+            clang::DiagnosticsEngine::Error, "Unknown diagnostic option: -W%0");
+        diags.Report(diagID) << wArg;
       }
     }
   }
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 6ccf16e2f169b..5a4743d890fdd 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -217,6 +217,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
 std::optional<LanguageControlFlag> LanguageFeatureControl::FindWarning(
     std::string_view input) {
   bool negated{false};
+  // TODO: replace with starts_with when moving to C++20
   if (input.size() > 3 && input.substr(0, 3) == "no-") {
     negated = true;
     input = input.substr(3);
@@ -227,9 +228,10 @@ std::optional<LanguageControlFlag> LanguageFeatureControl::FindWarning(
   return std::nullopt;
 }
 
-std::optional<std::string_view> LanguageFeatureControl::GetCanonicalSpelling(
+std::optional<std::string_view> LanguageFeatureControl::CheckDeprecatedSpelling(
     std::string_view input) const {
   // Strip "no-" prefix for lookup, same as FindWarning does.
+  // TODO: replace with starts_with when moving to C++20
   if (input.size() > 3 && input.substr(0, 3) == "no-") {
     input = input.substr(3);
   }

>From 3be30a8534a49f7fc568e22303bbca1055bed96d Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Wed, 8 Apr 2026 12:32:58 +0200
Subject: [PATCH 06/13] Use llvm::StringRef

---
 flang/lib/Frontend/CompilerInvocation.cpp | 6 +++---
 flang/lib/Support/Fortran-features.cpp    | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index d080107690302..28398d3fb0531 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1037,7 +1037,8 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
   // this has to change when other -W<opt>'s are supported.
   if (args.hasArg(clang::options::OPT_W_Joined)) {
     const auto &wArgs = args.getAllArgValues(clang::options::OPT_W_Joined);
-    for (const auto &wArg : wArgs) {
+     // TODO: Consider using std::string_view when moving to C++
+    for (const llvm::StringRef wArg : wArgs) {
       if (wArg == "error") {
         res.setWarnAsErr(true);
         // -Wfatal-errors
@@ -1047,8 +1048,7 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
       } else if (features.EnableWarning(wArg)) {
         if (auto canonical{features.CheckDeprecatedSpelling(wArg)}) {
           std::string suggestion{*canonical};
-          // TODO: replace with starts_with when moving to C++20
-          if (wArg.size() > 3 && wArg.substr(0, 3) == "no-") {
+          if (wArg.starts_with("no-")) {
             suggestion = "no-" + suggestion;
           }
           const unsigned diagID =
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 5a4743d890fdd..7de4f292d8d96 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -10,6 +10,7 @@
 #include "flang/Common/idioms.h"
 #include "flang/Parser/characters.h"
 #include "flang/Support/Fortran.h"
+#include "llvm/ADT/StringRef.h"
 #include <string>
 #include <string_view>
 
@@ -231,8 +232,8 @@ std::optional<LanguageControlFlag> LanguageFeatureControl::FindWarning(
 std::optional<std::string_view> LanguageFeatureControl::CheckDeprecatedSpelling(
     std::string_view input) const {
   // Strip "no-" prefix for lookup, same as FindWarning does.
-  // TODO: replace with starts_with when moving to C++20
-  if (input.size() > 3 && input.substr(0, 3) == "no-") {
+  // TODO: Consider using std::string_view when moving to C++
+  if (llvm::StringRef{input}.starts_with("no-")) {
     input = input.substr(3);
   }
   if (auto it{deprecatedCliOptions_.find(std::string{input})};

>From 4a9f5a7d2c77efd3b609e7d98181697fa4185a48 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Wed, 8 Apr 2026 12:47:25 +0200
Subject: [PATCH 07/13] Make clang-format happy

---
 flang/lib/Frontend/CompilerInvocation.cpp | 2 +-
 flang/lib/Support/Fortran-features.cpp    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 28398d3fb0531..0979ba0e077af 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1037,7 +1037,7 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
   // this has to change when other -W<opt>'s are supported.
   if (args.hasArg(clang::options::OPT_W_Joined)) {
     const auto &wArgs = args.getAllArgValues(clang::options::OPT_W_Joined);
-     // TODO: Consider using std::string_view when moving to C++
+    // TODO: Consider using std::string_view when moving to C++
     for (const llvm::StringRef wArg : wArgs) {
       if (wArg == "error") {
         res.setWarnAsErr(true);
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 7de4f292d8d96..4b71e533699fb 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -48,7 +48,7 @@ static constexpr std::pair<std::string_view, std::string_view>
 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())) {
+       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);
@@ -103,7 +103,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
     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())) {
+           pos = deprecated.find(canonicalForm, pos + deprecatedForm.size())) {
         deprecated.replace(pos, canonicalForm.size(), deprecatedForm);
         replaced = true;
       }

>From e92a9560a09a91ed232e24bd0dc4f9b6a99bb470 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael at dontknow.de>
Date: Mon, 13 Apr 2026 18:07:50 +0200
Subject: [PATCH 08/13] Add note to the release notes (finally!)

---
 flang/docs/ReleaseNotes.md | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/flang/docs/ReleaseNotes.md b/flang/docs/ReleaseNotes.md
index 888da4d58b868..48ba3226dfee4 100644
--- a/flang/docs/ReleaseNotes.md
+++ b/flang/docs/ReleaseNotes.md
@@ -35,6 +35,8 @@ page](https://llvm.org/releases/).
 
 ## New Compiler Flags
 
+- The warning flags with suffixes `-Wopen-mp` and `-Wopen-acc` have been deprecated in favor of corrected spellings with the respective suffixes `-Wopenmp` and `-Wopenacc`.
+
 ## Windows Support
 
 ## Fortran Language Changes in Flang

>From f6dc7bc6bf9e76154b09f15319dfd718260f1836 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael at dontknow.de>
Date: Mon, 13 Apr 2026 18:24:46 +0200
Subject: [PATCH 09/13] Correctly use prefix instead of suffix

---
 flang/docs/ReleaseNotes.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/flang/docs/ReleaseNotes.md b/flang/docs/ReleaseNotes.md
index 48ba3226dfee4..3a60954e64007 100644
--- a/flang/docs/ReleaseNotes.md
+++ b/flang/docs/ReleaseNotes.md
@@ -35,7 +35,7 @@ page](https://llvm.org/releases/).
 
 ## New Compiler Flags
 
-- The warning flags with suffixes `-Wopen-mp` and `-Wopen-acc` have been deprecated in favor of corrected spellings with the respective suffixes `-Wopenmp` and `-Wopenacc`.
+- The warning flags with prefixes `-Wopen-mp` and `-Wopen-acc` have been deprecated in favor of corrected spellings with the respective prefixes `-Wopenmp` and `-Wopenacc`.
 
 ## Windows Support
 

>From 50f4cc372f5aa3be2061c5cd32a8968b21a27105 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Tue, 14 Apr 2026 21:40:26 +0200
Subject: [PATCH 10/13] Improve TODO comments

---
 flang/lib/Frontend/CompilerInvocation.cpp | 3 ++-
 flang/lib/Support/Fortran-features.cpp    | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 0979ba0e077af..b814eb6e371c2 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1037,7 +1037,8 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
   // this has to change when other -W<opt>'s are supported.
   if (args.hasArg(clang::options::OPT_W_Joined)) {
     const auto &wArgs = args.getAllArgValues(clang::options::OPT_W_Joined);
-    // TODO: Consider using std::string_view when moving to C++
+    // TODO: Consider using std::string_view instead of llvm::StringRef
+    // when moving to C++20:
     for (const llvm::StringRef wArg : wArgs) {
       if (wArg == "error") {
         res.setWarnAsErr(true);
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 4b71e533699fb..10e6aacabcbda 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -232,7 +232,8 @@ std::optional<LanguageControlFlag> LanguageFeatureControl::FindWarning(
 std::optional<std::string_view> LanguageFeatureControl::CheckDeprecatedSpelling(
     std::string_view input) const {
   // Strip "no-" prefix for lookup, same as FindWarning does.
-  // TODO: Consider using std::string_view when moving to C++
+  // TODO: Consider using std::string_view instead of llvm::StringRef
+  // when moving to C++20:
   if (llvm::StringRef{input}.starts_with("no-")) {
     input = input.substr(3);
   }

>From cb4ba2b140b2f2a8c55d93ac4e5f4f3305fc86a6 Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Tue, 14 Apr 2026 21:43:37 +0200
Subject: [PATCH 11/13] Make clang-format happy (again)

---
 flang/lib/Support/Fortran-features.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 10e6aacabcbda..7e5ad5ab1c5bb 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -48,7 +48,7 @@ static constexpr std::pair<std::string_view, std::string_view>
 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())) {
+      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);
@@ -103,7 +103,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
     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())) {
+          pos = deprecated.find(canonicalForm, pos + deprecatedForm.size())) {
         deprecated.replace(pos, canonicalForm.size(), deprecatedForm);
         replaced = true;
       }

>From 63d7e417cf9bfff9090f9fc153eec06da16f86ba Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Wed, 15 Apr 2026 09:37:48 +0200
Subject: [PATCH 12/13] Add timeline for removal

---
 flang/docs/ReleaseNotes.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/flang/docs/ReleaseNotes.md b/flang/docs/ReleaseNotes.md
index 3a60954e64007..83f53cfb793a4 100644
--- a/flang/docs/ReleaseNotes.md
+++ b/flang/docs/ReleaseNotes.md
@@ -35,7 +35,8 @@ page](https://llvm.org/releases/).
 
 ## New Compiler Flags
 
-- The warning flags with prefixes `-Wopen-mp` and `-Wopen-acc` have been deprecated in favor of corrected spellings with the respective prefixes `-Wopenmp` and `-Wopenacc`.
+- The warning flags with prefixes -Wopen-mp and -Wopen-acc have been deprecated in favor of corrected spellings with the respective prefixes -Wopenmp and -Wopenacc. Removal of the deprecated options is planned for LLVM 25 (July 2027).
+
 
 ## Windows Support
 

>From 3e98bdfbd2d1ee873dbb8322192e72fbd38f445a Mon Sep 17 00:00:00 2001
From: Michael Klemm <michael.klemm at amd.com>
Date: Thu, 16 Apr 2026 11:11:18 +0200
Subject: [PATCH 13/13] Test -Wno-open-mp-*

---
 flang/test/Semantics/OpenMP/threadprivate-equivalence-nowarn.f90 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/flang/test/Semantics/OpenMP/threadprivate-equivalence-nowarn.f90 b/flang/test/Semantics/OpenMP/threadprivate-equivalence-nowarn.f90
index 02ebeea5aeed7..1b98206eb1bc2 100644
--- a/flang/test/Semantics/OpenMP/threadprivate-equivalence-nowarn.f90
+++ b/flang/test/Semantics/OpenMP/threadprivate-equivalence-nowarn.f90
@@ -1,4 +1,5 @@
 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Wno-openmp-threadprivate-equivalence
+! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Wno-open-mp-threadprivate-equivalence
 
 ! This is a test for an extension to the OpenMP semantics, see https://github.com/llvm/llvm-project/issues/180493
 



More information about the flang-commits mailing list