Hi,

since we are now using C++, I think we can remove the attributes and just use unnamed parameters. For now I kept the names in comments for documentation purposes, but would be glad to remove those too, if you like.

Booted and tested x86_64-linux.

Thanks,
Paolo.

PS: slightly interesting, in a couple of cases - write_unnamed_type_name, wrap_cleanups_r - the parameters were actually used.

//////////////////////
2012-09-11  Paolo Carlini  <paolo.carl...@oracle.com>

        * typeck.c (build_indirect_ref, build_function_call,
        build_function_call_vec, build_binary_op, build_unary_op,
        build_compound_expr, build_c_cast, build_modify_expr): Remove
        uses of ATTRIBUTE_UNUSED on the parameters.
        * class.c (set_linkage_according_to_type, resort_type_method_vec,
        dfs_find_final_overrider_post, empty_base_at_nonzero_offset_p):
        Likewise.
        * decl.c (local_variable_p_walkfn): Likewise.
        * except.c (wrap_cleanups_r, check_noexcept_r): Likewise.
        * error.c (find_typenames_r): Likewise.
        * tree.c (verify_stmt_tree_r, bot_replace,
        handle_java_interface_attribute, handle_com_interface_attribute,
        handle_init_priority_attribute, c_register_addr_space): Likewise.
        * cp-gimplify.c (cxx_omp_clause_default_ctor): Likewise.
        * cp-lang.c (objcp_tsubst_copy_and_build): Likewise.
        * pt.c (unify_success, unify_invalid, instantiation_dependent_r):
        Likewise.
        * semantics.c (dfs_calculate_bases_pre): Likewise.
        * decl2.c (fix_temporary_vars_context_r, clear_decl_external):
        Likewise.
        * parser.c (cp_lexer_token_at, cp_parser_omp_clause_mergeable,
        cp_parser_omp_clause_nowait, cp_parser_omp_clause_ordered,
        cp_parser_omp_clause_untied): Likewise.
        * mangle.c (write_unnamed_type_name,
        discriminator_for_string_literal): Likewise.
        * search.c (dfs_accessible_post, dfs_debug_mark): Likewise.
        * lex.c (handle_pragma_vtable, handle_pragma_unit,
        handle_pragma_interface, handle_pragma_implementation,
        handle_pragma_java_exceptions): Likewise.

