diff options
author | Sandra Loosemore <sloosemore@baylibre.com> | 2025-01-15 17:22:53 +0000 |
---|---|---|
committer | Sandra Loosemore <sloosemore@baylibre.com> | 2025-01-16 18:24:26 +0000 |
commit | 7f8bb6498691cace5cced224bfc72d13724c9b82 (patch) | |
tree | 843760866cd1271e56796c8e42f1483cd146ea83 /gcc/c/c-parser.cc | |
parent | c7dab40d7569c51ac4e62ceea05c7c049da426bb (diff) | |
download | gcc-7f8bb6498691cace5cced224bfc72d13724c9b82.zip gcc-7f8bb6498691cace5cced224bfc72d13724c9b82.tar.gz gcc-7f8bb6498691cace5cced224bfc72d13724c9b82.tar.bz2 |
OpenMP: Improve error message for invalid directive in "assumes".
gcc/c/ChangeLog
* c-parser.cc (c_parser_omp_assumption_clauses): Give a more specific
error message for invalid directives vs unknown names.
gcc/cp/ChangeLog
* parser.cc (cp_parser_omp_assumption_clauses): Give a more specific
error message for invalid directives vs unknown names.
gcc/fortran/ChangeLog
* openmp.cc (gfc_omp_absent_contains_clause): Use an Oxford comma
in the message.
gcc/testsuite/ChangeLog
* c-c++-common/gomp/assume-2.c: Adjust expected diagnostics.
* c-c++-common/gomp/assumes-2.c: Likewise.
* c-c++-common/gomp/begin-assumes-2.c: Likewise.
* gfortran.dg/gomp/allocate-6.f90: Likewise.
* gfortran.dg/gomp/assumes-2.f90: Likewise.
Diffstat (limited to 'gcc/c/c-parser.cc')
-rw-r--r-- | gcc/c/c-parser.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index b45c7ef..f193329 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -28846,13 +28846,18 @@ c_parser_omp_assumption_clauses (c_parser *parser, bool is_assume) = c_omp_categorize_directive (directive[0], directive[1], directive[2]); - if (dir == NULL - || dir->kind == C_OMP_DIR_DECLARATIVE - || dir->kind == C_OMP_DIR_INFORMATIONAL - || dir->kind == C_OMP_DIR_META - || dir->id == PRAGMA_OMP_END - || (!dir->second && directive[1]) - || (!dir->third && directive[2])) + if (dir + && (dir->kind == C_OMP_DIR_DECLARATIVE + || dir->kind == C_OMP_DIR_INFORMATIONAL + || dir->kind == C_OMP_DIR_META)) + error_at (dloc, "invalid OpenMP directive name in " + "%qs clause argument: declarative, " + "informational, and meta directives " + "not permitted", p); + else if (dir == NULL + || dir->id == PRAGMA_OMP_END + || (!dir->second && directive[1]) + || (!dir->third && directive[2])) error_at (dloc, "unknown OpenMP directive name in " "%qs clause argument", p); else |