https://github.com/kparzysz updated https://github.com/llvm/llvm-project/pull/196354
>From 7f7afd80e6f0778179ab70f71dd45a4373b39e2c Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Wed, 6 May 2026 17:20:49 -0500 Subject: [PATCH 1/6] [flang] Implement -Wno-<warning> flags for driver diagnostics Utilize clang::ProcessWarningOptions function to process -Wno-... options. This has the side effect that without additional changes it would cause driver warnings to become errors with -Werror. That would be a change from the existing behavior, so make sure that these warnings remain uneffected. Modify the diagnostic emitter to add the disabling option at the end of the emitted diagnostic. Fixes https://github.com/llvm/llvm-project/issues/195921 --- .../clang/Basic/DiagnosticDriverKinds.td | 7 +- .../include/flang/Support/Fortran-features.h | 2 +- flang/lib/Frontend/CompilerInvocation.cpp | 65 +++++++++++-------- flang/lib/Frontend/TextDiagnosticBuffer.cpp | 35 +++++++++- flang/test/Driver/fopenmp-version.F90 | 6 +- 5 files changed, 80 insertions(+), 35 deletions(-) diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td index 114ee475c371f..495254e89f520 100644 --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -167,10 +167,13 @@ def warn_drv_unsupported_option_for_runtime : Warning< def warn_drv_unsupported_openmp_library : Warning< "the library '%0=%1' is not supported, OpenMP will not be enabled">, InGroup<OptionIgnored>; -def warn_openmp_incomplete : Warning< +def warn_openmp_impl_incomplete : Warning< "OpenMP support for version %0 in flang is still incomplete">, InGroup<ExperimentalOption>; - +def warn_openmp_spec_incomplete : Warning< + "the specification for OpenMP version %0 is still under development; " + "the syntax and semantics of new features may be subject to change">, + InGroup<ExperimentalOption>; def err_drv_invalid_thread_model_for_target : Error< "invalid thread model '%0' in '%1' for this target">; def err_drv_invalid_linker_name : Error< diff --git a/flang/include/flang/Support/Fortran-features.h b/flang/include/flang/Support/Fortran-features.h index af72b71d9d1e6..1d07015334cfa 100644 --- a/flang/include/flang/Support/Fortran-features.h +++ b/flang/include/flang/Support/Fortran-features.h @@ -85,7 +85,7 @@ ENUM_CLASS(UsageWarning, Portability, PointerToUndefinable, RealConstantWidening, VolatileOrAsynchronousTemporary, UnusedVariable, UsedUndefinedVariable, BadValueInDeadCode, AssumedTypeSizeDummy, MisplacedIgnoreTKR, NamelistParameter, ImpureFinalInPure, - IgnoredNoReallocateLHS, CLoc) + IgnoredNoReallocateLHS, CLoc, ExperimentalOption) using LanguageFeatures = EnumSet<LanguageFeature, LanguageFeature_enumSize>; using UsageWarnings = EnumSet<UsageWarning, UsageWarning_enumSize>; diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index e7f4762e167fb..ea20ebbd7c2c1 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -41,6 +41,7 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/Support/VirtualFileSystem.h" #include "llvm/TargetParser/Host.h" #include "llvm/TargetParser/Triple.h" #include <algorithm> @@ -601,8 +602,6 @@ static std::optional<const char *> parseConvertArg(const char *s) { static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args, clang::DiagnosticsEngine &diags) { - unsigned numErrorsBefore = diags.getNumErrors(); - // By default the frontend driver creates a ParseSyntaxOnly action. opts.programAction = ParseSyntaxOnly; @@ -910,7 +909,7 @@ static bool parseFrontendArgs(FrontendOptions &opts, llvm::opt::ArgList &args, setUpFrontendBasedOnAction(opts); opts.dashX = dashX; - return diags.getNumErrors() == numErrorsBefore; + return !diags.hasUncompilableErrorOccurred(); } // Generate the path to look for intrinsic modules @@ -983,8 +982,6 @@ static void parsePreprocessorArgs(Fortran::frontend::PreprocessorOptions &opts, /// options accordingly. Returns false if new errors are generated. static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args, clang::DiagnosticsEngine &diags) { - unsigned numErrorsBefore = diags.getNumErrors(); - // -J/module-dir option std::vector<std::string> moduleDirList = args.getAllArgValues(clang::options::OPT_module_dir); @@ -1026,7 +1023,7 @@ static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args, args.hasFlag(clang::options::OPT_fanalyzed_objects_for_unparse, clang::options::OPT_fno_analyzed_objects_for_unparse, true)); - return diags.getNumErrors() == numErrorsBefore; + return !diags.hasUncompilableErrorOccurred(); } /// Parses all diagnostics related arguments and populates the variables @@ -1034,8 +1031,6 @@ static bool parseSemaArgs(CompilerInvocation &res, llvm::opt::ArgList &args, /// FC1 driver entry point for parsing diagnostic arguments. static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args, clang::DiagnosticsEngine &diags) { - unsigned numErrorsBefore = diags.getNumErrors(); - auto &features{res.getFrontendOpts().features}; // The order of these flags (-pedantic -W<feature> -w) is important and is // chosen to match clang's behavior. @@ -1092,15 +1087,13 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args, diags.getDiagnosticOptions().ShowColors = showColors; res.getDiagnosticOpts().ShowColors = showColors; res.getFrontendOpts().showColors = showColors; - return diags.getNumErrors() == numErrorsBefore; + return !diags.hasUncompilableErrorOccurred(); } /// Parses all Dialect related arguments and populates the variables /// options accordingly. Returns false if new errors are generated. static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, clang::DiagnosticsEngine &diags) { - unsigned numErrorsBefore = diags.getNumErrors(); - // -fd-lines-as-code if (args.hasArg(clang::options::OPT_fd_lines_as_code)) { if (res.getFrontendOpts().fortranForm == FortranForm::FreeForm) { @@ -1213,7 +1206,7 @@ static bool parseDialectArgs(CompilerInvocation &res, llvm::opt::ArgList &args, diags.Report(diagID); } - return diags.getNumErrors() == numErrorsBefore; + return !diags.hasUncompilableErrorOccurred(); } /// Parses all OpenMP related arguments if the -fopenmp option is present, @@ -1232,7 +1225,6 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args, res.getLangOpts().OpenMPSimd = 1; } - unsigned numErrorsBefore = diags.getNumErrors(); llvm::Triple t(res.getTargetOpts().triple); constexpr unsigned newestFullySupported = 31; @@ -1258,27 +1250,15 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args, diags.Report(diagID) << value << arg->getAsString(args) << versions.str(); }; - auto reportFutureVersion = [&](llvm::StringRef value) { - const unsigned diagID = diags.getCustomDiagID( - clang::DiagnosticsEngine::Warning, - "The specification for OpenMP version %0 is still under development; " - "the syntax and semantics of new features may be subject to change"); - std::string buffer; - llvm::raw_string_ostream versions(buffer); - llvm::interleaveComma(ompVersions, versions); - - diags.Report(diagID) << value; - }; - llvm::StringRef value = arg->getValue(); if (!value.getAsInteger(/*radix=*/10, version)) { if (llvm::is_contained(ompVersions, version)) { res.getLangOpts().OpenMPVersion = version; if (version > latestFinalized) - reportFutureVersion(value); + diags.Report(clang::diag::warn_openmp_spec_incomplete) << version; else if (version > newestFullySupported) - diags.Report(clang::diag::warn_openmp_incomplete) << version; + diags.Report(clang::diag::warn_openmp_impl_incomplete) << version; } else if (llvm::is_contained(oldVersions, version)) { const unsigned diagID = diags.getCustomDiagID(clang::DiagnosticsEngine::Warning, @@ -1382,7 +1362,7 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args, res.getLangOpts().OMPTargetTriples.push_back(tt); } } - return diags.getNumErrors() == numErrorsBefore; + return !diags.hasUncompilableErrorOccurred(); } /// Parses signed integer overflow options and populates the @@ -1588,11 +1568,34 @@ static bool parseLangOptionsArgs(CompilerInvocation &invoc, return success; } +// Copied from clang/lib/Frontend/CompilerInvocation.cpp. +static void addDiagnosticArgs(llvm::opt::ArgList &Args, + llvm::opt::OptSpecifier Group, llvm::opt::OptSpecifier GroupWithValue, + std::vector<std::string> &Diagnostics) { + for (auto *A : Args.filtered(Group)) { + if (A->getOption().getKind() == llvm::opt::Option::FlagClass) { + // The argument is a pure flag (such as OPT_Wall or OPT_Wdeprecated). Add + // its name (minus the "W" or "R" at the beginning) to the diagnostics. + Diagnostics.push_back( + std::string(A->getOption().getName().drop_front(1))); + } else if (A->getOption().matches(GroupWithValue)) { + // This is -Wfoo= or -Rfoo=, where foo is the name of the diagnostic + // group. Add only the group name to the diagnostics. + Diagnostics.push_back( + std::string(A->getOption().getName().drop_front(1).rtrim("=-"))); + } else { + // Otherwise, add its value (for OPT_W_Joined and similar). + Diagnostics.push_back(A->getValue()); + } + } +} + bool CompilerInvocation::createFromArgs( CompilerInvocation &invoc, llvm::ArrayRef<const char *> commandLineArgs, clang::DiagnosticsEngine &diags, const char *argv0) { bool success = true; + clang::DiagnosticOptions &diagOpts = diags.getDiagnosticOptions(); // Set the default triple for this CompilerInvocation. This might be // overridden by users with `-triple` (see the call to `ParseTargetArgs` @@ -1629,6 +1632,12 @@ bool CompilerInvocation::createFromArgs( success = false; } + // Handle -Wno-<warning> flags. + addDiagnosticArgs(args, clang::options::OPT_W_Group, + clang::options::OPT_W_value_Group, diagOpts.Warnings); + auto vfs = llvm::vfs::getRealFileSystem(); + clang::ProcessWarningOptions(diags, diagOpts, *vfs, /*ReportDiags=*/false); + // -flang-experimental-hlfir if (args.hasArg(clang::options::OPT_flang_experimental_hlfir) || args.hasArg(clang::options::OPT_emit_hlfir)) { diff --git a/flang/lib/Frontend/TextDiagnosticBuffer.cpp b/flang/lib/Frontend/TextDiagnosticBuffer.cpp index 1f3b86f92dc74..140b99aed5c1c 100644 --- a/flang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/flang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -21,15 +21,48 @@ using namespace Fortran::frontend; +static void printWarningOption(llvm::raw_ostream &os, + clang::DiagnosticsEngine::Level level, const clang::Diagnostic &info) { + auto &diagIDs = *info.getDiags()->getDiagnosticIDs(); + + if (level == clang::DiagnosticsEngine::Warning) { + llvm::StringRef opt = diagIDs.getWarningOptionForDiag(info.getID()); + if (!opt.empty()) { + os << " [-W" << opt; + llvm::StringRef optValue = info.getFlagValue(); + if (!optValue.empty()) + os << "=" << optValue; + os << ']'; + } + } +} + /// HandleDiagnostic - Store the errors, warnings, and notes that are /// reported. void TextDiagnosticBuffer::HandleDiagnostic( clang::DiagnosticsEngine::Level level, const clang::Diagnostic &info) { - // Default implementation (warnings_/errors count). + // Default implementation (warnings/errors count). DiagnosticConsumer::HandleDiagnostic(level, info); llvm::SmallString<100> buf; info.FormatDiagnostic(buf); + + // This function dealing with diagnostics emitted directly through the + // diagnostic engine, e.g. in CompilerInvocation. With -Werror any warning + // emitted there would become an error, and prevented any part of compilation + // from happening. In case of OpenMP, this would cause the warning about an + // incomplete implementation to completely skip the compilation, which is + // undesirable. + // Downgrade -Werror'ed warnings back to warnings to avoid this situation. + const clang::DiagnosticsEngine &diags = *info.getDiags(); + if (level == clang::DiagnosticsEngine::Error) { + if (!diags.getDiagnosticIDs()->isDefaultMappingAsError(info.getID())) + level = clang::DiagnosticsEngine::Warning; + } + + llvm::raw_svector_ostream os(buf); + printWarningOption(os, level, info); + switch (level) { default: llvm_unreachable("Diagnostic not handled during diagnostic buffering!"); diff --git a/flang/test/Driver/fopenmp-version.F90 b/flang/test/Driver/fopenmp-version.F90 index 59406d3dd32c8..9106b62f90b42 100644 --- a/flang/test/Driver/fopenmp-version.F90 +++ b/flang/test/Driver/fopenmp-version.F90 @@ -16,14 +16,14 @@ !RUN: %flang -c -fopenmp -fopenmp-version=25 %s 2>&1 | FileCheck --check-prefix=WARN-ASSUMED %s - !WARN-ASSUMED: warning: OpenMP version 25 is no longer supported, assuming version 31 !RUN: not %flang -c -fopenmp -fopenmp-version=29 %s 2>&1 | FileCheck --check-prefix=ERR-BAD %s - !ERR-BAD: error: '29' is not a valid OpenMP version in '-fopenmp-version=29', valid versions are 31, 40, 45, 50, 51, 52, 60, 61 !RUN: %flang -c -fopenmp -fopenmp-version=61 %s 2>&1 | FileCheck --check-prefix=FUTURE %s +!FUTURE: the specification for OpenMP version 61 is still under development; the syntax and semantics of new features may be subject to change [-Wexperimental-option] -!FUTURE: The specification for OpenMP version 61 is still under development; the syntax and semantics of new features may be subject to change +!RUN: %flang -c -fopenmp -fopenmp-version=60 %s 2>&1 | FileCheck --check-prefix=IMPL %s +!IMPL: OpenMP support for version 60 in flang is still incomplete [-Wexperimental-option] >From f4c5a3f89f24fa5e9b005009534bfa5e45b5ab23 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Thu, 7 May 2026 10:50:07 -0500 Subject: [PATCH 2/6] format --- flang/lib/Frontend/CompilerInvocation.cpp | 9 +++++---- flang/lib/Frontend/TextDiagnosticBuffer.cpp | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index ea20ebbd7c2c1..55df92d660c6f 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -40,8 +40,8 @@ #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" -#include "llvm/Support/raw_ostream.h" #include "llvm/Support/VirtualFileSystem.h" +#include "llvm/Support/raw_ostream.h" #include "llvm/TargetParser/Host.h" #include "llvm/TargetParser/Triple.h" #include <algorithm> @@ -1570,8 +1570,9 @@ static bool parseLangOptionsArgs(CompilerInvocation &invoc, // Copied from clang/lib/Frontend/CompilerInvocation.cpp. static void addDiagnosticArgs(llvm::opt::ArgList &Args, - llvm::opt::OptSpecifier Group, llvm::opt::OptSpecifier GroupWithValue, - std::vector<std::string> &Diagnostics) { + llvm::opt::OptSpecifier Group, + llvm::opt::OptSpecifier GroupWithValue, + std::vector<std::string> &Diagnostics) { for (auto *A : Args.filtered(Group)) { if (A->getOption().getKind() == llvm::opt::Option::FlagClass) { // The argument is a pure flag (such as OPT_Wall or OPT_Wdeprecated). Add @@ -1634,7 +1635,7 @@ bool CompilerInvocation::createFromArgs( // Handle -Wno-<warning> flags. addDiagnosticArgs(args, clang::options::OPT_W_Group, - clang::options::OPT_W_value_Group, diagOpts.Warnings); + clang::options::OPT_W_value_Group, diagOpts.Warnings); auto vfs = llvm::vfs::getRealFileSystem(); clang::ProcessWarningOptions(diags, diagOpts, *vfs, /*ReportDiags=*/false); diff --git a/flang/lib/Frontend/TextDiagnosticBuffer.cpp b/flang/lib/Frontend/TextDiagnosticBuffer.cpp index 140b99aed5c1c..12460aa565e2f 100644 --- a/flang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/flang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -22,7 +22,8 @@ using namespace Fortran::frontend; static void printWarningOption(llvm::raw_ostream &os, - clang::DiagnosticsEngine::Level level, const clang::Diagnostic &info) { + clang::DiagnosticsEngine::Level level, + const clang::Diagnostic &info) { auto &diagIDs = *info.getDiags()->getDiagnosticIDs(); if (level == clang::DiagnosticsEngine::Warning) { >From 3436eee6789a0d4b26a2f70c4d33cc79cbc07353 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Thu, 7 May 2026 11:03:46 -0500 Subject: [PATCH 3/6] Use " --- flang/lib/Frontend/TextDiagnosticBuffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flang/lib/Frontend/TextDiagnosticBuffer.cpp b/flang/lib/Frontend/TextDiagnosticBuffer.cpp index 12460aa565e2f..179d42a95e9a2 100644 --- a/flang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/flang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -33,7 +33,7 @@ static void printWarningOption(llvm::raw_ostream &os, llvm::StringRef optValue = info.getFlagValue(); if (!optValue.empty()) os << "=" << optValue; - os << ']'; + os << "]"; } } } >From 24c56d21b46c95e35fef8b131a6f3a3f4a7c8d86 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Thu, 7 May 2026 11:11:42 -0500 Subject: [PATCH 4/6] Add #include "llvm/Support/raw_ostream.h" --- flang/lib/Frontend/TextDiagnosticBuffer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/flang/lib/Frontend/TextDiagnosticBuffer.cpp b/flang/lib/Frontend/TextDiagnosticBuffer.cpp index 179d42a95e9a2..fc43d89a614f0 100644 --- a/flang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/flang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -18,6 +18,7 @@ #include "clang/Basic/Diagnostic.h" #include "llvm/ADT/SmallString.h" #include "llvm/Support/ErrorHandling.h" +#include "llvm/Support/raw_ostream.h" using namespace Fortran::frontend; >From 0d1cb946f2a68fb9ef6b761c07eb927c9aae006e Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Wed, 13 May 2026 08:22:33 -0500 Subject: [PATCH 5/6] Fix build errors after merge --- flang/lib/Frontend/CompilerInvocation.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/flang/lib/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp index 55df92d660c6f..a995491cc982c 100644 --- a/flang/lib/Frontend/CompilerInvocation.cpp +++ b/flang/lib/Frontend/CompilerInvocation.cpp @@ -1639,25 +1639,6 @@ bool CompilerInvocation::createFromArgs( auto vfs = llvm::vfs::getRealFileSystem(); clang::ProcessWarningOptions(diags, diagOpts, *vfs, /*ReportDiags=*/false); - // -flang-experimental-hlfir - if (args.hasArg(clang::options::OPT_flang_experimental_hlfir) || - args.hasArg(clang::options::OPT_emit_hlfir)) { - invoc.loweringOpts.setLowerToHighLevelFIR(true); - } - - // -flang-deprecated-no-hlfir - if (args.hasArg(clang::options::OPT_flang_deprecated_no_hlfir) && - !args.hasArg(clang::options::OPT_emit_hlfir)) { - if (args.hasArg(clang::options::OPT_flang_experimental_hlfir)) { - const unsigned diagID = diags.getCustomDiagID( - clang::DiagnosticsEngine::Error, - "Options '-flang-experimental-hlfir' and " - "'-flang-deprecated-no-hlfir' cannot be both specified"); - diags.Report(diagID); - } - invoc.loweringOpts.setLowerToHighLevelFIR(false); - } - // -fno-ppc-native-vector-element-order if (args.hasArg(clang::options::OPT_fno_ppc_native_vec_elem_order)) { invoc.loweringOpts.setNoPPCNativeVecElemOrder(true); >From 6b7c5f6c47c555ad4374f24b9d9a29cd421d37d8 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek <[email protected]> Date: Wed, 13 May 2026 08:49:53 -0500 Subject: [PATCH 6/6] Keep driver warnings as errors with -Werror Using -Wno-experimental-option takes care of the OpenMP warnings about an incomplete implementation and unfinalized spec. --- flang/lib/Frontend/TextDiagnosticBuffer.cpp | 14 -------------- .../Semantics/OpenMP/defaultmap-clause-v45.f90 | 2 +- .../Semantics/OpenMP/defaultmap-clause-v50.f90 | 2 +- flang/test/Semantics/OpenMP/depend05.f90 | 2 +- flang/test/Semantics/OpenMP/depend06.f90 | 2 +- flang/test/Semantics/OpenMP/deprecation.f90 | 2 +- flang/test/Semantics/OpenMP/flush03.f90 | 2 +- .../OpenMP/future-directive-spellings.f90 | 2 +- flang/test/Semantics/OpenMP/map-modifiers-v60.f90 | 2 +- flang/test/Semantics/OpenMP/map-modifiers-v61.f90 | 2 +- flang/test/Semantics/OpenMP/map-modifiers.f90 | 2 +- .../Semantics/OpenMP/target-loop-still-there.f90 | 2 +- 12 files changed, 11 insertions(+), 25 deletions(-) diff --git a/flang/lib/Frontend/TextDiagnosticBuffer.cpp b/flang/lib/Frontend/TextDiagnosticBuffer.cpp index fc43d89a614f0..0f1134351f23b 100644 --- a/flang/lib/Frontend/TextDiagnosticBuffer.cpp +++ b/flang/lib/Frontend/TextDiagnosticBuffer.cpp @@ -48,20 +48,6 @@ void TextDiagnosticBuffer::HandleDiagnostic( llvm::SmallString<100> buf; info.FormatDiagnostic(buf); - - // This function dealing with diagnostics emitted directly through the - // diagnostic engine, e.g. in CompilerInvocation. With -Werror any warning - // emitted there would become an error, and prevented any part of compilation - // from happening. In case of OpenMP, this would cause the warning about an - // incomplete implementation to completely skip the compilation, which is - // undesirable. - // Downgrade -Werror'ed warnings back to warnings to avoid this situation. - const clang::DiagnosticsEngine &diags = *info.getDiags(); - if (level == clang::DiagnosticsEngine::Error) { - if (!diags.getDiagnosticIDs()->isDefaultMappingAsError(info.getID())) - level = clang::DiagnosticsEngine::Warning; - } - llvm::raw_svector_ostream os(buf); printWarningOption(os, level, info); diff --git a/flang/test/Semantics/OpenMP/defaultmap-clause-v45.f90 b/flang/test/Semantics/OpenMP/defaultmap-clause-v45.f90 index 904fc306a31f4..7c2fee44545eb 100644 --- a/flang/test/Semantics/OpenMP/defaultmap-clause-v45.f90 +++ b/flang/test/Semantics/OpenMP/defaultmap-clause-v45.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45 -Werror -Wno-experimental-option subroutine f00 !WARNING: 'variable-category' modifier is required diff --git a/flang/test/Semantics/OpenMP/defaultmap-clause-v50.f90 b/flang/test/Semantics/OpenMP/defaultmap-clause-v50.f90 index 57bb207bb797a..b8ef7a5b89373 100644 --- a/flang/test/Semantics/OpenMP/defaultmap-clause-v50.f90 +++ b/flang/test/Semantics/OpenMP/defaultmap-clause-v50.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=50 -Werror -Wno-experimental-option subroutine f00 !$omp target defaultmap(tofrom) diff --git a/flang/test/Semantics/OpenMP/depend05.f90 b/flang/test/Semantics/OpenMP/depend05.f90 index 3ca091ef3187d..beda8b3f09953 100644 --- a/flang/test/Semantics/OpenMP/depend05.f90 +++ b/flang/test/Semantics/OpenMP/depend05.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45 -Werror -Wno-experimental-option subroutine f00(x) integer :: x(10) diff --git a/flang/test/Semantics/OpenMP/depend06.f90 b/flang/test/Semantics/OpenMP/depend06.f90 index d2e6a114676c3..665c70c5f5f5e 100644 --- a/flang/test/Semantics/OpenMP/depend06.f90 +++ b/flang/test/Semantics/OpenMP/depend06.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=45 -Werror -Wno-experimental-option subroutine f00(x) integer :: x diff --git a/flang/test/Semantics/OpenMP/deprecation.f90 b/flang/test/Semantics/OpenMP/deprecation.f90 index 45d895b4e907f..0b096993cf5c5 100644 --- a/flang/test/Semantics/OpenMP/deprecation.f90 +++ b/flang/test/Semantics/OpenMP/deprecation.f90 @@ -1,4 +1,4 @@ -! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Werror -fopenmp-version=52 +! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -Werror -fopenmp-version=52 -Wno-experimental-option ! Check for deprecation of master directive and its combined/composite variants diff --git a/flang/test/Semantics/OpenMP/flush03.f90 b/flang/test/Semantics/OpenMP/flush03.f90 index fda437ec5dc82..82c5bef5f5b8d 100644 --- a/flang/test/Semantics/OpenMP/flush03.f90 +++ b/flang/test/Semantics/OpenMP/flush03.f90 @@ -1,4 +1,4 @@ -! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52 -Werror +! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=52 -Werror -Wno-experimental-option subroutine f00(x) integer :: x diff --git a/flang/test/Semantics/OpenMP/future-directive-spellings.f90 b/flang/test/Semantics/OpenMP/future-directive-spellings.f90 index ed7c4d6782fbe..b7705ddd95c4a 100644 --- a/flang/test/Semantics/OpenMP/future-directive-spellings.f90 +++ b/flang/test/Semantics/OpenMP/future-directive-spellings.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52 -Werror -Wno-experimental-option ! The directives to check: ! cancellation_point diff --git a/flang/test/Semantics/OpenMP/map-modifiers-v60.f90 b/flang/test/Semantics/OpenMP/map-modifiers-v60.f90 index b3f2e5171d6d6..da173e1ac5187 100644 --- a/flang/test/Semantics/OpenMP/map-modifiers-v60.f90 +++ b/flang/test/Semantics/OpenMP/map-modifiers-v60.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52 -Werror -Wno-experimental-option subroutine f00(x) integer :: x diff --git a/flang/test/Semantics/OpenMP/map-modifiers-v61.f90 b/flang/test/Semantics/OpenMP/map-modifiers-v61.f90 index 2daa57892475e..ce2f95ae4afc2 100644 --- a/flang/test/Semantics/OpenMP/map-modifiers-v61.f90 +++ b/flang/test/Semantics/OpenMP/map-modifiers-v61.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=61 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=61 -Werror -Wno-experimental-option subroutine f00(x) integer, pointer :: x diff --git a/flang/test/Semantics/OpenMP/map-modifiers.f90 b/flang/test/Semantics/OpenMP/map-modifiers.f90 index aae918a2f1f94..add1528bdfe34 100644 --- a/flang/test/Semantics/OpenMP/map-modifiers.f90 +++ b/flang/test/Semantics/OpenMP/map-modifiers.f90 @@ -1,4 +1,4 @@ -!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52 -Werror +!RUN: %python %S/../test_errors.py %s %flang -fopenmp -fopenmp-version=52 -Werror -Wno-experimental-option subroutine f10(x) integer :: x diff --git a/flang/test/Semantics/OpenMP/target-loop-still-there.f90 b/flang/test/Semantics/OpenMP/target-loop-still-there.f90 index 2d3b1820e23d4..72af078661410 100644 --- a/flang/test/Semantics/OpenMP/target-loop-still-there.f90 +++ b/flang/test/Semantics/OpenMP/target-loop-still-there.f90 @@ -1,4 +1,4 @@ -!RUN: %flang_fc1 -fsyntax-only -fopenmp -fopenmp-version=60 -Werror %s | FileCheck --allow-empty %s +!RUN: %flang_fc1 -fsyntax-only -fopenmp -fopenmp-version=60 -Werror -Wno-experimental-option %s | FileCheck --allow-empty %s !CHECK-NOT: deprecated subroutine f00 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
