default clause replaced by otherwise clause for metadirective in OpenMP 5.2 by ravurvi20 · Pull Request #128640 · llvm/llvm-project (original) (raw)

@llvm/pr-subscribers-clang

Author: Urvi Rav (ravurvi20)

Changes

This PR replaces the default clause with the otherwise clause for the metadirective in OpenMP. The otherwise clause serves as a fallback condition when no directive from the when clauses is selected. In the when clause, context selectors define traits evaluated to determine the directive to be applied.
The previous merge was reverted due to a failing test case, which has now been resolved.


Full diff: https://github.com/llvm/llvm-project/pull/128640.diff

3 Files Affected:

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td index c513dab810d1f..4b8449e9ee9b6 100644 --- a/clang/include/clang/Basic/DiagnosticParseKinds.td +++ b/clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1657,6 +1657,10 @@ def err_omp_expected_colon : Error<"missing ':' in %0">; def err_omp_missing_comma : Error< "missing ',' after %0">; def err_omp_expected_context_selector : Error<"expected valid context selector in %0">; +def err_omp_unknown_clause

+def warn_omp_default_deprecated : Warning<"'default' clause for"

@@ -2785,6 +2798,13 @@ StmtResult Parser::ParseOpenMPDeclarativeOrExecutableDirective( return Directive; } }

diff --git a/clang/test/OpenMP/metadirective_messages.cpp b/clang/test/OpenMP/metadirective_messages.cpp index 7fce9fa446058..40ea37845fdff 100644 --- a/clang/test/OpenMP/metadirective_messages.cpp +++ b/clang/test/OpenMP/metadirective_messages.cpp @@ -2,21 +2,48 @@

// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -verify -fopenmp-simd -x c++ -std=c++14 -fexceptions -fcxx-exceptions %s

+// RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -verify=expected,omp52 -fopenmp -fopenmp-version=52 -ferror-limit 100 -o - %s -Wuninitialized + void foo() { -#pragma omp metadirective // expected-error {{expected expression}}