Clang error: Only one A clause can appear on a requires directive in a single translation unit (err_omp_requires_clause_redeclaration)
Jump to navigation
Jump to search
Text | error: Only one A clause can appear on a requires directive in a single translation unit (since 8.0) |
---|---|
Type | Error |
Category | OpenMP Issue (since 8.0) |
Internal Id | err_omp_requires_clause_redeclaration (since 8.0) |
Internal Message | Only one %0 clause can appear on a requires directive in a single translation unit (since 8.0)
|
Regular Expression | (?:error|fatal error)\: Only one (.*?) clause can appear on a requires directive in a single translation unit
|
First Commit | 2018-09-26 1408f91a2588 [OPENMP] Add support for OMP5 requires directive + unified_address clause |
Description
Example
Flags | -xc++ -fopenmp
|
|
---|---|---|
Source |
#pragma omp requires unified_address unified_shared_memory
// Duplicate unified_address
#pragma omp requires unified_address
| |
Compiler Output |
<source>:3:22: error: Only one unified_address clause can appear on a requires directive in a single translation unit <source>:1:22: note: unified_address clause previously used here |
Clang Internals (17.0.6)
Git Commit Message
[OPENMP] Add support for OMP5 requires directive + unified_address clause Add support for OMP5.0 requires directive and unified_address clause. Patches to follow will include support for additional clauses. Differential Revision: https://reviews.llvm.org/D52359 llvm-svn: 343063
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaOpenMP.cpp (line 677)
/// Stack for tracking declarations used in OpenMP directives and
/// clauses and their data-sharing attributes.
class DSAStackTy {
// ...
/// Checks for a duplicate clause amongst previously declared requires
/// directives
bool hasDuplicateRequiresClause(ArrayRef<OMPClause *> ClauseList) const {
// ...
for (OMPClause *CNew : ClauseList) {
for (const OMPRequiresDecl *D : RequiresDecls) {
for (const OMPClause *CPrev : D->clauselists()) {
if (CNew->getClauseKind() == CPrev->getClauseKind()) {
SemaRef.Diag(CNew->getBeginLoc(), diag::err_omp_requires_clause_redeclaration) << getOpenMPClauseName(CNew->getClauseKind());
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/OpenMP/requires_default_atomic_mem_order_messages.cpp
- clang/test/OpenMP/requires_default_atomic_mem_order_messages.cpp:10:22: error: Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit
- clang/test/OpenMP/requires_default_atomic_mem_order_messages.cpp:11:22: error: Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit