Skip to content

[flang][OpenMP] Remove experimental warning #144915

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ def warn_drv_unsupported_option_for_processor : 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_experimental : Warning<
"OpenMP support in flang is still experimental">,
def warn_openmp_incomplete : Warning<
"OpenMP support for version %0 in flang is still incomplete">,
InGroup<ExperimentalOption>;

def err_drv_invalid_thread_model_for_target : Error<
Expand Down
3 changes: 0 additions & 3 deletions clang/lib/Driver/ToolChains/Flang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -906,9 +906,6 @@ void Flang::ConstructJob(Compilation &C, const JobAction &JA,

if (Args.hasArg(options::OPT_fopenmp_force_usm))
CmdArgs.push_back("-fopenmp-force-usm");
// TODO: OpenMP support isn't "done" yet, so for now we warn that it
// is experimental.
D.Diag(diag::warn_openmp_experimental);

// FIXME: Clang supports a whole bunch more flags here.
break;
Expand Down
8 changes: 6 additions & 2 deletions flang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,9 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
unsigned numErrorsBefore = diags.getNumErrors();
llvm::Triple t(res.getTargetOpts().triple);

// By default OpenMP is set to 3.1 version
res.getLangOpts().OpenMPVersion = 31;
constexpr unsigned newestFullySupported = 31;
// By default OpenMP is set to the most recent fully supported version
res.getLangOpts().OpenMPVersion = newestFullySupported;
res.getFrontendOpts().features.Enable(
Fortran::common::LanguageFeature::OpenMP);
if (auto *arg =
Expand All @@ -1164,6 +1165,9 @@ static bool parseOpenMPArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
if (!value.getAsInteger(/*radix=*/10, version)) {
if (llvm::is_contained(ompVersions, version)) {
res.getLangOpts().OpenMPVersion = version;

if (version > newestFullySupported)
diags.Report(clang::diag::warn_openmp_incomplete) << version;
} else if (llvm::is_contained(oldVersions, version)) {
const unsigned diagID =
diags.getCustomDiagID(clang::DiagnosticsEngine::Warning,
Expand Down
4 changes: 2 additions & 2 deletions flang/test/Driver/fopenmp.f90
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,6 @@
! CHECK-LD-ANYMD: "{{.*}}ld{{(.exe)?}}"
! CHECK-LD-ANYMD: "-l{{(omp|gomp|iomp5md)}}"
!
! RUN: %flang -fopenmp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-EXPERIMENTAL
! RUN: %flang -fopenmp -fopenmp-version=40 -c %s -S -o - 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPLETE
!
! CHECK-EXPERIMENTAL: flang{{.*}}: warning: OpenMP support in flang is still experimental
! CHECK-INCOMPLETE: warning: OpenMP support for version 40 in flang is still incomplete