diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-08-18 11:10:43 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-08-18 11:10:43 +0200 |
commit | 5079b7781a2c506dcdfb241347d74c7891268225 (patch) | |
tree | c10555cf313e8e8190de6037b35385e672c441f2 /gcc/c-family/c-omp.c | |
parent | 0684c8d3effab2c9c1b29938f5e56c77106af564 (diff) | |
download | gcc-5079b7781a2c506dcdfb241347d74c7891268225.zip gcc-5079b7781a2c506dcdfb241347d74c7891268225.tar.gz gcc-5079b7781a2c506dcdfb241347d74c7891268225.tar.bz2 |
openmp: Add nothing directive support
As has been clarified, it is intentional that nothing directive is accepted
in substatements of selection and looping statements and after labels and
is handled as if the directive just isn't there, so that
void
foo (int x)
{
if (x)
#pragma omp metadirective when (...:nothing) when (...:parallel)
bar ();
}
behaves consistently; declarative and stand-alone directives aren't allowed
at that point, but constructs are parsed with the following statement as
the construct body and nothing or missing default on metadirective therefore
should handle the following statement as part of the if substatement instead
of having nothing as the substatement and bar done unconditionally after the
if.
2021-08-18 Jakub Jelinek <jakub@redhat.com>
gcc/c-family/
* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_NOTHING.
* c-pragma.c (omp_pragmas): Add nothing directive.
* c-omp.c (omp_directives): Uncomment nothing directive entry.
gcc/c/
* c-parser.c (c_parser_omp_nothing): New function.
(c_parser_pragma): Handle PRAGMA_OMP_NOTHING.
gcc/cp/
* parser.c (cp_parser_omp_nothing): New function.
(cp_parser_pragma): Handle PRAGMA_OMP_NOTHING.
gcc/testsuite/
* c-c++-common/gomp/nothing-1.c: New test.
* g++.dg/gomp/attrs-1.C (bar): Add nothing directive test.
* g++.dg/gomp/attrs-2.C (bar): Likewise.
* g++.dg/gomp/attrs-9.C: Likewise.
libgomp/
* testsuite/libgomp.c-c++-common/nothing-1.c: New test.
Diffstat (limited to 'gcc/c-family/c-omp.c')
-rw-r--r-- | gcc/c-family/c-omp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c index de49d26..d4e98bf 100644 --- a/gcc/c-family/c-omp.c +++ b/gcc/c-family/c-omp.c @@ -3007,8 +3007,8 @@ static const struct c_omp_directive omp_directives[] = { C_OMP_DIR_CONSTRUCT, true }, /* { "metadirective", nullptr, nullptr, PRAGMA_OMP_METADIRECTIVE, C_OMP_DIR_???, ??? }, */ - /* { "nothing", nullptr, nullptr, PRAGMA_OMP_NOTHING, - C_OMP_DIR_UTILITY, false }, */ + { "nothing", nullptr, nullptr, PRAGMA_OMP_NOTHING, + C_OMP_DIR_UTILITY, false }, /* ordered with depend clause is C_OMP_DIR_STANDALONE. */ { "ordered", nullptr, nullptr, PRAGMA_OMP_ORDERED, C_OMP_DIR_CONSTRUCT, true }, |