diff options
author | Jozef Lawrynowicz <jozef.l@mittosystems.com> | 2019-09-03 20:36:49 +0000 |
---|---|---|
committer | Jozef Lawrynowicz <jozefl@gcc.gnu.org> | 2019-09-03 20:36:49 +0000 |
commit | 7a4418a53e80d38918a1f7ca4b8c2050cde08a24 (patch) | |
tree | 50812e16fbb96679693af23f3880882336875f3a /gcc/config/msp430/msp430.c | |
parent | 52792faa0c8510b7bfc2c184c9f67d4a87f83215 (diff) | |
download | gcc-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/config/msp430/msp430.c')
-rw-r--r-- | gcc/config/msp430/msp430.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c index c5cf704..1e61075 100644 --- a/gcc/config/msp430/msp430.c +++ b/gcc/config/msp430/msp430.c @@ -1518,6 +1518,46 @@ const struct attribute_spec msp430_attribute_table[] = { NULL, 0, 0, false, false, false, false, NULL, NULL } }; +#undef TARGET_HANDLE_GENERIC_ATTRIBUTE +#define TARGET_HANDLE_GENERIC_ATTRIBUTE msp430_handle_generic_attribute + +tree +msp430_handle_generic_attribute (tree *node, + tree name, + tree args ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED, + bool *no_add_attrs) + +{ + const char *message = NULL; + + if (!(TREE_NAME_EQ (name, ATTR_NOINIT) || TREE_NAME_EQ (name, "section"))) + return NULL_TREE; + + /* The front end has set up an exclusion between the "noinit" and "section" + attributes. */ + if (has_attr (ATTR_LOWER, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %<lower%>"); + else if (has_attr (ATTR_UPPER, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %<upper%>"); + else if (has_attr (ATTR_EITHER, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %<either%>"); + else if (has_attr (ATTR_PERSIST, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %<persistent%>"); + + if (message) + { + warning (OPT_Wattributes, message, name); + *no_add_attrs = true; + } + + return NULL_TREE; +} + #undef TARGET_ASM_FUNCTION_PROLOGUE #define TARGET_ASM_FUNCTION_PROLOGUE msp430_start_function |