summaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-19 19:12:43 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-19 19:12:43 +0000
commit1443772f3685beada7aae669875933cb3e8edcde (patch)
treef0b46bd92e908bd774e4726f1c69ec6676f54ea5 /gcc/cp/decl2.c
parentbfdab17df4826ec7cb9874e1e8962e866e5aaeb5 (diff)
downloadgcc-1443772f3685beada7aae669875933cb3e8edcde.tar.gz
* c-decl.c (c_decl_attributes): Also add "omp declare target"
attribute for DECL_EXTERNAL VAR_DECLs. * decl2.c (cplus_decl_attributes): Also add "omp declare target" attribute for DECL_EXTERNAL VAR_DECLs. * testsuite/libgomp.c/target-10.c: New test. * testsuite/libgomp.c++/target-4.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221520 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index a2d1eae2015..989a0303bab 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1440,7 +1440,8 @@ cplus_decl_attributes (tree *decl, tree attributes, int flags)
/* Add implicit "omp declare target" attribute if requested. */
if (scope_chain->omp_declare_target_attribute
- && ((TREE_CODE (*decl) == VAR_DECL && TREE_STATIC (*decl))
+ && ((TREE_CODE (*decl) == VAR_DECL
+ && (TREE_STATIC (*decl) || DECL_EXTERNAL (*decl)))
|| TREE_CODE (*decl) == FUNCTION_DECL))
{
if (TREE_CODE (*decl) == VAR_DECL