From patchwork Tue Sep 11 15:29:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 183138 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id F1CCE2C0085 for ; Wed, 12 Sep 2012 01:29:37 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1347982178; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=9uloWxd4o4UtJsSmd12YPUA6SJY=; b=QXBEehL9OLV5bcm iF44U5bDvRsmohHI5ZrxGtCwZkHWI5oVzqYwrLMoRmHIiihg0PCLMrJAyU18gtm5 9AmeRP0AOTN0KVfOo8kgy98q8jqX5oZjeapyYaPDTN8ZDKDNTy7EPL1d2Cydt/yW TLZLzQ8GxajIMaN8krDmnHdx14A8= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=aLXX1x1/y6/0slPCPxQu7dulfEW60SToqc53YLqcbD4uthkI9VjjGoRNMiCOkV +CtFdvub5NKM8uBZjRQgM4fe5mS7l6fJ3bAudsSKpXxV/bjI+MQ9IR++nQDGmqmm U/3jV/jiOMLFGu2tfJ8TJpiQja8Q8NeQqUxXUGNmdc/J0=; Received: (qmail 6455 invoked by alias); 11 Sep 2012 15:29:33 -0000 Received: (qmail 6441 invoked by uid 22791); 11 Sep 2012 15:29:31 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_TM X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 11 Sep 2012 15:29:17 +0000 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q8BFTFlH017408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Sep 2012 15:29:16 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8BFTFqY027401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Sep 2012 15:29:15 GMT Received: from abhmt112.oracle.com (abhmt112.oracle.com [141.146.116.64]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8BFTEeI032104; Tue, 11 Sep 2012 10:29:15 -0500 Received: from [192.168.1.4] (/79.36.197.18) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 11 Sep 2012 08:29:14 -0700 Message-ID: <504F58C8.5050502@oracle.com> Date: Tue, 11 Sep 2012 17:29:12 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: Jason Merrill Subject: [C++ Patch] Remove uses of ATTRIBUTE_UNUSED in the function parameters X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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, ¶ms, @@ -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) /* ::= Ut [ ] _ */ 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)