This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] remove useless unused attributes in i386 code


From: Trevor Saunders <tsaunders@mozilla.com>

Hi,

So apparently its not entirely obvious to everyone that removing the names of
unused arguments is the best way of dealing with warnings about unused
arguments in places like hooks where the argument is required for some reason.
Apparently this is somewhat less contravercial when the names are removed
consistantly throughout a section of code, so this patch does that for
config/i386/

It should suprise nobody that there was a couple cases where the argument was
used, but still marked attribute unused.

bootstrapped and regtested on x86_64-unknown-linux-gnu, with no regressions,
and a --target=i386-mingw32 run of make all-gcc completes without any unused
warnings. ok for trunk?

Trev

gcc/

	* config/i386/driver-i386.c: Remove names of unused arguments and
	unnecessary unused attributes.
	* config/i386/host-mingw32.c: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/winnt-stubs.c: Likewise.
	* config/i386/winnt.c: Likewise.

diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index 4cd0b3d..1c6385f 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -920,8 +920,7 @@ done:
    -march and -mtune "native" target and will leave to the newly
    built compiler to generate code for its default target.  */
 
-const char *host_detect_local_cpu (int argc ATTRIBUTE_UNUSED,
-				   const char **argv ATTRIBUTE_UNUSED)
+const char *host_detect_local_cpu (int, const char **)
 {
   return NULL;
 }
diff --git a/gcc/config/i386/host-mingw32.c b/gcc/config/i386/host-mingw32.c
index fc01ceb..c71d25d 100644
--- a/gcc/config/i386/host-mingw32.c
+++ b/gcc/config/i386/host-mingw32.c
@@ -83,7 +83,7 @@ mingw32_gt_pch_alloc_granularity (void)
    open file descriptor if the host would like to probe with mmap.  */
 
 static void *
