Commit 94e7f906 by Jakub Jelinek Committed by Jakub Jelinek

c-common.h (c_omp_check_context_selector, [...]): Declare.

c-family/
	* c-common.h (c_omp_check_context_selector,
	c_omp_get_context_selector): Declare.
	* c-omp.c (c_omp_declare_simd_clauses_to_numbers): Fix spelling
	in diagnostic message.
	(c_omp_check_context_selector, c_omp_get_context_selector): New
	functions.
	* c-attribs.c (c_common_attribute_table): Add "omp declare variant"
	attribute.
	(handle_omp_declare_variant_attribute): New function.
c/
	* c-parser.c (c_parser_omp_all_clauses): Add NESTED_P argument, if
	true, terminate processing on closing paren and don't skip to end of
	pragma line.
	(c_parser_omp_declare_simd): Handle also declare variant.
	(omp_construct_selectors, omp_device_selectors,
	omp_implementation_selectors, omp_user_selectors): New variables.
	(c_parser_omp_context_selector,
	c_parser_omp_context_selector_specification,
	c_finish_omp_declare_variant): New functions.
	(c_finish_omp_declare_simd): Handle both declare simd and
	declare variant.
	(c_parser_omp_declare): Handle declare variant.
cp/
	* parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
	* parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
	and declare variant.
	(cp_parser_oacc_all_clauses): Formatting fix.
	(cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
	processing on closing paren and don't skip to end of pragma line.
	(cp_parser_omp_declare_simd): Add VARIANT_P argument.  Handle also
	declare variant.
	(omp_construct_selectors, omp_device_selectors,
	omp_implementation_selectors, omp_user_selectors): New variables.
	(cp_parser_omp_context_selector,
	cp_parser_omp_context_selector_specification,
	cp_finish_omp_declare_variant): New functions.
	(cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
	(cp_parser_omp_declare): Handle declare variant.
testsuite/
	* c-c++-common/gomp/declare-variant-1.c: New test.
	* c-c++-common/gomp/declare-variant-2.c: New test.
	* c-c++-common/gomp/declare-variant-3.c: New test.
	* g++.dg/gomp/this-1.C: Adjust for diagnostic message spelling fix.
	* gcc.dg/gomp/declare-variant-1.c: New test.
	* gcc.dg/gomp/declare-variant-2.c: New test.

From-SVN: r276789
parent 6ea20bd0
2019-10-10 Jakub Jelinek <jakub@redhat.com>
* c-common.h (c_omp_check_context_selector,
c_omp_get_context_selector): Declare.
* c-omp.c (c_omp_declare_simd_clauses_to_numbers): Fix spelling
in diagnostic message.
(c_omp_check_context_selector, c_omp_get_context_selector): New
functions.
* c-attribs.c (c_common_attribute_table): Add "omp declare variant"
attribute.
(handle_omp_declare_variant_attribute): New function.
2019-10-09 Martin Sebor <msebor@redhat.com>
PR tree-optimization/90879
......
......@@ -140,6 +140,8 @@ static tree handle_warn_unused_attribute (tree *, tree, tree, int, bool *);
static tree handle_returns_nonnull_attribute (tree *, tree, tree, int, bool *);
static tree handle_omp_declare_simd_attribute (tree *, tree, tree, int,
bool *);
static tree handle_omp_declare_variant_attribute (tree *, tree, tree, int,
bool *);
static tree handle_simd_attribute (tree *, tree, tree, int, bool *);
static tree handle_omp_declare_target_attribute (tree *, tree, tree, int,
bool *);
......@@ -442,6 +444,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_returns_nonnull_attribute, NULL },
{ "omp declare simd", 0, -1, true, false, false, false,
handle_omp_declare_simd_attribute, NULL },
{ "omp declare variant", 0, -1, true, false, false, false,
handle_omp_declare_variant_attribute, NULL },
{ "simd", 0, 1, true, false, false, false,
handle_simd_attribute, NULL },
{ "omp declare target", 0, -1, true, false, false, false,
......@@ -3064,6 +3068,15 @@ handle_omp_declare_simd_attribute (tree *, tree, tree, int, bool *)
return NULL_TREE;
}
/* Handle an "omp declare variant" attribute; arguments as in
struct attribute_spec.handler. */
static tree
handle_omp_declare_variant_attribute (tree *, tree, tree, int, bool *)
{
return NULL_TREE;
}
/* Handle a "simd" attribute. */
static tree
......
......@@ -1189,6 +1189,8 @@ extern tree c_omp_declare_simd_clauses_to_numbers (tree, tree);
extern void c_omp_declare_simd_clauses_to_decls (tree, tree);
extern bool c_omp_predefined_variable (tree);
extern enum omp_clause_default_kind c_omp_predetermined_sharing (tree);
extern tree c_omp_check_context_selector (location_t, tree);
extern tree c_omp_get_context_selector (tree, const char *, const char *);
/* Return next tree in the chain for chain_next walking of tree nodes. */
static inline tree
......
......@@ -2011,7 +2011,7 @@ c_omp_declare_simd_clauses_to_numbers (tree parms, tree clauses)
if (arg == NULL_TREE)
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD is not an function argument", decl);
"%qD is not a function argument", decl);
continue;
}
OMP_CLAUSE_DECL (c) = build_int_cst (integer_type_node, idx);
......@@ -2026,7 +2026,7 @@ c_omp_declare_simd_clauses_to_numbers (tree parms, tree clauses)
if (arg == NULL_TREE)
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD is not an function argument", decl);
"%qD is not a function argument", decl);
continue;
}
OMP_CLAUSE_LINEAR_STEP (c)
......@@ -2120,3 +2120,133 @@ c_omp_predetermined_sharing (tree decl)
return OMP_CLAUSE_DEFAULT_UNSPECIFIED;
}
/* Diagnose errors in an OpenMP context selector, return CTX if
it is correct or error_mark_node otherwise. */
tree
c_omp_check_context_selector (location_t loc, tree ctx)
{
/* Each trait-set-selector-name can only be specified once.
There are just 4 set names. */
for (tree t1 = ctx; t1; t1 = TREE_CHAIN (t1))
for (tree t2 = TREE_CHAIN (t1); t2; t2 = TREE_CHAIN (t2))
if (TREE_PURPOSE (t1) == TREE_PURPOSE (t2))
{
error_at (loc, "selector set %qs specified more than once",
IDENTIFIER_POINTER (TREE_PURPOSE (t1)));
return error_mark_node;
}
for (tree t = ctx; t; t = TREE_CHAIN (t))
{
/* Each trait-selector-name can only be specified once. */
if (list_length (TREE_VALUE (t)) < 5)
{
for (tree t1 = TREE_VALUE (t); t1; t1 = TREE_CHAIN (t1))
for (tree t2 = TREE_CHAIN (t1); t2; t2 = TREE_CHAIN (t2))
if (TREE_PURPOSE (t1) == TREE_PURPOSE (t2))
{
error_at (loc,
"selector %qs specified more than once in set %qs",
IDENTIFIER_POINTER (TREE_PURPOSE (t1)),
IDENTIFIER_POINTER (TREE_PURPOSE (t)));
return error_mark_node;
}
}
else
{
hash_set<tree> pset;
for (tree t1 = TREE_VALUE (t); t1; t1 = TREE_CHAIN (t1))
if (pset.add (TREE_PURPOSE (t1)))
{
error_at (loc,
"selector %qs specified more than once in set %qs",
IDENTIFIER_POINTER (TREE_PURPOSE (t1)),
IDENTIFIER_POINTER (TREE_PURPOSE (t)));
return error_mark_node;
}
}
static const char *const kind[] = {
"host", "nohost", "cpu", "gpu", "fpga", "any", NULL };
static const char *const vendor[] = {
"amd", "arm", "bsc", "cray", "fujitsu", "gnu", "ibm", "intel",
"llvm", "pgi", "ti", "unknown", NULL };
static const char *const extension[] = { NULL };
static const char *const atomic_default_mem_order[] = {
"seq_cst", "relaxed", "acq_rel", NULL };
struct known_properties { const char *set; const char *selector;
const char *const *props; };
known_properties props[] = {
{ "device", "kind", kind },
{ "implementation", "vendor", vendor },
{ "implementation", "extension", extension },
{ "implementation", "atomic_default_mem_order",
atomic_default_mem_order } };
for (tree t1 = TREE_VALUE (t); t1; t1 = TREE_CHAIN (t1))
for (unsigned i = 0; i < ARRAY_SIZE (props); i++)
if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t1)),
props[i].selector)
&& !strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t)),
props[i].set))
for (tree t2 = TREE_VALUE (t1); t2; t2 = TREE_CHAIN (t2))
for (unsigned j = 0; ; j++)
{
if (props[i].props[j] == NULL)
{
if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
" score"))
break;
if (props[i].props == atomic_default_mem_order)
{
error_at (loc,
"incorrect property %qs of %qs selector",
IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
"atomic_default_mem_order");
return error_mark_node;
}
else
warning_at (loc, 0,
"unknown property %qs of %qs selector",
IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
props[i].selector);
break;
}
else if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t2)),
props[i].props[j]))
{
if (props[i].props == atomic_default_mem_order
&& t2 != TREE_VALUE (t1))
{
tree t3 = TREE_VALUE (t1);
if (!strcmp (IDENTIFIER_POINTER (TREE_PURPOSE (t3)),
" score")
&& t2 == TREE_CHAIN (TREE_VALUE (t1)))
break;
error_at (loc,
"%qs selector must have a single property",
"atomic_default_mem_order");
return error_mark_node;
}
break;
}
}
}
return ctx;
}
/* From context selector CTX, return trait-selector with name SEL in
trait-selector-set with name SET if any, or NULL_TREE if not found. */
tree
c_omp_get_context_selector (tree ctx, const char *set, const char *sel)
{
tree setid = get_identifier (set);
tree selid = get_identifier (sel);
for (tree t1 = ctx; t1; t1 = TREE_CHAIN (t1))
if (TREE_PURPOSE (t1) == setid)
for (tree t2 = TREE_VALUE (t1); t2; t2 = TREE_CHAIN (t2))
if (TREE_PURPOSE (t2) == selid)
return t2;
return NULL_TREE;
}
2019-10-10 Jakub Jelinek <jakub@redhat.com>
* c-parser.c (c_parser_omp_all_clauses): Add NESTED_P argument, if
true, terminate processing on closing paren and don't skip to end of
pragma line.
(c_parser_omp_declare_simd): Handle also declare variant.
(omp_construct_selectors, omp_device_selectors,
omp_implementation_selectors, omp_user_selectors): New variables.
(c_parser_omp_context_selector,
c_parser_omp_context_selector_specification,
c_finish_omp_declare_variant): New functions.
(c_finish_omp_declare_simd): Handle both declare simd and
declare variant.
(c_parser_omp_declare): Handle declare variant.
2019-10-02 Joseph Myers <joseph@codesourcery.com>
* c-parser.c (c_parser_asm_statement): Handle CPP_SCOPE like two
......
2019-10-10 Jakub Jelinek <jakub@redhat.com>
* parser.h (struct cp_omp_declare_simd_data): Add variant_p member.
* parser.c (cp_ensure_no_omp_declare_simd): Handle both declare simd
and declare variant.
(cp_parser_oacc_all_clauses): Formatting fix.
(cp_parser_omp_all_clauses): Add NESTED_P argument, if true, terminate
processing on closing paren and don't skip to end of pragma line.
(cp_parser_omp_declare_simd): Add VARIANT_P argument. Handle also
declare variant.
(omp_construct_selectors, omp_device_selectors,
omp_implementation_selectors, omp_user_selectors): New variables.
(cp_parser_omp_context_selector,
cp_parser_omp_context_selector_specification,
cp_finish_omp_declare_variant): New functions.
(cp_parser_late_parsing_omp_declare_simd): Handle also declare variant.
(cp_parser_omp_declare): Handle declare variant.
2019-10-09 Jason Merrill <jason@redhat.com>
* cp-tree.h (template_info_decl_check): Check ENABLE_TREE_CHECKING.
......
......@@ -202,10 +202,11 @@ struct GTY (()) cp_parser_context {
};
/* Helper data structure for parsing #pragma omp declare simd. */
/* Helper data structure for parsing #pragma omp declare {simd,variant}. */
struct cp_omp_declare_simd_data {
bool error_seen; /* Set if error has been reported. */
bool fndecl_seen; /* Set if one fn decl/definition has been seen already. */
bool variant_p; /* Set for #pragma omp declare variant. */
vec<cp_token_cache_ptr> tokens;
tree clauses;
};
......
2019-10-10 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/gomp/declare-variant-1.c: New test.
* c-c++-common/gomp/declare-variant-2.c: New test.
* c-c++-common/gomp/declare-variant-3.c: New test.
* g++.dg/gomp/this-1.C: Adjust for diagnostic message spelling fix.
* gcc.dg/gomp/declare-variant-1.c: New test.
* gcc.dg/gomp/declare-variant-2.c: New test.
2019-10-09 Martin Sebor <msebor@redhat.com>
PR tree-optimization/90879
......
int foo (int, int, int *);
int bar (int, int, int *);
#pragma omp declare variant (foo) \
match (construct={parallel,for},\
device={isa(avx512f,avx512vl),kind(host,cpu)},\
implementation={vendor(score(0):gnu),unified_shared_memory},\
user={condition(score(0):0)})
#pragma omp declare variant (bar) \
match (device={arch(x86_64,powerpc64),isa(avx512f,popcntb)}, \
implementation={atomic_default_mem_order(seq_cst),made_up_selector("foo", 13, "bar")}, \
user={condition(3-3)})
int baz (int, int, int *);
int
qux (void)
{
int i = 3;
return baz (1, 2, &i);
}
int quux (int);
void
corge (void)
{
int i;
#pragma omp declare variant (quux) match (construct={parallel,for})
extern int waldo (int);
waldo (5);
#pragma omp parallel for
for (i = 0; i < 3; i++)
waldo (6);
#pragma omp parallel
#pragma omp taskgroup
#pragma omp for
for (i = 0; i < 3; i++)
waldo (7);
#pragma omp parallel
#pragma omp master
waldo (8);
}
#pragma omp declare variant (bar) match \
(implementation={atomic_default_mem_order(relaxed), \
unified_address, unified_shared_memory, \
dynamic_allocators, reverse_offload})
int baz2 (int x, int y, int *z)
{
return x + y + *z;
}
#pragma omp declare variant (bar) match \
(implementation={atomic_default_mem_order(score(3): acq_rel)})
int baz3 (int, int, int *);
void f1 (void);
#pragma omp declare variant (f1) match (construct={target})
void f2 (void);
void f3 (void);
#pragma omp declare variant (f3) match (construct={teams})
void f4 (void);
void f5 (void);
#pragma omp declare variant (f5) match (construct={parallel})
void f6 (void);
void f7 (void);
#pragma omp declare variant (f7) match (construct={for})
void f8 (void);
void f9 (void);
#pragma omp declare variant (f9) match (construct={target,teams,parallel,for})
void f10 (void);
void f11 (void);
#pragma omp declare variant (f11) match (construct={teams,for,parallel})
void f12 (void);
void f13 (void);
#pragma omp declare variant (f13) match (device={kind(any)})
void f14 (void);
#pragma omp declare variant (f13) match (device={kind(host)})
void f15 (void);
#pragma omp declare variant (f13) match (device={kind(nohost)})
void f16 (void);
#pragma omp declare variant (f13) match (device={kind(cpu)})
void f17 (void);
#pragma omp declare variant (f13) match (device={kind(gpu)})
void f18 (void);
#pragma omp declare variant (f13) match (device={kind(fpga)})
void f19 (void);
#pragma omp declare variant (f13) match (device={kind(any,any)})
void f20 (void);
#pragma omp declare variant (f13) match (device={kind(host,nohost)})
void f21 (void);
#pragma omp declare variant (f13) match (device={kind(cpu,gpu,fpga)})
void f22 (void);
#pragma omp declare variant (f13) match (device={kind(any,cpu,nohost)})
void f23 (void);
#pragma omp declare variant (f13) match (device={isa(avx)})
void f24 (void);
#pragma omp declare variant (f13) match (device={isa(sse4,avx512f,avx512vl,avx512bw)})
void f25 (void);
#pragma omp declare variant (f13) match (device={arch(x86_64)})
void f26 (void);
#pragma omp declare variant (f13) match (device={arch(riscv64)})
void f27 (void);
#pragma omp declare variant (f13) match (device={arch(nvptx)})
void f28 (void);
#pragma omp declare variant (f13) match (device={arch(x86_64),isa(avx512f,avx512vl),kind(cpu)})
void f29 (void);
#pragma omp declare variant (f13) match (implementation={vendor(amd)})
void f30 (void);
#pragma omp declare variant (f13) match (implementation={vendor(arm)})
void f31 (void);
#pragma omp declare variant (f13) match (implementation={vendor(bsc)})
void f32 (void);
#pragma omp declare variant (f13) match (implementation={vendor(cray)})
void f33 (void);
#pragma omp declare variant (f13) match (implementation={vendor(fujitsu)})
void f34 (void);
#pragma omp declare variant (f13) match (implementation={vendor(gnu)})
void f35 (void);
#pragma omp declare variant (f13) match (implementation={vendor(ibm)})
void f36 (void);
#pragma omp declare variant (f13) match (implementation={vendor(intel)})
void f37 (void);
#pragma omp declare variant (f13) match (implementation={vendor(llvm)})
void f38 (void);
#pragma omp declare variant (f13) match (implementation={vendor(pgi)})
void f39 (void);
#pragma omp declare variant (f13) match (implementation={vendor(ti)})
void f40 (void);
#pragma omp declare variant (f13) match (implementation={vendor(unknown)})
void f41 (void);
#pragma omp declare variant (f13) match (implementation={vendor(gnu,llvm,intel,ibm)})
void f42 (void);
#pragma omp declare variant (f13) match (implementation={extension(my_cute_extension)}) /* { dg-warning "unknown property 'my_cute_extension' of 'extension' selector" } */
void f43 (void);
#pragma omp declare variant (f13) match (implementation={extension(some_other_ext,another_ext)}) /* { dg-warning "unknown property 'some_other_ext' of 'extension' selector" } */
void f44 (void); /* { dg-warning "unknown property 'another_ext' of 'extension' selector" "" { target *-*-* } .-1 } */
#pragma omp declare variant (f13) match (implementation={unified_shared_memory})
void f45 (void);
#pragma omp declare variant (f13) match (implementation={unified_address})
void f46 (void);
#pragma omp declare variant (f13) match (implementation={dynamic_allocators})
void f47 (void);
#pragma omp declare variant (f13) match (implementation={reverse_offload})
void f48 (void);
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(seq_cst)})
void f49 (void);
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(relaxed)})
void f50 (void);
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(acq_rel)})
void f51 (void);
#pragma omp declare variant (f14) match (implementation={atomic_default_mem_order(acq_rel),vendor(gnu),unified_address,extension(foobar)}) /* { dg-warning "unknown property 'foobar' of 'extension' selector" } */
void f52 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(3):amd)})
void f53 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(4):arm)})
void f54 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(5):bsc)})
void f55 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(6):cray)})
void f56 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(7):fujitsu)})
void f57 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(8):gnu)})
void f58 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(9):ibm)})
void f59 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(10):intel)})
void f60 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(11):llvm)})
void f61 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(12):pgi)})
void f62 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(13):ti)})
void f63 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(14):unknown)})
void f64 (void);
#pragma omp declare variant (f13) match (implementation={vendor(score(15):gnu,llvm,intel,ibm)})
void f65 (void);
#pragma omp declare variant (f13) match (implementation={extension(score(16):my_cute_extension)}) /* { dg-warning "unknown property 'my_cute_extension' of 'extension' selector" } */
void f66 (void);
#pragma omp declare variant (f13) match (implementation={extension(score(17):some_other_ext,another_ext)}) /* { dg-warning "unknown property 'some_other_ext' of 'extension' selector" } */
void f67 (void); /* { dg-warning "unknown property 'another_ext' of 'extension' selector" "" { target *-*-* } .-1 } */
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(score(18):seq_cst)})
void f68 (void);
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(score(19):relaxed)})
void f69 (void);
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(score(20):acq_rel)})
void f70 (void);
#pragma omp declare variant (f13) match (implementation={atomic_default_mem_order(score(21):acq_rel),vendor(score(22):gnu),unified_address,extension(score(22):foobar)}) /* { dg-warning "unknown property 'foobar' of 'extension' selector" } */
void f71 (void);
#pragma omp declare variant (f13) match (user={condition(0)})
void f72 (void);
#pragma omp declare variant (f13) match (user={condition(272-272*1)})
void f73 (void);
#pragma omp declare variant (f13) match (user={condition(score(25):1)})
void f74 (void);
......@@ -3,7 +3,7 @@
struct S
{
#pragma omp declare simd linear(this) // { dg-error "is not an function argument" }
#pragma omp declare simd linear(this) // { dg-error "is not a function argument" }
static void foo ();
void bar ();
};
......@@ -35,7 +35,7 @@ S::bar ()
template <int N>
struct T
{
#pragma omp declare simd linear(this) // { dg-error "is not an function argument" }
#pragma omp declare simd linear(this) // { dg-error "is not a function argument" }
static void foo ();
void bar ();
};
......
/* Test parsing of #pragma omp declare variant */
/* { dg-do compile } */
int fn0 (int);
int fn6 (int);
#pragma omp declare variant (fn0) match (user={condition(0)})
int a; /* { dg-error "not immediately followed by a function declaration or definition" } */
#pragma omp declare variant (fn0) match (user={condition(0)})
int fn1 (int a), fn2 (int a); /* { dg-error "not immediately followed by a single function declaration or definition" } */
#pragma omp declare variant (fn0) match (user={condition(0)})
int b, fn3 (int a); /* { dg-error "not immediately followed by a function declaration or definition" } */
#pragma omp declare variant (fn0) match (user={condition(0)})
int fn4 (int a), c; /* { dg-error "not immediately followed by a function declaration or definition" } */
int t;
#pragma omp declare variant (fn0) match (user={condition(0)})
#pragma omp declare variant (fn6) match (implementation={vendor(unknown)})
#pragma omp threadprivate(t) /* { dg-error "must be followed by function declaration or definition or another" } */
int fn5 (int a);
#pragma omp declare variant (1 + 2) match (user={condition(0)}) /* { dg-error "expected identifier before numeric constant" } */
int fn7 (int);
#pragma omp declare variant (t) match (user={condition(0)}) /* { dg-error "variant 't' is not a function" } */
int fn8 (int);
long fn9 (char, short);
#pragma omp declare variant (fn9) match (implementation={vendor(unknown)}) /* { dg-error "variant 'fn9' and base 'fn10' have incompatible types" } */
int fn10 (int, long long);
#pragma omp declare variant (memcpy) match (implementation={vendor(llvm)}) /* { dg-error "'memcpy' undeclared here" } */
void *fn11 (void *, const void *, __SIZE_TYPE__);
#pragma omp declare variant (__builtin_memmove) match (implementation={vendor(gnu)}) /* { dg-error "variant '__builtin_memmove' is a built-in" } */
void *fn12 (void *, const void *, __SIZE_TYPE__);
/* Test parsing of #pragma omp declare variant */
/* { dg-do compile } */
int f0 (int, int *, int);
int
f1 (int x)
{
if (x)
#pragma omp declare variant (fn0) match (user={condition(0)})
extern int f3 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
while (x < 10)
#pragma omp declare variant (fn0) match (user={condition(0)})
extern int f4 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
{
lab:
#pragma omp declare variant (fn0) match (user={condition(0)})
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
x++; /* { dg-error "expected expression before" "" { target *-*-* } .-1 } */
}
return x;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment