diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-03-19 20:12:43 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-03-19 20:12:43 +0100 |
commit | 9b65e171edf31cd83fd075f6ed4f3943ebecc505 (patch) | |
tree | f0b46bd92e908bd774e4726f1c69ec6676f54ea5 /gcc | |
parent | 257291fc895a29a88d3d68719e580edcddd9a280 (diff) | |
download | gcc-9b65e171edf31cd83fd075f6ed4f3943ebecc505.zip gcc-9b65e171edf31cd83fd075f6ed4f3943ebecc505.tar.gz gcc-9b65e171edf31cd83fd075f6ed4f3943ebecc505.tar.bz2 |
c-decl.c (c_decl_attributes): Also add "omp declare target" attribute for DECL_EXTERNAL VAR_DECLs.
* 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.
From-SVN: r221520
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 3 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 3 |
4 files changed, 14 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7f429c9..ad5edcf 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2015-03-19 Jakub Jelinek <jakub@redhat.com> + + * c-decl.c (c_decl_attributes): Also add "omp declare target" + attribute for DECL_EXTERNAL VAR_DECLs. + 2015-03-11 Jakub Jelinek <jakub@redhat.com> * c-parser.c (c_parse_init): Don't call xstrdup on get_identifier diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index c140837..e1741f1 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -4407,7 +4407,8 @@ c_decl_attributes (tree *node, tree attributes, int flags) { /* Add implicit "omp declare target" attribute if requested. */ if (current_omp_declare_target_attribute - && ((TREE_CODE (*node) == VAR_DECL && TREE_STATIC (*node)) + && ((TREE_CODE (*node) == VAR_DECL + && (TREE_STATIC (*node) || DECL_EXTERNAL (*node))) || TREE_CODE (*node) == FUNCTION_DECL)) { if (TREE_CODE (*node) == VAR_DECL diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c8135ff..f8ebb2d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-03-19 Jakub Jelinek <jakub@redhat.com> + + * decl2.c (cplus_decl_attributes): Also add "omp declare target" + attribute for DECL_EXTERNAL VAR_DECLs. + 2015-03-18 Paolo Carlini <paolo.carlini@oracle.com> PR c++/65340 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index a2d1eae..989a030 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 |