aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-attribs.c
diff options
context:
space:
mode:
authorJozef Lawrynowicz <jozef.l@mittosystems.com>2019-09-03 20:36:49 +0000
committerJozef Lawrynowicz <jozefl@gcc.gnu.org>2019-09-03 20:36:49 +0000
commit7a4418a53e80d38918a1f7ca4b8c2050cde08a24 (patch)
tree50812e16fbb96679693af23f3880882336875f3a /gcc/c-family/c-attribs.c
parent52792faa0c8510b7bfc2c184c9f67d4a87f83215 (diff)
downloadgcc-7a4418a53e80d38918a1f7ca4b8c2050cde08a24.zip
gcc-7a4418a53e80d38918a1f7ca4b8c2050cde08a24.tar.gz
gcc-7a4418a53e80d38918a1f7ca4b8c2050cde08a24.tar.bz2
Implement TARGET_HANDLE_GENERIC_ATTRIBUTE
gcc/ChangeLog: 2019-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com> * config/msp430/msp430.c (TARGET_HANDLE_GENERIC_ATTRIBUTE): Define. (msp430_handle_generic_attribute): New function. * doc/tm.texi: Regenerate. * doc/tm.texi.in: Add TARGET_HANDLE_GENERIC_ATTRIBUTE. * hooks.c (hook_tree_treeptr_tree_tree_int_boolptr_null): New. * hooks.h (hook_tree_treeptr_tree_tree_int_boolptr_null): New. * target.def: Define new hook TARGET_HANDLE_GENERIC_ATTRIBUTE. gcc/c-family/ChangeLog: 2019-09-03 Jozef Lawrynowicz <jozef.l@mittosystems.com> * c-attribs.c (handle_section_attribute): Call the handle_generic_attribute target hook after performing target independent processing. (handle_noinit_attribute): Likewise. From-SVN: r275355
Diffstat (limited to 'gcc/c-family/c-attribs.c')
-rw-r--r--gcc/c-family/c-attribs.c39
1 files changed, 29 insertions, 10 deletions
diff --git a/gcc/c-family/c-attribs.c b/gcc/c-family/c-attribs.c
index 820c83f..6500b99 100644
--- a/gcc/c-family/c-attribs.c
+++ b/gcc/c-family/c-attribs.c
@@ -1875,6 +1875,7 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
int ARG_UNUSED (flags), bool *no_add_attrs)
{
tree decl = *node;
+ tree res = NULL_TREE;
if (!targetm_common.have_named_sections)
{
@@ -1922,12 +1923,20 @@ handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args,
goto fail;
}
- set_decl_section_name (decl, TREE_STRING_POINTER (TREE_VALUE (args)));
- return NULL_TREE;
+ res = targetm.handle_generic_attribute (node, name, args, flags,
+ no_add_attrs);
+
+ /* If the back end confirms the attribute can be added then continue onto
+ final processing. */
+ if (!(*no_add_attrs))
+ {
+ set_decl_section_name (decl, TREE_STRING_POINTER (TREE_VALUE (args)));
+ return res;
+ }
fail:
*no_add_attrs = true;
- return NULL_TREE;
+ return res;
}
/* If in c++-11, check if the c++-11 alignment constraint with respect
@@ -2249,6 +2258,7 @@ handle_noinit_attribute (tree * node,
bool *no_add_attrs)
{
const char *message = NULL;
+ tree res = NULL_TREE;
gcc_assert (DECL_P (*node));
gcc_assert (args == NULL);
@@ -2271,14 +2281,23 @@ handle_noinit_attribute (tree * node,
*no_add_attrs = true;
}
else
- /* If this var is thought to be common, then change this. Common
- variables are assigned to sections before the backend has a
- chance to process them. Do this only if the attribute is
- valid. */
- if (DECL_COMMON (*node))
- DECL_COMMON (*node) = 0;
+ {
+ res = targetm.handle_generic_attribute (node, name, args, flags,
+ no_add_attrs);
+ /* If the back end confirms the attribute can be added then continue onto
+ final processing. */
+ if (!(*no_add_attrs))
+ {
+ /* If this var is thought to be common, then change this. Common
+ variables are assigned to sections before the backend has a
+ chance to process them. Do this only if the attribute is
+ valid. */
+ if (DECL_COMMON (*node))
+ DECL_COMMON (*node) = 0;
+ }
+ }
- return NULL_TREE;
+ return res;
}