From 7a4418a53e80d38918a1f7ca4b8c2050cde08a24 Mon Sep 17 00:00:00 2001 From: Jozef Lawrynowicz Date: Tue, 3 Sep 2019 20:36:49 +0000 Subject: Implement TARGET_HANDLE_GENERIC_ATTRIBUTE gcc/ChangeLog: 2019-09-03 Jozef Lawrynowicz * 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 * 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 --- gcc/config/msp430/msp430.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gcc/config/msp430/msp430.c') 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 %"); + else if (has_attr (ATTR_UPPER, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %"); + else if (has_attr (ATTR_EITHER, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %"); + else if (has_attr (ATTR_PERSIST, *node)) + message = G_("ignoring attribute %qE because it conflicts with " + "attribute %"); + + 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 -- cgit v1.1