Hi, This patch replaces ARG_UNUSED and ATTRIBUTE_UNUSED with unnamed parameters. As the unused attribute was being used incorrectly.
Bootstrapped and regression tested on x86_64-linux-gnu, and committed to master. Regards Iain gcc/d/ChangeLog: * d-attribs.cc (handle_noreturn_attribute): Remove names of unused function parameters. (handle_leaf_attribute): Likewise. (handle_const_attribute): Likewise. (handle_malloc_attribute): Likewise. (handle_pure_attribute): Likewise. (handle_novops_attribute): Likewise. (handle_nonnull_attribute): Likewise. (handle_nothrow_attribute): Likewise. (handle_type_generic_attribute): Likewise. (handle_transaction_pure_attribute): Likewise. (handle_returns_twice_attribute): Likewise. (handle_fnspec_attribute): Likewise. (handle_always_inline_attribute): Likewise. (d_handle_noinline_attribute): Likewise. (d_handle_forceinline_attribute): Likewise. (d_handle_flatten_attribute): Likewise. (d_handle_noclone_attribute): Likewise. (d_handle_section_attribute): Likewise. (d_handle_alias_attribute): Likewise. (d_handle_weak_attribute): Likewise. --- gcc/d/d-attribs.cc | 96 +++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 65 deletions(-) diff --git a/gcc/d/d-attribs.cc b/gcc/d/d-attribs.cc index 31137957c46..964f59f96f4 100644 --- a/gcc/d/d-attribs.cc +++ b/gcc/d/d-attribs.cc @@ -344,15 +344,15 @@ apply_user_attributes (Dsymbol *sym, tree node) input_location = saved_location; } -/* Built-in attribute handlers. */ +/* Built-in attribute handlers. + These functions take the arguments: + (tree *node, tree name, tree args, int flags, bool *no_add_attrs) */ /* Handle a "noreturn" attribute; arguments as in struct attribute_spec.handler. */ static tree -handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_noreturn_attribute (tree *node, tree, tree, int, bool *) { tree type = TREE_TYPE (*node); @@ -374,9 +374,7 @@ handle_noreturn_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ static tree -handle_leaf_attribute (tree *node, tree name, - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), bool *no_add_attrs) +handle_leaf_attribute (tree *node, tree name, tree, int, bool *no_add_attrs) { if (TREE_CODE (*node) != FUNCTION_DECL) { @@ -396,9 +394,7 @@ handle_leaf_attribute (tree *node, tree name, struct attribute_spec.handler. */ static tree -handle_const_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_const_attribute (tree *node, tree, tree, int, bool *) { tree type = TREE_TYPE (*node); @@ -420,9 +416,7 @@ handle_const_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ tree -handle_malloc_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_malloc_attribute (tree *node, tree, tree, int, bool *) { gcc_assert (TREE_CODE (*node) == FUNCTION_DECL && POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (*node)))); @@ -434,9 +428,7 @@ handle_malloc_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ static tree -handle_pure_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_pure_attribute (tree *node, tree, tree, int, bool *) { gcc_assert (TREE_CODE (*node) == FUNCTION_DECL); DECL_PURE_P (*node) = 1; @@ -447,9 +439,7 @@ handle_pure_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ static tree -handle_novops_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_novops_attribute (tree *node, tree, tree, int, bool *) { gcc_assert (TREE_CODE (*node) == FUNCTION_DECL); DECL_IS_NOVOPS (*node) = 1; @@ -473,9 +463,7 @@ get_nonnull_operand (tree arg_num_expr, unsigned HOST_WIDE_INT *valp) /* Handle the "nonnull" attribute. */ static tree -handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), - tree args, int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_nonnull_attribute (tree *node, tree, tree args, int, bool *) { tree type = *node; @@ -525,9 +513,7 @@ handle_nonnull_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ static tree -handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_nothrow_attribute (tree *node, tree, tree, int, bool *) { gcc_assert (TREE_CODE (*node) == FUNCTION_DECL); TREE_NOTHROW (*node) = 1; @@ -537,9 +523,7 @@ handle_nothrow_attribute (tree *node, tree ARG_UNUSED (name), /* Handle a "type_generic" attribute. */ static tree -handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_type_generic_attribute (tree *node, tree, tree, int, bool *) { /* Ensure we have a function type. */ gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE); @@ -553,10 +537,7 @@ handle_type_generic_attribute (tree *node, tree ARG_UNUSED (name), /* Handle a "transaction_pure" attribute. */ static tree -handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_transaction_pure_attribute (tree *node, tree, tree, int, bool *) { /* Ensure we have a function type. */ gcc_assert (TREE_CODE (*node) == FUNCTION_TYPE); @@ -567,10 +548,7 @@ handle_transaction_pure_attribute (tree *node, tree ARG_UNUSED (name), /* Handle a "returns_twice" attribute. */ static tree -handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +handle_returns_twice_attribute (tree *node, tree, tree, int, bool *) { gcc_assert (TREE_CODE (*node) == FUNCTION_DECL); @@ -583,9 +561,7 @@ handle_returns_twice_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ tree -handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name), - tree args, int ARG_UNUSED (flags), - bool *no_add_attrs ATTRIBUTE_UNUSED) +handle_fnspec_attribute (tree *, tree, tree args, int, bool *) { gcc_assert (args && TREE_CODE (TREE_VALUE (args)) == STRING_CST @@ -597,23 +573,22 @@ handle_fnspec_attribute (tree *node ATTRIBUTE_UNUSED, tree ARG_UNUSED (name), struct attribute_spec.handler. */ static tree -handle_always_inline_attribute (tree *node, tree ARG_UNUSED (name), - tree ARG_UNUSED (args), int ARG_UNUSED (flags), - bool *no_add_attrs ATTRIBUTE_UNUSED) +handle_always_inline_attribute (tree *node, tree, tree, int, bool *) { gcc_assert (TREE_CODE (*node) == FUNCTION_DECL); return NULL_TREE; } -/* Language specific attribute handlers. */ +/* Language specific attribute handlers. + These functions take the arguments: + (tree *node, tree name, tree args, int flags, bool *no_add_attrs) */ /* Handle a "noinline" attribute. */ static tree -d_handle_noinline_attribute (tree *node, tree name, - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), bool *no_add_attrs) +d_handle_noinline_attribute (tree *node, tree name, tree, int, + bool *no_add_attrs) { Type *t = TYPE_LANG_FRONTEND (TREE_TYPE (*node)); @@ -631,9 +606,7 @@ d_handle_noinline_attribute (tree *node, tree name, /* Handle a "forceinline" attribute. */ static tree -d_handle_forceinline_attribute (tree *node, tree name, - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), +d_handle_forceinline_attribute (tree *node, tree name, tree, int, bool *no_add_attrs) { Type *t = TYPE_LANG_FRONTEND (TREE_TYPE (*node)); @@ -663,9 +636,8 @@ d_handle_forceinline_attribute (tree *node, tree name, /* Handle a "flatten" attribute. */ static tree -d_handle_flatten_attribute (tree *node, tree name, - tree args ATTRIBUTE_UNUSED, - int flags ATTRIBUTE_UNUSED, bool *no_add_attrs) +d_handle_flatten_attribute (tree *node, tree name, tree, int, + bool *no_add_attrs) { Type *t = TYPE_LANG_FRONTEND (TREE_TYPE (*node)); @@ -701,10 +673,8 @@ d_handle_target_attribute (tree *node, tree name, tree args, int flags, /* Handle a "noclone" attribute. */ static tree -d_handle_noclone_attribute (tree *node, tree name, - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), - bool *no_add_attrs) +d_handle_noclone_attribute (tree *node, tree name, tree, int, + bool *no_add_attrs) { Type *t = TYPE_LANG_FRONTEND (TREE_TYPE (*node)); @@ -730,8 +700,8 @@ d_handle_noclone_attribute (tree *node, tree name, struct attribute_spec.handler. */ static tree -d_handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args, - int ARG_UNUSED (flags), bool *no_add_attrs) +d_handle_section_attribute (tree *node, tree, tree args, int, + bool *no_add_attrs) { tree decl = *node; @@ -791,9 +761,8 @@ d_handle_section_attribute (tree *node, tree ARG_UNUSED (name), tree args, struct attribute_spec.handler. */ static tree -d_handle_alias_attribute (tree *node, tree ARG_UNUSED (name), - tree args, int ARG_UNUSED (flags), - bool *no_add_attrs ATTRIBUTE_UNUSED) +d_handle_alias_attribute (tree *node, tree name, tree args, int, + bool *no_add_attrs) { tree decl = *node; @@ -850,10 +819,7 @@ d_handle_alias_attribute (tree *node, tree ARG_UNUSED (name), struct attribute_spec.handler. */ static tree -d_handle_weak_attribute (tree *node, tree name, - tree ARG_UNUSED (args), - int ARG_UNUSED (flags), - bool * ARG_UNUSED (no_add_attrs)) +d_handle_weak_attribute (tree *node, tree name, tree, int, bool *no_add_attrs) { if (TREE_CODE (*node) == FUNCTION_DECL && DECL_DECLARED_INLINE_P (*node)) -- 2.25.1