-mingw32_gt_pch_get_address (size_t size, int fd  ATTRIBUTE_UNUSED)
+mingw32_gt_pch_get_address (size_t size, int)
 {
   void* res;
   size = (size + va_granularity - 1) & ~(va_granularity - 1);
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 8046c67..01d3f2c 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -5226,9 +5226,8 @@ x86_elf_aligned_common (FILE *file,
    ASM_OUTPUT_ALIGNED_BSS.  */
 
 void
-x86_output_aligned_bss (FILE *file, tree decl ATTRIBUTE_UNUSED,
-			const char *name, unsigned HOST_WIDE_INT size,
-			int align)
+x86_output_aligned_bss (FILE *file, tree decl, const char *name,
+		       	unsigned HOST_WIDE_INT size, int align)
 {
   if ((ix86_cmodel == CM_MEDIUM || ix86_cmodel == CM_MEDIUM_PIC)
       && size > (unsigned int)ix86_section_threshold)
@@ -5358,7 +5357,7 @@ ix86_function_ok_for_sibcall (tree decl, tree exp)
 static tree
 ix86_handle_cconv_attribute (tree *node, tree name,
 				   tree args,
-				   int flags ATTRIBUTE_UNUSED,
+				   int,
 				   bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE
@@ -5502,8 +5501,7 @@ ix86_handle_cconv_attribute (tree *node, tree name,
    attributes that we expect elsewhere.  */
 
 static tree
-ix86_handle_tm_regparm_attribute (tree *node, tree name ATTRIBUTE_UNUSED,
-    				  tree args ATTRIBUTE_UNUSED,
+ix86_handle_tm_regparm_attribute (tree *node, tree, tree,
 				  int flags, bool *no_add_attrs)
 {
   tree alt;
@@ -7542,7 +7540,7 @@ ix86_function_arg (cumulative_args_t cum_v, enum machine_mode omode,
 
 static bool
 ix86_pass_by_reference (cumulative_args_t cum_v, enum machine_mode mode,
-			const_tree type, bool named ATTRIBUTE_UNUSED)
+			const_tree type, bool)
 {
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
 
@@ -7971,8 +7969,7 @@ ix86_function_value_1 (const_tree valtype, const_tree fntype_or_decl,
 }
 
 static rtx
-ix86_function_value (const_tree valtype, const_tree fntype_or_decl,
-		     bool outgoing ATTRIBUTE_UNUSED)
+ix86_function_value (const_tree valtype, const_tree fntype_or_decl, bool)
 {
   enum machine_mode mode, orig_mode;
 
@@ -8019,7 +8016,7 @@ ix86_libcall_value (enum machine_mode mode)
 /* Return true iff type is returned in memory.  */
 
 static bool
-ix86_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+ix86_return_in_memory (const_tree type, const_tree fntype)
 {
 #ifdef SUBTARGET_RETURN_IN_MEMORY
   return SUBTARGET_RETURN_IN_MEMORY (type, fntype);
@@ -8313,8 +8310,7 @@ setup_incoming_varargs_ms_64 (CUMULATIVE_ARGS *cum)
 
 static void
 ix86_setup_incoming_varargs (cumulative_args_t cum_v, enum machine_mode mode,
-			     tree type, int *pretend_size ATTRIBUTE_UNUSED,
-			     int no_rtl)
+			     tree type, int *, int no_rtl)
 {
   CUMULATIVE_ARGS *cum = get_cumulative_args (cum_v);
   CUMULATIVE_ARGS next_cum;
@@ -11765,8 +11761,7 @@ ix86_expand_epilogue (int style)
 /* Reset from the function's potential modifications.  */
 
 static void
-ix86_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED,
-			       HOST_WIDE_INT size ATTRIBUTE_UNUSED)
+ix86_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED, HOST_WIDE_INT)
 {
   if (pic_offset_table_rtx)
     SET_REGNO (pic_offset_table_rtx, REAL_PIC_OFFSET_TABLE_REGNUM);
@@ -12388,9 +12383,7 @@ ix86_decompose_address (rtx addr, struct ix86_address *out)
    requires to two regs - that would mean more pseudos with longer
    lifetimes.  */
 static int
-ix86_address_cost (rtx x, enum machine_mode mode ATTRIBUTE_UNUSED,
-		   addr_space_t as ATTRIBUTE_UNUSED,
-		   bool speed ATTRIBUTE_UNUSED)
+ix86_address_cost (rtx x, enum machine_mode, addr_space_t, bool)
 {
   struct ix86_address parts;
   int cost = 1;
@@ -12457,7 +12450,7 @@ darwin_local_data_pic (rtx disp)
    satisfies CONSTANT_P.  */
 
 static bool
-ix86_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x)
+ix86_legitimate_constant_p (enum machine_mode, rtx x)
 {
   switch (GET_CODE (x))
     {
@@ -12782,10 +12775,8 @@ legitimate_pic_address_disp_p (rtx disp)
    0 if it should not.  */
 
 bool
-ix86_legitimize_reload_address (rtx x,
-				enum machine_mode mode ATTRIBUTE_UNUSED,
-				int opnum, int type,
-				int ind_levels ATTRIBUTE_UNUSED)
+ix86_legitimize_reload_address (rtx x, enum machine_mode, int opnum, int type,
+			       	int)
 {
   /* Reload can generate:
 
@@ -12882,8 +12873,7 @@ ix86_validate_address_register (rtx op)
    be recognized.  */
 
 static bool
-ix86_legitimate_address_p (enum machine_mode mode ATTRIBUTE_UNUSED,
-		           rtx addr, bool strict)
+ix86_legitimate_address_p (enum machine_mode, rtx addr, bool strict)
 {
   struct ix86_address parts;
   rtx base, index, disp;
@@ -13823,8 +13813,7 @@ legitimize_pe_coff_symbol (rtx addr, bool inreg)
    See comments by legitimize_pic_address in i386.c for details.  */
 
 static rtx
-ix86_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
-			 enum machine_mode mode)
+ix86_legitimize_address (rtx x, rtx, enum machine_mode mode)
 {
   int changed = 0;
   unsigned log;
@@ -14740,7 +14729,7 @@ print_reg (rtx x, int code, FILE *file)
    pattern.  */
 
 static int
-get_some_local_dynamic_name_1 (rtx *px, void *data ATTRIBUTE_UNUSED)
+get_some_local_dynamic_name_1 (rtx *px, void *)
 {
   rtx x = *px;
 
@@ -16066,7 +16055,7 @@ output_387_binary_op (rtx insn, rtx *operands)
 /* Check if a 256bit AVX register is referenced inside of EXP.   */
 
 static int
-ix86_check_avx256_register (rtx *pexp, void *data ATTRIBUTE_UNUSED)
+ix86_check_avx256_register (rtx *pexp, void *)
 {
   rtx exp = *pexp;
 
@@ -16194,7 +16183,7 @@ ix86_mode_needed (int entity, rtx insn)
 /* Check if a 256bit AVX register is referenced in stores.   */
  
 static void
-ix86_check_avx256_stores (rtx dest, const_rtx set ATTRIBUTE_UNUSED, void *data)
+ix86_check_avx256_stores (rtx dest, const_rtx, void *data)
  {
    if (ix86_check_avx256_register (&dest, NULL))
     {
@@ -16322,7 +16311,7 @@ ix86_mode_exit (int entity)
 }
 
 static int
-ix86_mode_priority (int entity ATTRIBUTE_UNUSED, int n)
+ix86_mode_priority (int, int n)
 {
   return n;
 }
@@ -18574,8 +18563,8 @@ ix86_dep_by_shift_count (const_rtx set_insn, const_rtx use_insn)
    appropriate constraints.  */
 
 bool
-ix86_unary_operator_ok (enum rtx_code code ATTRIBUTE_UNUSED,
-			enum machine_mode mode ATTRIBUTE_UNUSED,
+ix86_unary_operator_ok (enum rtx_code,
+			enum machine_mode,
 			rtx operands[2])
 {
   /* If one of operands is memory, source and destination must match.  */
@@ -18729,8 +18718,7 @@ ix86_expand_convert_uns_didf_sse (rtx target, rtx input)
 
 /* Not used, but eases macroization of patterns.  */
 void
-ix86_expand_convert_uns_sixf_sse (rtx target ATTRIBUTE_UNUSED,
-				  rtx input ATTRIBUTE_UNUSED)
+ix86_expand_convert_uns_sixf_sse (rtx, rtx)
 {
   gcc_unreachable ();
 }
@@ -19350,7 +19338,7 @@ ix86_expand_int_compare (enum rtx_code code, rtx op0, rtx op1)
    Return the appropriate mode to use.  */
 
 enum machine_mode
-ix86_fp_compare_mode (enum rtx_code code ATTRIBUTE_UNUSED)
+ix86_fp_compare_mode (enum rtx_code)
 {
   /* ??? In order to make all comparisons reversible, we do all comparisons
      non-trapping when compiling for IEEE.  Once gcc is able to distinguish
@@ -19565,7 +19553,7 @@ ix86_fp_comparison_cost (enum rtx_code code)
    (2 bytes, vs. 3 for fnstsw+sahf and at least 5 for fnstsw+test).  */
 
 enum ix86_fpcmp_strategy
-ix86_fp_comparison_strategy (enum rtx_code code ATTRIBUTE_UNUSED)
+ix86_fp_comparison_strategy (enum rtx_code)
 {
   /* Do fcomi/sahf based test when profitable.  */
 
@@ -26528,9 +26516,7 @@ core2i7_first_cycle_multipass_fini (void *_data)
 
 /* Prepare for scheduling pass.  */
 static void
-ix86_sched_init_global (FILE *dump ATTRIBUTE_UNUSED,
-			int verbose ATTRIBUTE_UNUSED,
-			int max_uid ATTRIBUTE_UNUSED)
+ix86_sched_init_global (FILE *, int, int)
 {
   /* Install scheduling hooks for current CPU.  Some of these hooks are used
      in time-critical parts of the scheduler, so we only set them up when
@@ -32760,7 +32746,7 @@ ix86_init_builtins (void)
 /* Return the ix86 builtin for CODE.  */
 
 static tree
-ix86_builtin_decl (unsigned code, bool initialize_p ATTRIBUTE_UNUSED)
+ix86_builtin_decl (unsigned code, bool)
 {
   if (code >= IX86_BUILTIN_MAX)
     return error_mark_node;
@@ -36916,8 +36902,7 @@ ix86_vectorize_builtin_gather (const_tree mem_vectype,
    reciprocal of the function, or NULL_TREE if not available.  */
 
 static tree
-ix86_builtin_reciprocal (unsigned int fn, bool md_fn,
-			 bool sqrt ATTRIBUTE_UNUSED)
+ix86_builtin_reciprocal (unsigned int fn, bool md_fn, bool)
 {
   if (! (TARGET_SSE_MATH && !optimize_insn_for_size_p ()
 	 && flag_finite_math_only && !flag_trapping_math
@@ -38529,7 +38514,7 @@ x86_order_regs_for_local_alloc (void)
 static tree
 ix86_handle_callee_pop_aggregate_return (tree *node, tree name,
 					      tree args,
-					      int flags ATTRIBUTE_UNUSED,
+					      int,
 					      bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE
@@ -38579,9 +38564,8 @@ ix86_handle_callee_pop_aggregate_return (tree *node, tree name,
 /* Handle a "ms_abi" or "sysv" attribute; arguments as in
    struct attribute_spec.handler.  */
 static tree
-ix86_handle_abi_attribute (tree *node, tree name,
-			      tree args ATTRIBUTE_UNUSED,
-			      int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+ix86_handle_abi_attribute (tree *node, tree name, tree, int,
+			   bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE
       && TREE_CODE (*node) != METHOD_TYPE
@@ -38620,9 +38604,8 @@ ix86_handle_abi_attribute (tree *node, tree name,
 /* Handle a "ms_struct" or "gcc_struct" attribute; arguments as in
    struct attribute_spec.handler.  */
 static tree
-ix86_handle_struct_attribute (tree *node, tree name,
-			      tree args ATTRIBUTE_UNUSED,
-			      int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+ix86_handle_struct_attribute (tree *node, tree name, tree, int,
+			      bool *no_add_attrs)
 {
   tree *type = NULL;
   if (DECL_P (*node))
@@ -38654,9 +38637,8 @@ ix86_handle_struct_attribute (tree *node, tree name,
 }
 
 static tree
-ix86_handle_fndecl_attribute (tree *node, tree name,
-                              tree args ATTRIBUTE_UNUSED,
-                              int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+ix86_handle_fndecl_attribute (tree *node, tree name, tree, int,
+			      bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
@@ -38734,9 +38716,8 @@ x86_this_parameter (tree function)
 /* Determine whether x86_output_mi_thunk can succeed.  */
 
 static bool
-x86_can_output_mi_thunk (const_tree thunk ATTRIBUTE_UNUSED,
-			 HOST_WIDE_INT delta ATTRIBUTE_UNUSED,
-			 HOST_WIDE_INT vcall_offset, const_tree function)
+x86_can_output_mi_thunk (const_tree, HOST_WIDE_INT, HOST_WIDE_INT vcall_offset,
+			 const_tree function)
 {
   /* 64-bit can handle anything.  */
   if (TARGET_64BIT)
@@ -38765,8 +38746,7 @@ x86_can_output_mi_thunk (const_tree thunk ATTRIBUTE_UNUSED,
    *(*this + vcall_offset) should be added to THIS.  */
 
 static void
-x86_output_mi_thunk (FILE *file,
-		     tree thunk ATTRIBUTE_UNUSED, HOST_WIDE_INT delta,
+x86_output_mi_thunk (FILE *file, tree, HOST_WIDE_INT delta,
 		     HOST_WIDE_INT vcall_offset, tree function)
 {
   rtx this_param = x86_this_parameter (function);
@@ -39420,7 +39400,7 @@ x86_extended_QIreg_mentioned_p (rtx insn)
 /* Return nonzero when P points to register encoded via REX prefix.
    Called via for_each_rtx.  */
 static int
-extended_reg_mentioned_1 (rtx *p, void *data ATTRIBUTE_UNUSED)
+extended_reg_mentioned_1 (rtx *p, void *)
 {
    unsigned int regno;
    if (!REG_P (*p))
@@ -41166,9 +41146,7 @@ ix86_c_mode_for_suffix (char suffix)
    with the old cc0-based compiler.  */
 
 static tree
-ix86_md_asm_clobbers (tree outputs ATTRIBUTE_UNUSED,
-		      tree inputs ATTRIBUTE_UNUSED,
-		      tree clobbers)
+ix86_md_asm_clobbers (tree, tree, tree clobbers)
 {
   clobbers = tree_cons (NULL_TREE, build_string (5, "flags"),
 			clobbers);
@@ -42375,8 +42353,7 @@ static const struct attribute_spec ix86_attribute_table[] =
 /* Implement targetm.vectorize.builtin_vectorization_cost.  */
 static int
 ix86_builtin_vectorization_cost (enum vect_cost_for_stmt type_of_cost,
-                                 tree vectype,
-                                 int misalign ATTRIBUTE_UNUSED)
+                                 tree vectype, int)
 {
   unsigned elements;
 
@@ -46424,8 +46401,7 @@ has_dispatch (rtx insn, int action)
    enabled for other processors.  */
 
 static int
-ix86_reassociation_width (unsigned int opc ATTRIBUTE_UNUSED,
-			  enum machine_mode mode)
+ix86_reassociation_width (unsigned int, enum machine_mode mode)
 {
   int res = 1;
 
@@ -46522,7 +46498,7 @@ ix86_spill_class (reg_class_t rclass, enum machine_mode mode)
 /* Implement targetm.vectorize.init_cost.  */
 
 static void *
-ix86_init_cost (struct loop *loop_info ATTRIBUTE_UNUSED)
+ix86_init_cost (struct loop *)
 {
   unsigned *cost = XNEWVEC (unsigned, 3);
   cost[vect_prologue] = cost[vect_body] = cost[vect_epilogue] = 0;
diff --git a/gcc/config/i386/winnt-stubs.c b/gcc/config/i386/winnt-stubs.c
index 30321d0..85a3141 100644
--- a/gcc/config/i386/winnt-stubs.c
+++ b/gcc/config/i386/winnt-stubs.c
@@ -33,19 +33,19 @@ along with GCC; see the file COPYING3.  If not see
 #include "hashtab.h"
 
 bool
-i386_pe_type_dllimport_p (tree decl ATTRIBUTE_UNUSED)
+i386_pe_type_dllimport_p (tree)
 {
   return false;
 }
 
 
 bool
-i386_pe_type_dllexport_p (tree decl ATTRIBUTE_UNUSED)
+i386_pe_type_dllexport_p (tree)
 {
   return false;
 }
 
 
 void
-i386_pe_adjust_class_at_definition (tree t ATTRIBUTE_UNUSED)
+i386_pe_adjust_class_at_definition (tree)
 { }
diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c
index 8a5d982..bf6e2b1 100644
--- a/gcc/config/i386/winnt.c
+++ b/gcc/config/i386/winnt.c
@@ -66,9 +66,8 @@ along with GCC; see the file COPYING3.  If not see
 /* Handle a "shared" attribute;
    arguments as in struct attribute_spec.handler.  */
 tree
-ix86_handle_shared_attribute (tree *node, tree name,
-			      tree args ATTRIBUTE_UNUSED,
-			      int flags ATTRIBUTE_UNUSED, bool *no_add_attrs)
+ix86_handle_shared_attribute (tree *node, tree name, tree, int,
+			      bool *no_add_attrs)
 {
   if (TREE_CODE (*node) != VAR_DECL)
     {
@@ -83,9 +82,7 @@ ix86_handle_shared_attribute (tree *node, tree name,
 /* Handle a "selectany" attribute;
    arguments as in struct attribute_spec.handler.  */
 tree
-ix86_handle_selectany_attribute (tree *node, tree name,
-			         tree args ATTRIBUTE_UNUSED,
-			         int flags ATTRIBUTE_UNUSED,
+ix86_handle_selectany_attribute (tree *node, tree name, tree, int,
 				 bool *no_add_attrs)
 {
   /* The attribute applies only to objects that are initialized and have
@@ -264,8 +261,7 @@ i386_pe_maybe_mangle_decl_assembler_name (tree decl, tree id)
    user-specified visibility attributes.  */
 
 void
-i386_pe_assemble_visibility (tree decl,
-			     int vis ATTRIBUTE_UNUSED)
+i386_pe_assemble_visibility (tree decl, int)
 {
   if (!decl
       || !lookup_attribute ("visibility", DECL_ATTRIBUTES (decl)))
@@ -292,7 +288,7 @@ i386_pe_mangle_decl_assembler_name (tree decl, tree id)
    a file stream.  */
 
 tree
-i386_pe_mangle_assembler_name (const char *name ATTRIBUTE_UNUSED)
+i386_pe_mangle_assembler_name (const char *name)
 {
   const char *skipped = name + (*name == '*' ? 1 : 0);
   const char *stripped = targetm.strip_name_encoding (skipped);
@@ -467,7 +463,7 @@ i386_pe_reloc_rw_mask (void)
 #define SECTION_PE_SHARED	SECTION_MACH_DEP
 
 unsigned int
-i386_pe_section_type_flags (tree decl, const char *name, int reloc)
+i386_pe_section_type_flags (tree decl, const char *, int reloc)
 {
   unsigned int flags;
 
@@ -560,7 +556,7 @@ i386_pe_asm_named_section (const char *name, unsigned int flags,
 void
 i386_pe_asm_output_aligned_decl_common (FILE *stream, tree decl,
 					const char *name, HOST_WIDE_INT size,
-					HOST_WIDE_INT align ATTRIBUTE_UNUSED)
+					HOST_WIDE_INT align)
 {
   HOST_WIDE_INT rounded;
 
@@ -1276,8 +1272,7 @@ i386_pe_start_function (FILE *f, const char *name, tree decl)
 }
 
 void
-i386_pe_end_function (FILE *f, const char *name ATTRIBUTE_UNUSED,
-		      tree decl ATTRIBUTE_UNUSED)
+i386_pe_end_function (FILE *f, const char *, tree)
 {
   i386_pe_seh_fini (f);
 }
-- 
2.0.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]