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 },
{ "depobj", PRAGMA_OMP_DEPOBJ },
{ "end", PRAGMA_OMP_END_DECLARE_TARGET },
{ "flush", PRAGMA_OMP_FLUSH },
+ { "nothing", PRAGMA_OMP_NOTHING },
{ "requires", PRAGMA_OMP_REQUIRES },
{ "scope", PRAGMA_OMP_SCOPE },
{ "section", PRAGMA_OMP_SECTION },
PRAGMA_OMP_FLUSH,
PRAGMA_OMP_FOR,
PRAGMA_OMP_LOOP,
+ PRAGMA_OMP_NOTHING,
PRAGMA_OMP_MASKED,
PRAGMA_OMP_MASTER,
PRAGMA_OMP_ORDERED,
static void c_parser_omp_taskwait (c_parser *);
static void c_parser_omp_taskyield (c_parser *);
static void c_parser_omp_cancel (c_parser *);
+static void c_parser_omp_nothing (c_parser *);
enum pragma_context { pragma_external, pragma_struct, pragma_param,
pragma_stmt, pragma_compound };
c_parser_omp_requires (parser);
return false;
+ case PRAGMA_OMP_NOTHING:
+ c_parser_omp_nothing (parser);
+ return false;
+
case PRAGMA_OMP_ORDERED:
return c_parser_omp_ordered (parser, context, if_p);
return ret;
}
+/* OpenMP 5.1
+ #pragma omp nothing new-line */
+
+static void
+c_parser_omp_nothing (c_parser *parser)
+{
+ c_parser_consume_pragma (parser);
+ c_parser_skip_to_pragma_eol (parser);
+}
+
/* Main entry point to parsing most OpenMP pragmas. */
static void
}
+/* OpenMP 5.1:
+ #pragma omp nothing new-line */
+
+static void
+cp_parser_omp_nothing (cp_parser *parser, cp_token *pragma_tok)
+{
+ cp_parser_skip_to_pragma_eol (parser, pragma_tok);
+}
+
+
/* OpenMP 4.5:
#pragma omp taskloop taskloop-clause[optseq] new-line
for-loop
}
return cp_parser_omp_requires (parser, pragma_tok);
+ case PRAGMA_OMP_NOTHING:
+ cp_parser_omp_nothing (parser, pragma_tok);
+ return false;
+
case PRAGMA_OMP_ORDERED:
if (context != pragma_stmt && context != pragma_compound)
goto bad_stmt;
--- /dev/null
+#pragma omp nothing
+
+struct S
+{
+ #pragma omp nothing
+ int s;
+};
+
+int
+foo (int i)
+{
+ #pragma omp nothing
+ if (0)
+ #pragma omp nothing
+ i++;
+ if (1)
+ ;
+ else
+ #pragma omp nothing
+ i++;
+ switch (0)
+ #pragma omp nothing
+ {
+ default:
+ break;
+ }
+ while (0)
+ #pragma omp nothing
+ i++;
+ for (; 0;)
+ #pragma omp nothing
+ i++;
+ lab:
+ #pragma omp nothing
+ i++;
+ return i;
+}
bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm)
{
+ [[omp::directive (nothing)]];
[[omp::directive (for simd
private (p) firstprivate (f) lastprivate (l) linear (ll:1) reduction(+:r) schedule(static, 4) collapse(1) nowait
safelen(8) simdlen(4) aligned(q: 32) nontemporal(ntm) if(i1) order(concurrent) allocate (f))]]
bar (int d, int m, int i1, int i2, int i3, int p, int *idp, int s,
int nte, int tl, int nth, int g, int nta, int fi, int pp, int *q, int *dd, int ntm)
{
+ [[omp::directive (nothing)]];
[[omp::directive (for simd,
private (p),firstprivate (f),lastprivate (l),linear (ll:1),reduction(+:r),schedule(static, 4),collapse(1),nowait,
safelen(8),simdlen(4),aligned(q: 32),nontemporal(ntm),if(i1),order(concurrent),allocate (f))]]
int d;
[[omp::directive (end declare target)]];
[[omp::directive (end declare target)]];
+[[omp::directive (nothing)]];
--- /dev/null
+#include <stdlib.h>
+
+#pragma omp nothing
+
+struct S
+{
+ #pragma omp nothing
+ int s;
+};
+
+int
+foo (int i)
+{
+ #pragma omp nothing
+ if (0)
+ #pragma omp nothing
+ i++;
+ if (1)
+ ;
+ else
+ #pragma omp nothing
+ i++;
+ switch (0)
+ #pragma omp nothing
+ {
+ default:
+ break;
+ }
+ while (0)
+ #pragma omp nothing
+ i++;
+ for (; 0;)
+ #pragma omp nothing
+ i++;
+ lab:
+ #pragma omp nothing
+ i++;
+ return i;
+}
+
+int
+main ()
+{
+ if (foo (5) != 6 || foo (-2) != -1)
+ abort ();
+ return 0;
+}