Index: typeck.c
===================================================================
--- typeck.c    (revision 191177)
+++ typeck.c    (working copy)
@@ -2772,7 +2772,7 @@ build_x_indirect_ref (location_t loc, tree expr, r
 
 /* Helper function called from c-common.  */
 tree
-build_indirect_ref (location_t loc ATTRIBUTE_UNUSED,
+build_indirect_ref (location_t /*loc*/,
                    tree ptr, ref_operator errorstring)
 {
   return cp_build_indirect_ref (ptr, errorstring, tf_warning_or_error);
@@ -3207,7 +3207,7 @@ get_member_function_from_ptrfunc (tree *instance_p
 
 /* Used by the C-common bits.  */
 tree
-build_function_call (location_t loc ATTRIBUTE_UNUSED, 
+build_function_call (location_t /*loc*/, 
                     tree function, tree params)
 {
   return cp_build_function_call (function, params, tf_warning_or_error);
@@ -3215,9 +3215,9 @@ tree
 
 /* Used by the C-common bits.  */
 tree
-build_function_call_vec (location_t loc ATTRIBUTE_UNUSED,
+build_function_call_vec (location_t /*loc*/,
                         tree function, VEC(tree,gc) *params,
-                        VEC(tree,gc) *origtypes ATTRIBUTE_UNUSED)
+                        VEC(tree,gc) * /*origtypes*/)
 {
   VEC(tree,gc) *orig_params = params;
   tree ret = cp_build_function_call_vec (function, &params,
@@ -3693,7 +3693,7 @@ enum_cast_to_int (tree op)
 /* For the c-common bits.  */
 tree
 build_binary_op (location_t location, enum tree_code code, tree op0, tree op1,
-                int convert_p ATTRIBUTE_UNUSED)
+                int /*convert_p*/)
 {
   return cp_build_binary_op (location, code, op0, op1, tf_warning_or_error);
 }
@@ -5448,7 +5448,7 @@ cp_build_unary_op (enum tree_code code, tree xarg,
 
 /* Hook for the c-common bits that build a unary op.  */
 tree
-build_unary_op (location_t location ATTRIBUTE_UNUSED,
+build_unary_op (location_t /*location*/,
                enum tree_code code, tree xarg, int noconvert)
 {
   return cp_build_unary_op (code, xarg, noconvert, tf_warning_or_error);
@@ -5784,7 +5784,7 @@ build_x_compound_expr (location_t loc, tree op1, t
 /* Like cp_build_compound_expr, but for the c-common bits.  */
 
 tree
-build_compound_expr (location_t loc ATTRIBUTE_UNUSED, tree lhs, tree rhs)
+build_compound_expr (location_t /*loc*/, tree lhs, tree rhs)
 {
   return cp_build_compound_expr (lhs, rhs, tf_warning_or_error);
 }
@@ -6652,7 +6652,7 @@ build_const_cast (tree type, tree expr, tsubst_fla
 /* Like cp_build_c_cast, but for the c-common bits.  */
 
 tree
-build_c_cast (location_t loc ATTRIBUTE_UNUSED, tree type, tree expr)
+build_c_cast (location_t /*loc*/, tree type, tree expr)
 {
   return cp_build_c_cast (type, expr, tf_warning_or_error);
 }
@@ -6782,11 +6782,11 @@ cp_build_c_cast (tree type, tree expr, tsubst_flag
 
 /* For use from the C common bits.  */
 tree
-build_modify_expr (location_t location ATTRIBUTE_UNUSED,
-                  tree lhs, tree lhs_origtype ATTRIBUTE_UNUSED,
+build_modify_expr (location_t /*location*/,
+                  tree lhs, tree /*lhs_origtype*/,
                   enum tree_code modifycode, 
-                  location_t rhs_location ATTRIBUTE_UNUSED, tree rhs,
-                  tree rhs_origtype ATTRIBUTE_UNUSED)
+                  location_t /*rhs_location*/, tree rhs,
+                  tree /*rhs_origtype*/)
 {
   return cp_build_modify_expr (lhs, modifycode, rhs, tf_warning_or_error);
 }
Index: class.c
===================================================================
--- class.c     (revision 191177)
+++ class.c     (working copy)
@@ -711,7 +711,7 @@ get_vtable_name (tree type)
    the abstract.  */
 
 void
-set_linkage_according_to_type (tree type ATTRIBUTE_UNUSED, tree decl)
+set_linkage_according_to_type (tree /*type*/, tree decl)
 {
   TREE_PUBLIC (decl) = 1;
   determine_visibility (decl);
@@ -1820,7 +1820,7 @@ resort_method_name_cmp (const void* m1_p, const vo
 
 void
 resort_type_method_vec (void* obj,
-                       void* orig_obj ATTRIBUTE_UNUSED ,
+                       void* /*orig_obj*/,
                        gt_pointer_operator new_value,
                        void* cookie)
 {
@@ -2039,7 +2039,7 @@ dfs_find_final_overrider_pre (tree binfo, void *da
 }
 
 static tree
-dfs_find_final_overrider_post (tree binfo ATTRIBUTE_UNUSED, void *data)
+dfs_find_final_overrider_post (tree /*binfo*/, void *data)
 {
   find_final_overrider_data *ffod = (find_final_overrider_data *) data;
   VEC_pop (tree, ffod->path);
@@ -3771,7 +3771,7 @@ layout_nonempty_base_or_field (record_layout_info
 static int
 empty_base_at_nonzero_offset_p (tree type,
                                tree offset,
-                               splay_tree offsets ATTRIBUTE_UNUSED)
+                               splay_tree /*offsets*/)
 {
   return is_empty_class (type) && !integer_zerop (offset);
 }
Index: decl.c
===================================================================
--- decl.c      (revision 191177)
+++ decl.c      (working copy)
@@ -10536,7 +10536,7 @@ local_variable_p (const_tree t)
 
 static tree
 local_variable_p_walkfn (tree *tp, int *walk_subtrees,
-                        void *data ATTRIBUTE_UNUSED)
+                        void * /*data*/)
 {
   /* Check DECL_NAME to avoid including temporaries.  We don't check
      DECL_ARTIFICIAL because we do want to complain about 'this'.  */
Index: except.c
===================================================================
--- except.c    (revision 191177)
+++ except.c    (working copy)
@@ -671,8 +671,7 @@ do_free_exception (tree ptr)
    Called from build_throw via walk_tree_without_duplicates.  */
 
 static tree
-wrap_cleanups_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
-                void *data ATTRIBUTE_UNUSED)
+wrap_cleanups_r (tree *tp, int *walk_subtrees, void * /*data*/)
 {
   tree exp = *tp;
   tree cleanup;
@@ -1129,8 +1128,7 @@ check_handlers (tree handlers)
      expression whose type is a polymorphic class type (10.3).  */
 
 static tree
-check_noexcept_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
-                 void *data ATTRIBUTE_UNUSED)
+check_noexcept_r (tree *tp, int * /*walk_subtrees*/, void * /*data*/)
 {
   tree t = *tp;
   enum tree_code code = TREE_CODE (t);
Index: error.c
===================================================================
--- error.c     (revision 191177)
+++ error.c     (working copy)
@@ -1285,7 +1285,7 @@ struct find_typenames_t
 };
 
 static tree
-find_typenames_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data)
+find_typenames_r (tree *tp, int * /*walk_subtrees*/, void *data)
 {
   struct find_typenames_t *d = (struct find_typenames_t *)data;
   tree mv = NULL_TREE;
Index: tree.c
===================================================================
--- tree.c      (revision 191177)
+++ tree.c      (working copy)
@@ -1915,9 +1915,7 @@ count_trees (tree t)
 /* Called from verify_stmt_tree via walk_tree.  */
 
 static tree
-verify_stmt_tree_r (tree* tp,
-                   int* walk_subtrees ATTRIBUTE_UNUSED ,
-                   void* data)
+verify_stmt_tree_r (tree* tp, int * /*walk_subtrees*/, void* data)
 {
   tree t = *tp;
   htab_t *statements = (htab_t *) data;
@@ -2155,9 +2153,7 @@ bot_manip (tree* tp, int* walk_subtrees, void* dat
    variables.  */
 
 static tree
-bot_replace (tree* t,
-            int* walk_subtrees ATTRIBUTE_UNUSED ,
-            void* data)
+bot_replace (tree* t, int* /*walk_subtrees*/, void* data)
 {
   splay_tree target_remap = ((splay_tree) data);
 
@@ -3001,7 +2997,7 @@ const struct attribute_spec cxx_attribute_table[]
 static tree
 handle_java_interface_attribute (tree* node,
                                 tree name,
-                                tree args ATTRIBUTE_UNUSED ,
+                                tree /*args*/,
                                 int flags,
                                 bool* no_add_attrs)
 {
@@ -3026,8 +3022,8 @@ handle_java_interface_attribute (tree* node,
 static tree
 handle_com_interface_attribute (tree* node,
                                tree name,
-                               tree args ATTRIBUTE_UNUSED ,
-                               int flags ATTRIBUTE_UNUSED ,
+                               tree /*args*/,
+                               int /*flags*/,
                                bool* no_add_attrs)
 {
   static int warned;
@@ -3056,7 +3052,7 @@ static tree
 handle_init_priority_attribute (tree* node,
                                tree name,
                                tree args,
-                               int flags ATTRIBUTE_UNUSED ,
+                               int /*flags*/,
                                bool* no_add_attrs)
 {
   tree initp_expr = TREE_VALUE (args);
@@ -3770,8 +3766,7 @@ cp_free_lang_data (tree t)
    should be a C target hook.  But currently this is not possible,
    because this function is called via REGISTER_TARGET_PRAGMAS.  */
 void
-c_register_addr_space (const char *word ATTRIBUTE_UNUSED,
-                      addr_space_t as ATTRIBUTE_UNUSED)
+c_register_addr_space (const char * /*word*/, addr_space_t /*as*/)
 {
 }
 
Index: cp-gimplify.c
===================================================================
--- cp-gimplify.c       (revision 191177)
+++ cp-gimplify.c       (working copy)
@@ -1318,8 +1318,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree
    NULL if there's nothing to do.  */
 
 tree
-cxx_omp_clause_default_ctor (tree clause, tree decl,
-                            tree outer ATTRIBUTE_UNUSED)
+cxx_omp_clause_default_ctor (tree clause, tree decl, tree /*outer*/)
 {
   tree info = CP_OMP_CLAUSE_INFO (clause);
   tree ret = NULL;
Index: cp-lang.c
===================================================================
--- cp-lang.c   (revision 191177)
+++ cp-lang.c   (working copy)
@@ -92,11 +92,11 @@ struct lang_hooks lang_hooks = LANG_HOOKS_INITIALI
 /* The following function does something real, but only in Objective-C++.  */
 
 tree
-objcp_tsubst_copy_and_build (tree t ATTRIBUTE_UNUSED,
-                            tree args ATTRIBUTE_UNUSED,
-                            tsubst_flags_t complain ATTRIBUTE_UNUSED,
-                            tree in_decl ATTRIBUTE_UNUSED,
-                            bool function_p ATTRIBUTE_UNUSED)
+objcp_tsubst_copy_and_build (tree /*t*/,
+                            tree /*args*/,
+                            tsubst_flags_t /*complain*/,
+                            tree /*in_decl*/,
+                            bool /*function_p*/)
 {
   return NULL_TREE;
 }
Index: pt.c
===================================================================
--- pt.c        (revision 191177)
+++ pt.c        (working copy)
@@ -5187,7 +5187,7 @@ has_value_dependent_address (tree op)
    call.c  */
 
 static int
-unify_success (bool explain_p ATTRIBUTE_UNUSED)
+unify_success (bool /*explain_p*/)
 {
   return 0;
 }
@@ -5202,7 +5202,7 @@ unify_parameter_deduction_failure (bool explain_p,
 }
 
 static int
-unify_invalid (bool explain_p ATTRIBUTE_UNUSED)
+unify_invalid (bool /*explain_p*/)
 {
   return 1;
 }
@@ -19549,7 +19549,7 @@ type_dependent_expression_p (tree expression)
 
 static tree
 instantiation_dependent_r (tree *tp, int *walk_subtrees,
-                          void *data ATTRIBUTE_UNUSED)
+                          void * /*data*/)
 {
   if (TYPE_P (*tp))
     {
Index: semantics.c
===================================================================
--- semantics.c (revision 191177)
+++ semantics.c (working copy)
@@ -3455,7 +3455,7 @@ calculate_direct_bases (tree type)
 /* Virtual base classes are handled separately in finish_bases */
 
 static tree
-dfs_calculate_bases_pre (tree binfo, ATTRIBUTE_UNUSED void *data_)
+dfs_calculate_bases_pre (tree binfo, void * /*data_*/)
 {
   /* Don't walk bases of virtual bases */
   return BINFO_VIRTUAL_P (binfo) ? dfs_skip_bases : NULL_TREE;
Index: decl2.c
===================================================================
--- decl2.c     (revision 191177)
+++ decl2.c     (working copy)
@@ -3037,8 +3037,8 @@ get_priority_info (int priority)
    it's DECL_CONTECT() properly set.  */
 static tree 
 fix_temporary_vars_context_r (tree *node,
-                             int  *unused ATTRIBUTE_UNUSED,
-                             void *unused1 ATTRIBUTE_UNUSED)
+                             int  * /*unused*/,
+                             void * /*unused1*/)
 {
   gcc_assert (current_function_decl);
 
@@ -3656,7 +3656,7 @@ collect_all_refs (const char *source_file)
 /* Clear DECL_EXTERNAL for NODE.  */
 
 static bool
-clear_decl_external (struct cgraph_node *node, void *data ATTRIBUTE_UNUSED)
+clear_decl_external (struct cgraph_node *node, void * /*data*/)
 {
   DECL_EXTERNAL (node->symbol.decl) = 0;
   return false;
Index: parser.c
===================================================================
--- parser.c    (revision 191177)
+++ parser.c    (working copy)
@@ -667,7 +667,7 @@ cp_lexer_token_position (cp_lexer *lexer, bool pre
 }
 
 static inline cp_token *
-cp_lexer_token_at (cp_lexer *lexer ATTRIBUTE_UNUSED, cp_token_position pos)
+cp_lexer_token_at (cp_lexer * /*lexer*/, cp_token_position pos)
 {
   return pos;
 }
@@ -25322,7 +25322,7 @@ cp_parser_omp_clause_if (cp_parser *parser, tree l
    mergeable */
 
 static tree
-cp_parser_omp_clause_mergeable (cp_parser *parser ATTRIBUTE_UNUSED,
+cp_parser_omp_clause_mergeable (cp_parser * /*parser*/,
                                tree list, location_t location)
 {
   tree c;
@@ -25339,7 +25339,7 @@ static tree
    nowait */
 
 static tree
-cp_parser_omp_clause_nowait (cp_parser *parser ATTRIBUTE_UNUSED,
+cp_parser_omp_clause_nowait (cp_parser * /*parser*/,
                             tree list, location_t location)
 {
   tree c;
@@ -25385,7 +25385,7 @@ cp_parser_omp_clause_num_threads (cp_parser *parse
    ordered */
 
 static tree
-cp_parser_omp_clause_ordered (cp_parser *parser ATTRIBUTE_UNUSED,
+cp_parser_omp_clause_ordered (cp_parser * /*parser*/,
                              tree list, location_t location)
 {
   tree c;
@@ -25578,7 +25578,7 @@ cp_parser_omp_clause_schedule (cp_parser *parser,
    untied */
 
 static tree
-cp_parser_omp_clause_untied (cp_parser *parser ATTRIBUTE_UNUSED,
+cp_parser_omp_clause_untied (cp_parser * /*parser*/,
                             tree list, location_t location)
 {
   tree c;
Index: mangle.c
===================================================================
--- mangle.c    (revision 191177)
+++ mangle.c    (working copy)
@@ -1337,7 +1337,7 @@ nested_anon_class_index (tree type)
 /* <unnamed-type-name> ::= Ut [ <nonnegative number> ] _ */
 
 static void
-write_unnamed_type_name (const tree type ATTRIBUTE_UNUSED)
+write_unnamed_type_name (const tree type)
 {
   int discriminator;
   MANGLE_TRACE_TREE ("unnamed-type-name", type);
@@ -1694,8 +1694,8 @@ discriminator_for_local_entity (tree entity)
    string literals used in FUNCTION.  */
 
 static int
-discriminator_for_string_literal (tree function ATTRIBUTE_UNUSED,
-                                 tree string ATTRIBUTE_UNUSED)
+discriminator_for_string_literal (tree /*function*/,
+                                 tree /*string*/)
 {
   /* For now, we don't discriminate amongst string literals.  */
   return 0;
Index: search.c
===================================================================
--- search.c    (revision 191177)
+++ search.c    (working copy)
@@ -819,7 +819,7 @@ friend_accessible_p (tree scope, tree decl, tree b
 /* Called via dfs_walk_once_accessible from accessible_p */
 
 static tree
-dfs_accessible_post (tree binfo, void *data ATTRIBUTE_UNUSED)
+dfs_accessible_post (tree binfo, void * /*data*/)
 {
   if (BINFO_ACCESS (binfo) != ak_none)
     {
@@ -2160,7 +2160,7 @@ maybe_suppress_debug_info (tree t)
    information anyway.  */
 
 static tree
-dfs_debug_mark (tree binfo, void *data ATTRIBUTE_UNUSED)
+dfs_debug_mark (tree binfo, void * /*data*/)
 {
   tree t = BINFO_TYPE (binfo);
 
Index: lex.c
===================================================================
--- lex.c       (revision 191177)
+++ lex.c       (working copy)
@@ -330,21 +330,21 @@ parse_strconst_pragma (const char* name, int opt)
 }
 
 static void
-handle_pragma_vtable (cpp_reader* dfile ATTRIBUTE_UNUSED )
+handle_pragma_vtable (cpp_reader* /*dfile*/)
 {
   parse_strconst_pragma ("vtable", 0);
   sorry ("#pragma vtable no longer supported");
 }
 
 static void
-handle_pragma_unit (cpp_reader* dfile ATTRIBUTE_UNUSED )
+handle_pragma_unit (cpp_reader* /*dfile*/)
 {
   /* Validate syntax, but don't do anything.  */
   parse_strconst_pragma ("unit", 0);
 }
 
 static void
-handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
+handle_pragma_interface (cpp_reader* /*dfile*/)
 {
   tree fname = parse_strconst_pragma ("interface", 1);
   struct c_fileinfo *finfo;
@@ -384,7 +384,7 @@ static void
    any effect.  */
 
 static void
-handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
+handle_pragma_implementation (cpp_reader* /*dfile*/)
 {
   tree fname = parse_strconst_pragma ("implementation", 1);
   const char *filename;
@@ -425,7 +425,7 @@ static void
 
 /* Indicate that this file uses Java-personality exception handling.  */
 static void
-handle_pragma_java_exceptions (cpp_reader* dfile ATTRIBUTE_UNUSED)
+handle_pragma_java_exceptions (cpp_reader* /*dfile*/)
 {
   tree x;
   if (pragma_lex (&x) != CPP_EOF)

Reply via email to