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]

[warning control patch] attribute cases


With testcases this time.  Bootstrap no regressions on x86_64 FC3.

2005-05-17  DJ Delorie  <dj@redhat.com>
	
	* common.opt (-Wattributes): New.  Default true.
	* doc/invoke.texi (-Wno-attributes): Document.
	
	* attribs.c (decl_attributes): Move warning control from if() to
	warning(OPT_*).
	* c-common.c (handle_packed_attribute): Likewise.
	(handle_nocommon_attribute): Likewise.
	(handle_common_attribute): Likewise.
	(handle_noreturn_attribute): Likewise.
	(handle_noinline_attribute): Likewise.
	(handle_always_inline_attribute): Likewise.
	(handle_used_attribute): Likewise.
	(handle_unused_attribute): Likewise.
	(handle_const_attribute): Likewise.
	(handle_transparent_union_attribute): Likewise.
	(handle_constructor_attribute): Likewise.
	(handle_destructor_attribute): Likewise.
	(handle_mode_attribute): Likewise.
	(handle_alias_attribute): Likewise.
	(handle_visibility_attribute): Likewise.
	(handle_tls_model_attribute): Likewise.
	(handle_malloc_attribute): Likewise.
	(handle_returns_twice_attribute): Likewise.
	(handle_pure_attribute): Likewise.
	(handle_deprecated_attribute): Likewise.
	(handle_vector_size_attribute): Likewise.
	(handle_nothrow_attribute): Likewise.
	(handle_cleanup_attribute): Likewise.
	(handle_warn_unused_result_attribute): Likewise.
	(handle_sentinel_attribute): Likewise.
	* c-decl.c (diagnose_mismatched_decls): Likewise.
	(start_decl): Likewise.
	(grokdeclarator): Likewise.
	(start_function): Likewise.
	* c-format.c (check_function_format): Likewise.
	* stor-layout.c (place_field): Likewise.
	(finalize_record_size): Likewise.
	* tree.c (handle_dll_attribute)): Likewise.
	* varasm.c (default_assemble_visibility): Likewise.
	* config/darwin.c (darwin_handle_weak_import_attribute): Likewise.
	(darwin_assemble_visibility): Likewise.
	* config/arc/arc.c (arc_handle_interrupt_attribute): Likewise.
	* config/arm/arm.c (arm_handle_fndecl_attribute): Likewise.
	(arm_handle_isr_attribute): Likewise.
	* config/avr/avr.c (avr_handle_progmem_attribute): Likewise.
	(avr_handle_fndecl_attribute): Likewise.
	* config/bfin/bfin.c (handle_int_attribute): Likewise.
	* config/c4x/c4x.c (c4x_handle_fntype_attribute): Likewise.
	* config/h8300/h8300.c (h8300_handle_fndecl_attribute): Likewise.
	(h8300_handle_eightbit_data_attribute): Likewise.
	(h8300_handle_tiny_data_attribute): Likewise.
	* config/i386/i386.c (ix86_handle_cdecl_attribute): Likewise.
	(ix86_handle_regparm_attribute): Likewise.
	(ix86_handle_struct_attribute): Likewise.
	* config/i386/winnt.c (ix86_handle_shared_attribute): Likewise.
	(i386_pe_encode_section_info): Likewise.
	* config/ia64/ia64.c (ia64_handle_model_attribute): Likewise.
	* config/ip2k/ip2k.c (ip2k_handle_progmem_attribute): Likewise.
	(ip2k_handle_fndecl_attribute): Likewise.
	* config/m32r/m32r.c (m32r_handle_model_attribute): Likewise.
	* config/m68hc11/m68hc11 (m68hc11_handle_page0_attribute): Likewise.
	(m68hc11_handle_fntype_attribute): Likewise.
	(m68hc11_encode_section_info): Likewise.
	* config/m68k/m68k.c (m68k_handle_fndecl_attribute): Likewise.
	* config/mcore/mcore.c (mcore_handle_naked_attribute): Likewise.
	* config/ns32k/ns32k.c (ns32k_handle_fntype_attribute): Likewise.
	* config/rs6000/rs6000.c (rs6000_handle_longcall_attribute): Likewise.
	* config/sh/sh.c (sh_handle_interrupt_handler_attribute): Likewise.
	(sh_handle_sp_switch_attribute): Likewise.
	(sh_handle_trap_exit_attribute): Likewise.
	* config/sh/symbian.c (sh_symbian_dllimport_p): Likewise.
	(sh_symbian_handle_dll_attribute): Likewise.
	* config/stormy16/stormy16.c (xstormy16_handle_interrupt_attribute): Likewise.
	(xstormy16_handle_below100_attribute): Likewise.
	* config/v850/v850.c (v850_handle_interrupt_attribute): Likewise.

[testsuite]

	* gcc.dg/Wattributes-1.c: New.
	* gcc.dg/Wattributes-2.c: New.
	* gcc.dg/Wattributes-3.c: New.
	
[cp]

	* decl.c (duplicate_decls): Move warning control from if() to
	warning(OPT_*).
	* name-lookup.c (parse_using_directive): Likewise.
	* parser.c (cp_parser_elaborated_type_specifier): Likewise.
	(cp_parser_init_declarator): Likewise.
	* tree.c (handle_com_interface_attribute): Likewise.

[java]

	* class.c (set_constant_value): Move warning control from if() to
	warning(OPT_*).

Index: attribs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/attribs.c,v
retrieving revision 1.37
diff -p -U3 -r1.37 attribs.c
--- attribs.c	28 Apr 2005 05:38:30 -0000	1.37
+++ attribs.c	17 May 2005 19:25:46 -0000
@@ -172,7 +172,7 @@ decl_attributes (tree *node, tree attrib
 
       if (spec == NULL)
 	{
-	  warning (0, "%qs attribute directive ignored",
+	  warning (OPT_Wattributes, "%qs attribute directive ignored",
 		   IDENTIFIER_POINTER (name));
 	  continue;
 	}
@@ -197,7 +197,7 @@ decl_attributes (tree *node, tree attrib
 	    }
 	  else
 	    {
-	      warning (0, "%qs attribute does not apply to types",
+	      warning (OPT_Wattributes, "%qs attribute does not apply to types",
 		       IDENTIFIER_POINTER (name));
 	      continue;
 	    }
@@ -243,7 +243,7 @@ decl_attributes (tree *node, tree attrib
 	  if (TREE_CODE (*anode) != FUNCTION_TYPE
 	      && TREE_CODE (*anode) != METHOD_TYPE)
 	    {
-	      warning (0, "%qs attribute only applies to function types",
+	      warning (OPT_Wattributes, "%qs attribute only applies to function types",
 		       IDENTIFIER_POINTER (name));
 	      continue;
 	    }
Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.629
diff -p -U3 -r1.629 c-common.c
--- c-common.c	16 May 2005 19:40:35 -0000	1.629
+++ c-common.c	17 May 2005 19:25:47 -0000
@@ -3963,7 +3963,7 @@ handle_packed_attribute (tree *node, tre
      that changes what the typedef is typing.  */
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -3982,7 +3982,7 @@ handle_nocommon_attribute (tree *node, t
     DECL_COMMON (*node) = 0;
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4000,7 +4000,7 @@ handle_common_attribute (tree *node, tre
     DECL_COMMON (*node) = 1;
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4027,7 +4027,7 @@ handle_noreturn_attribute (tree *node, t
 			     TYPE_READONLY (TREE_TYPE (type)), 1));
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4046,7 +4046,7 @@ handle_noinline_attribute (tree *node, t
     DECL_UNINLINABLE (*node) = 1;
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4069,7 +4069,7 @@ handle_always_inline_attribute (tree *no
     }
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4093,7 +4093,7 @@ handle_used_attribute (tree *pnode, tree
     }
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4119,7 +4119,7 @@ handle_unused_attribute (tree *node, tre
 	TREE_USED (decl) = 1;
       else
 	{
-	  warning (0, "%qE attribute ignored", name);
+	  warning (OPT_Wattributes, "%qE attribute ignored", name);
 	  *no_add_attrs = true;
 	}
     }
@@ -4153,7 +4153,7 @@ handle_const_attribute (tree *node, tree
 			     TREE_THIS_VOLATILE (TREE_TYPE (type))));
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4197,7 +4197,7 @@ handle_transparent_union_attribute (tree
     DECL_TRANSPARENT_UNION (decl) = 1;
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4225,7 +4225,7 @@ handle_constructor_attribute (tree *node
     }
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4253,7 +4253,7 @@ handle_destructor_attribute (tree *node,
     }
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4272,7 +4272,7 @@ handle_mode_attribute (tree *node, tree 
   *no_add_attrs = true;
 
   if (TREE_CODE (TREE_VALUE (args)) != IDENTIFIER_NODE)
-    warning (0, "%qE attribute ignored", name);
+    warning (OPT_Wattributes, "%qE attribute ignored", name);
   else
     {
       int j;
@@ -4330,9 +4330,9 @@ handle_mode_attribute (tree *node, tree 
 
 	case MODE_VECTOR_INT:
 	case MODE_VECTOR_FLOAT:
-	  warning (0, "specifying vector types with __attribute__ ((mode)) "
+	  warning (OPT_Wattributes, "specifying vector types with __attribute__ ((mode)) "
 		   "is deprecated");
-	  warning (0, "use __attribute__ ((vector_size)) instead");
+	  warning (OPT_Wattributes, "use __attribute__ ((vector_size)) instead");
 	  valid_mode = vector_mode_valid_p (mode);
 	  break;
 
@@ -4597,7 +4597,7 @@ handle_alias_attribute (tree *node, tree
     }
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4621,13 +4621,13 @@ handle_visibility_attribute (tree *node,
     {
       if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE)
        {
-         warning (0, "%qE attribute ignored on non-class types", name);
+         warning (OPT_Wattributes, "%qE attribute ignored on non-class types", name);
          return NULL_TREE;
        }
     }
   else if (decl_function_context (decl) != 0 || !TREE_PUBLIC (decl))
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       return NULL_TREE;
     }
 
@@ -4645,7 +4645,7 @@ handle_visibility_attribute (tree *node,
         return NULL_TREE;
       if (TREE_CODE (decl) == IDENTIFIER_NODE)
 	{
-	   warning (0, "%qE attribute ignored on types",
+	   warning (OPT_Wattributes, "%qE attribute ignored on types",
 		    name);
 	   return NULL_TREE;
 	}
@@ -4719,7 +4719,7 @@ handle_tls_model_attribute (tree *node, 
 
   if (!DECL_THREAD_LOCAL (decl))
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
   else
@@ -4786,7 +4786,7 @@ handle_malloc_attribute (tree *node, tre
     DECL_IS_MALLOC (*node) = 1;
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4804,7 +4804,7 @@ handle_returns_twice_attribute (tree *no
     DECL_IS_RETURNS_TWICE (*node) = 1;
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4850,7 +4850,7 @@ handle_pure_attribute (tree *node, tree 
   /* ??? TODO: Support types.  */
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -4918,9 +4918,9 @@ handle_deprecated_attribute (tree *node,
 	    what = DECL_NAME (TYPE_NAME (type));
 	}
       if (what)
-	warning (0, "%qE attribute ignored for %qE", name, what);
+	warning (OPT_Wattributes, "%qE attribute ignored for %qE", name, what);
       else
-	warning (0, "%qE attribute ignored", name);
+	warning (OPT_Wattributes, "%qE attribute ignored", name);
     }
 
   return NULL_TREE;
@@ -4944,7 +4944,7 @@ handle_vector_size_attribute (tree *node
 
   if (!host_integerp (size, 1))
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       return NULL_TREE;
     }
 
@@ -5222,7 +5222,7 @@ handle_nothrow_attribute (tree *node, tr
   /* ??? TODO: Support types.  */
   else
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -5245,7 +5245,7 @@ handle_cleanup_attribute (tree *node, tr
      we'd be missing too much, since we do have attribute constructor.  */
   if (TREE_CODE (decl) != VAR_DECL || TREE_STATIC (decl))
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
       return NULL_TREE;
     }
@@ -5284,7 +5284,7 @@ handle_warn_unused_result_attribute (tre
   /* Ignore the attribute for functions not returning any value.  */
   if (VOID_TYPE_P (TREE_TYPE (*node)))
     {
-      warning (0, "%qE attribute ignored", name);
+      warning (OPT_Wattributes, "%qE attribute ignored", name);
       *no_add_attrs = true;
     }
 
@@ -5301,7 +5301,7 @@ handle_sentinel_attribute (tree *node, t
 
   if (!params)
     {
-      warning (0, "%qE attribute requires prototypes with named arguments", name);
+      warning (OPT_Wattributes, "%qE attribute requires prototypes with named arguments", name);
       *no_add_attrs = true;
     }
   else
@@ -5311,7 +5311,7 @@ handle_sentinel_attribute (tree *node, t
 
       if (VOID_TYPE_P (TREE_VALUE (params)))
         {
-	  warning (0, "%qE attribute only applies to variadic functions", name);
+	  warning (OPT_Wattributes, "%qE attribute only applies to variadic functions", name);
 	  *no_add_attrs = true;
 	}
     }
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.655
diff -p -U3 -r1.655 c-decl.c
--- c-decl.c	13 May 2005 14:00:55 -0000	1.655
+++ c-decl.c	17 May 2005 19:25:50 -0000
@@ -1496,7 +1496,7 @@ diagnose_mismatched_decls (tree newdecl,
       else if (DECL_DECLARED_INLINE_P (olddecl)
 	       && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
 	{
-	  warning (0, "%Jdeclaration of %qD with attribute noinline follows "
+	  warning (OPT_Wattributes, "%Jdeclaration of %qD with attribute noinline follows "
 		   "inline declaration ", newdecl, newdecl);
 	  warned = true;
 	}
@@ -3207,7 +3207,7 @@ start_decl (struct c_declarator *declara
       && DECL_DECLARED_INLINE_P (decl)
       && DECL_UNINLINABLE (decl)
       && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl)))
-    warning (0, "%Jinline function %qD given attribute noinline", decl, decl);
+    warning (OPT_Wattributes, "%Jinline function %qD given attribute noinline", decl, decl);
 
   /* Add this decl to the current scope.
      TEM may equal DECL or it may be a previous decl of the same name.  */
@@ -4441,7 +4441,7 @@ grokdeclarator (const struct c_declarato
 
 	    /* We don't yet implement attributes in this context.  */
 	    if (array_ptr_attrs != NULL_TREE)
-	      warning (0, "attributes in parameter array declarator ignored");
+	      warning (OPT_Wattributes, "attributes in parameter array declarator ignored");
 
 	    size_varies = 0;
 	  }
@@ -5790,7 +5790,7 @@ start_function (struct c_declspecs *decl
   if (DECL_DECLARED_INLINE_P (decl1)
       && DECL_UNINLINABLE (decl1)
       && lookup_attribute ("noinline", DECL_ATTRIBUTES (decl1)))
-    warning (0, "%Jinline function %qD given attribute noinline", decl1, decl1);
+    warning (OPT_Wattributes, "%Jinline function %qD given attribute noinline", decl1, decl1);
 
   announce_function (decl1);
 
Index: c-format.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-format.c,v
retrieving revision 1.75
diff -p -U3 -r1.75 c-format.c
--- c-format.c	13 May 2005 09:48:06 -0000	1.75
+++ c-format.c	17 May 2005 19:25:51 -0000
@@ -833,7 +833,8 @@ check_function_format (tree attrs, tree 
 			break;
 		    }
 		  if (args != 0)
-		    warning (0, "function might be possible candidate for %qs format attribute",
+		    warning (OPT_Wattributes,
+			     "function might be possible candidate for %qs format attribute",
 			     format_types[info.format_type].name);
 		}
 	    }
Index: common.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/common.opt,v
retrieving revision 1.70
diff -p -U3 -r1.70 common.opt
--- common.opt	4 May 2005 01:36:09 -0000	1.70
+++ common.opt	17 May 2005 19:25:52 -0000
@@ -57,6 +57,10 @@ Waggregate-return
 Common Var(warn_aggregate_return)
 Warn about returning structures, unions or arrays
 
+Wattributes
+Common Var(warn_attributes) Init(1)
+Warn about inappropriate attribute usage
+
 Wcast-align
 Common Var(warn_cast_align)
 Warn about pointer casts which increase alignment
Index: stor-layout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stor-layout.c,v
retrieving revision 1.231
diff -p -U3 -r1.231 stor-layout.c
--- stor-layout.c	11 May 2005 12:24:43 -0000	1.231
+++ stor-layout.c	17 May 2005 19:25:55 -0000
@@ -851,10 +851,10 @@ place_field (record_layout_info rli, tre
 	  if (TYPE_ALIGN (type) > desired_align)
 	    {
 	      if (STRICT_ALIGNMENT)
-		warning (0, "%Jpacked attribute causes inefficient alignment "
+		warning (OPT_Wattributes, "%Jpacked attribute causes inefficient alignment "
                          "for %qD", field, field);
 	      else
-		warning (0, "%Jpacked attribute is unnecessary for %qD",
+		warning (OPT_Wattributes, "%Jpacked attribute is unnecessary for %qD",
 			 field, field);
 	    }
 	}
@@ -1299,17 +1299,17 @@ finalize_record_size (record_layout_info
 		name = IDENTIFIER_POINTER (DECL_NAME (TYPE_NAME (rli->t)));
 
 	      if (STRICT_ALIGNMENT)
-		warning (0, "packed attribute causes inefficient "
+		warning (OPT_Wattributes, "packed attribute causes inefficient "
 			 "alignment for %qs", name);
 	      else
-		warning (0, "packed attribute is unnecessary for %qs", name);
+		warning (OPT_Wattributes, "packed attribute is unnecessary for %qs", name);
 	    }
 	  else
 	    {
 	      if (STRICT_ALIGNMENT)
-		warning (0, "packed attribute causes inefficient alignment");
+		warning (OPT_Wattributes, "packed attribute causes inefficient alignment");
 	      else
-		warning (0, "packed attribute is unnecessary");
+		warning (OPT_Wattributes, "packed attribute is unnecessary");
 	    }
 	}
     }
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.479
diff -p -U3 -r1.479 tree.c
--- tree.c	11 May 2005 16:25:29 -0000	1.479
+++ tree.c	17 May 2005 19:25:57 -0000
@@ -3276,7 +3276,7 @@ handle_dll_attribute (tree * pnode, tree
 	}
       if (TREE_CODE (node) != RECORD_TYPE && TREE_CODE (node) != UNION_TYPE)
 	{
-	  warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+	  warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
 	  *no_add_attrs = true;
 	}
 
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.509
diff -p -U3 -r1.509 varasm.c
--- varasm.c	8 May 2005 16:58:03 -0000	1.509
+++ varasm.c	17 May 2005 19:26:01 -0000
@@ -4683,7 +4683,7 @@ default_assemble_visibility (tree decl, 
   assemble_name (asm_out_file, name);
   fprintf (asm_out_file, "\n");
 #else
-  warning (0, "visibility attribute not supported in this configuration; ignored");
+  warning (OPT_Wattributes, "visibility attribute not supported in this configuration; ignored");
 #endif
 }
 
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.118
diff -p -U3 -r1.118 darwin.c
--- config/darwin.c	3 May 2005 11:48:23 -0000	1.118
+++ config/darwin.c	17 May 2005 19:26:01 -0000
@@ -1222,7 +1222,7 @@ darwin_handle_weak_import_attribute (tre
 {
   if (TREE_CODE (*node) != FUNCTION_DECL && TREE_CODE (*node) != VAR_DECL)
     {
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
   else
@@ -1335,7 +1335,7 @@ darwin_assemble_visibility (tree decl, i
       fputs ("\n", asm_out_file);
     }
   else
-    warning (0, "internal and protected visibility attributes not supported "
+    warning (OPT_Wattributes, "internal and protected visibility attributes not supported "
 	     "in this configuration; ignored");
 }
 
Index: config/arc/arc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arc/arc.c,v
retrieving revision 1.69
diff -p -U3 -r1.69 arc.c
--- config/arc/arc.c	5 May 2005 11:06:13 -0000	1.69
+++ config/arc/arc.c	17 May 2005 19:26:02 -0000
@@ -410,14 +410,14 @@ arc_handle_interrupt_attribute (tree *no
 
   if (TREE_CODE (value) != STRING_CST)
     {
-      warning (0, "argument of %qs attribute is not a string constant",
+      warning (OPT_Wattributes, "argument of %qs attribute is not a string constant",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
   else if (strcmp (TREE_STRING_POINTER (value), "ilink1")
 	   && strcmp (TREE_STRING_POINTER (value), "ilink2"))
     {
-      warning (0, "argument of %qs attribute is not \"ilink1\" or \"ilink2\"",
+      warning (OPT_Wattributes, "argument of %qs attribute is not \"ilink1\" or \"ilink2\"",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/arm/arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.460
diff -p -U3 -r1.460 arm.c
--- config/arm/arm.c	15 May 2005 18:29:32 -0000	1.460
+++ config/arm/arm.c	17 May 2005 19:26:07 -0000
@@ -2812,7 +2812,7 @@ arm_handle_fndecl_attribute (tree *node,
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -2830,7 +2830,7 @@ arm_handle_isr_attribute (tree *node, tr
     {
       if (TREE_CODE (*node) != FUNCTION_DECL)
 	{
-	  warning (0, "%qs attribute only applies to functions",
+	  warning (OPT_Wattributes, "%qs attribute only applies to functions",
 		   IDENTIFIER_POINTER (name));
 	  *no_add_attrs = true;
 	}
@@ -2844,7 +2844,7 @@ arm_handle_isr_attribute (tree *node, tr
 	{
 	  if (arm_isr_value (args) == ARM_FT_UNKNOWN)
 	    {
-	      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+	      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
 	      *no_add_attrs = true;
 	    }
 	}
@@ -2871,7 +2871,7 @@ arm_handle_isr_attribute (tree *node, tr
 	    }
 	  else
 	    {
-	      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+	      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
 	    }
 	}
     }
Index: config/avr/avr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/avr/avr.c,v
retrieving revision 1.135
diff -p -U3 -r1.135 avr.c
--- config/avr/avr.c	5 May 2005 15:42:03 -0000	1.135
+++ config/avr/avr.c	17 May 2005 19:26:09 -0000
@@ -4676,7 +4676,7 @@ avr_handle_progmem_attribute (tree *node
 	}
       else
 	{
-	  warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+	  warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
 	  *no_add_attrs = true;
 	}
     }
@@ -4695,7 +4695,7 @@ avr_handle_fndecl_attribute (tree *node,
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/bfin/bfin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/bfin/bfin.c,v
retrieving revision 1.6
diff -p -U3 -r1.6 bfin.c
--- config/bfin/bfin.c	2 May 2005 14:29:43 -0000	1.6
+++ config/bfin/bfin.c	17 May 2005 19:26:11 -0000
@@ -2555,7 +2555,7 @@ handle_int_attribute (tree *node, tree n
 
   if (TREE_CODE (x) != FUNCTION_TYPE)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/c4x/c4x.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/c4x/c4x.c,v
retrieving revision 1.168
diff -p -U3 -r1.168 c4x.c
--- config/c4x/c4x.c	28 Apr 2005 05:38:36 -0000	1.168
+++ config/c4x/c4x.c	17 May 2005 19:26:13 -0000
@@ -4486,7 +4486,7 @@ c4x_handle_fntype_attribute (tree *node,
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/h8300/h8300.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.c,v
retrieving revision 1.298
diff -p -U3 -r1.298 h8300.c
--- config/h8300/h8300.c	30 Apr 2005 16:04:20 -0000	1.298
+++ config/h8300/h8300.c	17 May 2005 19:26:16 -0000
@@ -5255,7 +5255,7 @@ h8300_handle_fndecl_attribute (tree *nod
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -5279,7 +5279,7 @@ h8300_handle_eightbit_data_attribute (tr
     }
   else
     {
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
 
@@ -5302,7 +5302,7 @@ h8300_handle_tiny_data_attribute (tree *
     }
   else
     {
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
 
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.820
diff -p -U3 -r1.820 i386.c
--- config/i386/i386.c	7 May 2005 14:43:53 -0000	1.820
+++ config/i386/i386.c	17 May 2005 19:26:21 -0000
@@ -1815,7 +1815,7 @@ ix86_handle_cdecl_attribute (tree *node,
       && TREE_CODE (*node) != FIELD_DECL
       && TREE_CODE (*node) != TYPE_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -1843,7 +1843,7 @@ ix86_handle_cdecl_attribute (tree *node,
 
   if (TARGET_64BIT)
     {
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
 
@@ -1861,7 +1861,7 @@ ix86_handle_regparm_attribute (tree *nod
       && TREE_CODE (*node) != FIELD_DECL
       && TREE_CODE (*node) != TYPE_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -1872,13 +1872,13 @@ ix86_handle_regparm_attribute (tree *nod
       cst = TREE_VALUE (args);
       if (TREE_CODE (cst) != INTEGER_CST)
 	{
-	  warning (0, "%qs attribute requires an integer constant argument",
+	  warning (OPT_Wattributes, "%qs attribute requires an integer constant argument",
 		   IDENTIFIER_POINTER (name));
 	  *no_add_attrs = true;
 	}
       else if (compare_tree_int (cst, REGPARM_MAX) > 0)
 	{
-	  warning (0, "argument to %qs attribute larger than %d",
+	  warning (OPT_Wattributes, "argument to %qs attribute larger than %d",
 		   IDENTIFIER_POINTER (name), REGPARM_MAX);
 	  *no_add_attrs = true;
 	}
@@ -16054,7 +16054,7 @@ ix86_handle_struct_attribute (tree *node
   if (!(type && (TREE_CODE (*type) == RECORD_TYPE
 		 || TREE_CODE (*type) == UNION_TYPE)))
     {
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
 
@@ -16063,7 +16063,7 @@ ix86_handle_struct_attribute (tree *node
 	   || ((is_attribute_p ("gcc_struct", name)
 		&& lookup_attribute ("ms_struct", TYPE_ATTRIBUTES (*type)))))
     {
-      warning (0, "%qs incompatible attribute ignored",
+      warning (OPT_Wattributes, "%qs incompatible attribute ignored",
                IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/i386/winnt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/winnt.c,v
retrieving revision 1.81
diff -p -U3 -r1.81 winnt.c
--- config/i386/winnt.c	28 Apr 2005 05:38:37 -0000	1.81
+++ config/i386/winnt.c	17 May 2005 19:26:22 -0000
@@ -71,7 +71,7 @@ ix86_handle_shared_attribute (tree *node
 {
   if (TREE_CODE (*node) != VAR_DECL)
     {
-      warning (0, "%qs attribute only applies to variables",
+      warning (OPT_Wattributes, "%qs attribute only applies to variables",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -466,7 +466,7 @@ i386_pe_encode_section_info (tree decl, 
 	warning (0, "%J'%D' defined locally after being "
 		 "referenced with dllimport linkage", decl, decl);
       else
-	warning (0, "%J'%D' redeclared without dllimport attribute "
+	warning (OPT_Wattributes, "%J'%D' redeclared without dllimport attribute "
 		 "after being referenced with dllimport linkage", decl, decl);
     }
 }
Index: config/ia64/ia64.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ia64/ia64.c,v
retrieving revision 1.364
diff -p -U3 -r1.364 ia64.c
--- config/ia64/ia64.c	16 May 2005 02:11:59 -0000	1.364
+++ config/ia64/ia64.c	17 May 2005 19:26:24 -0000
@@ -484,7 +484,7 @@ ia64_handle_model_attribute (tree *node,
     }
   else
     {
-      warning (0, "invalid argument of %qs attribute",
+      warning (OPT_Wattributes, "invalid argument of %qs attribute",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -516,7 +516,7 @@ ia64_handle_model_attribute (tree *node,
       break;
 
     default:
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
       break;
     }
Index: config/ip2k/ip2k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ip2k/ip2k.c,v
retrieving revision 1.44
diff -p -U3 -r1.44 ip2k.c
--- config/ip2k/ip2k.c	23 Apr 2005 21:28:25 -0000	1.44
+++ config/ip2k/ip2k.c	17 May 2005 19:26:25 -0000
@@ -3161,7 +3161,7 @@ ip2k_handle_progmem_attribute (tree *nod
 	}
       else
 	{
-	  warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+	  warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
 	  *no_add_attrs = true;
 	}
     }
@@ -3179,7 +3179,7 @@ ip2k_handle_fndecl_attribute (tree *node
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/m32r/m32r.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m32r/m32r.c,v
retrieving revision 1.114
diff -p -U3 -r1.114 m32r.c
--- config/m32r/m32r.c	6 May 2005 10:23:02 -0000	1.114
+++ config/m32r/m32r.c	17 May 2005 19:26:27 -0000
@@ -387,7 +387,7 @@ m32r_handle_model_attribute (tree *node 
       && arg != large_ident1
       && arg != large_ident2)
     {
-      warning (0, "invalid argument of %qs attribute",
+      warning (OPT_Wattributes, "invalid argument of %qs attribute",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/m68hc11/m68hc11.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68hc11/m68hc11.c,v
retrieving revision 1.117
diff -p -U3 -r1.117 m68hc11.c
--- config/m68hc11/m68hc11.c	8 May 2005 20:58:31 -0000	1.117
+++ config/m68hc11/m68hc11.c	17 May 2005 19:26:28 -0000
@@ -1115,7 +1115,7 @@ m68hc11_handle_page0_attribute (tree *no
     }
   else
     {
-      warning (0, "%qs attribute ignored", IDENTIFIER_POINTER (name));
+      warning (OPT_Wattributes, "%qs attribute ignored", IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
 
@@ -1151,7 +1151,7 @@ m68hc11_handle_fntype_attribute (tree *n
       && TREE_CODE (*node) != FIELD_DECL
       && TREE_CODE (*node) != TYPE_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -1236,13 +1236,13 @@ m68hc11_encode_section_info (tree decl, 
   trap_handler = lookup_attribute ("trap", func_attr) != NULL_TREE;
   if (trap_handler && is_far)
     {
-      warning (0, "%<trap%> and %<far%> attributes are not compatible, ignoring %<far%>");
+      warning (OPT_Wattributes, "%<trap%> and %<far%> attributes are not compatible, ignoring %<far%>");
       trap_handler = 0;
     }
   if (trap_handler)
     {
       if (trap_handler_symbol != 0)
-        warning (0, "%<trap%> attribute is already used");
+        warning (OPT_Wattributes, "%<trap%> attribute is already used");
       else
         trap_handler_symbol = XEXP (rtl, 0);
     }
Index: config/m68k/m68k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/m68k/m68k.c,v
retrieving revision 1.149
diff -p -U3 -r1.149 m68k.c
--- config/m68k/m68k.c	29 Apr 2005 10:01:49 -0000	1.149
+++ config/m68k/m68k.c	17 May 2005 19:26:30 -0000
@@ -373,7 +373,7 @@ m68k_handle_fndecl_attribute (tree *node
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/mcore/mcore.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mcore/mcore.c,v
retrieving revision 1.82
diff -p -U3 -r1.82 mcore.c
--- config/mcore/mcore.c	6 May 2005 13:58:16 -0000	1.82
+++ config/mcore/mcore.c	17 May 2005 19:26:31 -0000
@@ -3029,7 +3029,7 @@ mcore_handle_naked_attribute (tree * nod
     }
   else
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/ns32k/ns32k.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/ns32k/ns32k.c,v
retrieving revision 1.53
diff -p -U3 -r1.53 ns32k.c
--- config/ns32k/ns32k.c	28 Apr 2005 05:38:43 -0000	1.53
+++ config/ns32k/ns32k.c	17 May 2005 19:26:31 -0000
@@ -1106,7 +1106,7 @@ ns32k_handle_fntype_attribute (tree *nod
       && TREE_CODE (*node) != FIELD_DECL
       && TREE_CODE (*node) != TYPE_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/rs6000/rs6000.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.824
diff -p -U3 -r1.824 rs6000.c
--- config/rs6000/rs6000.c	13 May 2005 19:52:39 -0000	1.824
+++ config/rs6000/rs6000.c	17 May 2005 19:26:39 -0000
@@ -16530,7 +16530,7 @@ rs6000_handle_longcall_attribute (tree *
       && TREE_CODE (*node) != FIELD_DECL
       && TREE_CODE (*node) != TYPE_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/sh/sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.326
diff -p -U3 -r1.326 sh.c
--- config/sh/sh.c	15 May 2005 02:02:58 -0000	1.326
+++ config/sh/sh.c	17 May 2005 19:26:45 -0000
@@ -7281,7 +7281,7 @@ sh_handle_interrupt_handler_attribute (t
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -7302,21 +7302,21 @@ sh_handle_sp_switch_attribute (tree *nod
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
   else if (!pragma_interrupt)
     {
       /* The sp_switch attribute only has meaning for interrupt functions.  */
-      warning (0, "%qs attribute only applies to interrupt functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to interrupt functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
   else if (TREE_CODE (TREE_VALUE (args)) != STRING_CST)
     {
       /* The argument must be a constant string.  */
-      warning (0, "%qs attribute argument not a string constant",
+      warning (OPT_Wattributes, "%qs attribute argument not a string constant",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -7337,21 +7337,21 @@ sh_handle_trap_exit_attribute (tree *nod
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
   else if (!pragma_interrupt)
     {
       /* The trap_exit attribute only has meaning for interrupt functions.  */
-      warning (0, "%qs attribute only applies to interrupt functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to interrupt functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
   else if (TREE_CODE (TREE_VALUE (args)) != INTEGER_CST)
     {
       /* The argument must be a constant integer.  */
-      warning (0, "%qs attribute argument not an integer constant",
+      warning (OPT_Wattributes, "%qs attribute argument not an integer constant",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: config/sh/symbian.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/symbian.c,v
retrieving revision 1.9
diff -p -U3 -r1.9 symbian.c
--- config/sh/symbian.c	9 May 2005 11:24:17 -0000	1.9
+++ config/sh/symbian.c	17 May 2005 19:26:45 -0000
@@ -144,7 +144,8 @@ sh_symbian_dllimport_p (tree decl)
     {
       /* Don't warn about artificial methods.  */
       if (!DECL_ARTIFICIAL (decl))
-	warning (0, "%H function '%D' is defined after prior declaration as dllimport: attribute ignored",
+	warning (OPT_Wattributes,
+		 "%H function '%D' is defined after prior declaration as dllimport: attribute ignored",
 		 & DECL_SOURCE_LOCATION (decl), decl);
       return false;
     }
@@ -155,7 +156,8 @@ sh_symbian_dllimport_p (tree decl)
   else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
     {
       if (extra_warnings)
-	warning (0, "%Hinline function '%D' is declared as dllimport: attribute ignored.",
+	warning (OPT_Wattributes,
+		 "%Hinline function '%D' is declared as dllimport: attribute ignored.",
 		 & DECL_SOURCE_LOCATION (decl), decl);
       return false;
     }
@@ -403,14 +405,14 @@ sh_symbian_handle_dll_attribute (tree *p
 		   | (int) ATTR_FLAG_FUNCTION_NEXT
 		   | (int) ATTR_FLAG_ARRAY_NEXT))
 	{
-	  warning (0, "%qs attribute ignored", attr);
+	  warning (OPT_Wattributes, "%qs attribute ignored", attr);
 	  *no_add_attrs = true;
 	  return tree_cons (name, args, NULL_TREE);
 	}
 
       if (TREE_CODE (node) != RECORD_TYPE && TREE_CODE (node) != UNION_TYPE)
 	{
-	  warning (0, "%qs attribute ignored", attr);
+	  warning (OPT_Wattributes, "%qs attribute ignored", attr);
 	  *no_add_attrs = true;
 	}
 
Index: config/stormy16/stormy16.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/stormy16/stormy16.c,v
retrieving revision 1.76
diff -p -U3 -r1.76 stormy16.c
--- config/stormy16/stormy16.c	10 May 2005 07:44:42 -0000	1.76
+++ config/stormy16/stormy16.c	17 May 2005 19:26:46 -0000
@@ -2276,7 +2276,7 @@ xstormy16_handle_interrupt_attribute (tr
 {
   if (TREE_CODE (*node) != FUNCTION_TYPE)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
@@ -2297,14 +2297,14 @@ xstormy16_handle_below100_attribute (tre
       && TREE_CODE (*node) != POINTER_TYPE
       && TREE_CODE (*node) != TYPE_DECL)
     {
-      warning (0, "%<__BELOW100__%> attribute only applies to variables");
+      warning (OPT_Wattributes, "%<__BELOW100__%> attribute only applies to variables");
       *no_add_attrs = true;
     }
   else if (args == NULL_TREE && TREE_CODE (*node) == VAR_DECL)
     {
       if (! (TREE_PUBLIC (*node) || TREE_STATIC (*node)))
 	{
-	  warning (0, "__BELOW100__ attribute not allowed with auto storage class.");
+	  warning (OPT_Wattributes, "__BELOW100__ attribute not allowed with auto storage class.");
 	  *no_add_attrs = true;
 	}
     }
Index: config/v850/v850.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/v850/v850.c,v
retrieving revision 1.101
diff -p -U3 -r1.101 v850.c
--- config/v850/v850.c	7 May 2005 15:32:15 -0000	1.101
+++ config/v850/v850.c	17 May 2005 19:26:47 -0000
@@ -2101,7 +2101,7 @@ v850_handle_interrupt_attribute (tree * 
 {
   if (TREE_CODE (*node) != FUNCTION_DECL)
     {
-      warning (0, "%qs attribute only applies to functions",
+      warning (OPT_Wattributes, "%qs attribute only applies to functions",
 	       IDENTIFIER_POINTER (name));
       *no_add_attrs = true;
     }
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl.c,v
retrieving revision 1.1392
diff -p -U3 -r1.1392 decl.c
--- cp/decl.c	7 May 2005 02:29:32 -0000	1.1392
+++ cp/decl.c	17 May 2005 19:26:51 -0000
@@ -1053,17 +1053,17 @@ duplicate_decls (tree newdecl, tree oldd
 	       && DECL_UNINLINABLE (olddecl)
 	       && lookup_attribute ("noinline", DECL_ATTRIBUTES (olddecl)))
 	{
-	  warning (0, "%Jfunction %qD redeclared as inline", newdecl, newdecl);
-	  warning (0, "%Jprevious declaration of %qD with attribute noinline",
+	  warning (OPT_Wattributes, "%Jfunction %qD redeclared as inline", newdecl, newdecl);
+	  warning (OPT_Wattributes, "%Jprevious declaration of %qD with attribute noinline",
                    olddecl, olddecl);
 	}
       else if (DECL_DECLARED_INLINE_P (olddecl)
 	       && DECL_UNINLINABLE (newdecl)
 	       && lookup_attribute ("noinline", DECL_ATTRIBUTES (newdecl)))
 	{
-	  warning (0, "%Jfunction %qD redeclared with attribute noinline",
+	  warning (OPT_Wattributes, "%Jfunction %qD redeclared with attribute noinline",
 		   newdecl, newdecl);
-	  warning (0, "%Jprevious declaration of %qD was inline",
+	  warning (OPT_Wattributes, "%Jprevious declaration of %qD was inline",
 		   olddecl, olddecl);
 	}
     }
@@ -1804,9 +1804,9 @@ duplicate_decls (tree newdecl, tree oldd
       && DECL_VISIBILITY_SPECIFIED (newdecl)
       && DECL_VISIBILITY (newdecl) != DECL_VISIBILITY (olddecl))
     {
-      warning (0, "%J%qD: visibility attribute ignored because it",
+      warning (OPT_Wattributes, "%J%qD: visibility attribute ignored because it",
 	       newdecl, newdecl);
-      warning (0, "%Jconflicts with previous declaration here", olddecl);
+      warning (OPT_Wattributes, "%Jconflicts with previous declaration here", olddecl);
     }
   /* Choose the declaration which specified visibility.  */
   if (DECL_VISIBILITY_SPECIFIED (olddecl))
Index: cp/name-lookup.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/name-lookup.c,v
retrieving revision 1.119
diff -p -U3 -r1.119 name-lookup.c
--- cp/name-lookup.c	7 May 2005 02:29:34 -0000	1.119
+++ cp/name-lookup.c	17 May 2005 19:26:52 -0000
@@ -3207,7 +3207,7 @@ parse_using_directive (tree namespace, t
 			   DECL_NAMESPACE_ASSOCIATIONS (namespace));
 	}
       else
-	warning (0, "%qD attribute directive ignored", name);
+	warning (OPT_Wattributes, "%qD attribute directive ignored", name);
     }
 }
 
Index: cp/parser.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/parser.c,v
retrieving revision 1.329
diff -p -U3 -r1.329 parser.c
--- cp/parser.c	23 Apr 2005 21:28:55 -0000	1.329
+++ cp/parser.c	17 May 2005 19:26:56 -0000
@@ -9914,7 +9914,7 @@ cp_parser_elaborated_type_specifier (cp_
 
  	  /* Warn about attributes. They are ignored.  */
  	  if (attributes)
-	    warning (0, "type attributes are honored only at type definition");
+	    warning (OPT_Wattributes, "type attributes are honored only at type definition");
 
 	  type = xref_tag (tag_type, identifier, ts,
 			   parser->num_template_parameter_lists);
@@ -10759,7 +10759,7 @@ cp_parser_init_declarator (cp_parser* pa
      attributes -- but ignores them.  */
   if (cp_parser_allow_gnu_extensions_p (parser) && is_parenthesized_init)
     if (cp_parser_attributes_opt (parser))
-      warning (0, "attributes after parenthesized initializer ignored");
+      warning (OPT_Wattributes, "attributes after parenthesized initializer ignored");
 
   /* For an in-class declaration, use `grokfield' to create the
      declaration.  */
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/tree.c,v
retrieving revision 1.432
diff -p -U3 -r1.432 tree.c
--- cp/tree.c	23 Apr 2005 21:28:56 -0000	1.432
+++ cp/tree.c	17 May 2005 19:26:57 -0000
@@ -1767,7 +1767,7 @@ handle_com_interface_attribute (tree* no
       || !CLASS_TYPE_P (*node)
       || *node != TYPE_MAIN_VARIANT (*node))
     {
-      warning (0, "%qE attribute can only be applied to class definitions", name);
+      warning (OPT_Wattributes, "%qE attribute can only be applied to class definitions", name);
       return NULL_TREE;
     }
 
Index: doc/invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/invoke.texi,v
retrieving revision 1.620
diff -p -U3 -r1.620 invoke.texi
--- doc/invoke.texi	13 May 2005 17:51:16 -0000	1.620
+++ doc/invoke.texi	17 May 2005 19:27:05 -0000
@@ -212,7 +212,7 @@ Objective-C and Objective-C++ Dialects}.
 @item Warning Options
 @xref{Warning Options,,Options to Request or Suppress Warnings}.
 @gccoptlist{-fsyntax-only  -pedantic  -pedantic-errors @gol
--w  -Wextra  -Wall  -Waggregate-return @gol
+-w  -Wextra  -Wall  -Waggregate-return -Wno-attributes @gol
 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment @gol
 -Wconversion  -Wno-deprecated-declarations @gol
 -Wdisabled-optimization  -Wno-div-by-zero  -Wno-endif-labels @gol
@@ -2986,6 +2986,14 @@ Warn if any functions that return struct
 called.  (In languages where you can return an array, this also elicits
 a warning.)
 
+@item -Wno-attributes
+@opindex Wno-attributes
+@opindex Wattributes
+Do not warn if an unexpected @code{__attribute__} is used, such as
+unrecognized attributes, function attributes applied to variables,
+etc.  This will not stop errors for incorrect use of supported
+attributes.
+
 @item -Wstrict-prototypes @r{(C only)}
 @opindex Wstrict-prototypes
 Warn if a function is declared or defined without specifying the
Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.226
diff -p -U3 -r1.226 class.c
--- java/class.c	10 May 2005 13:23:32 -0000	1.226
+++ java/class.c	17 May 2005 19:27:06 -0000
@@ -788,9 +788,9 @@ void
 set_constant_value (tree field, tree constant)
 {
   if (field == NULL_TREE)
-    warning (0, "misplaced ConstantValue attribute (not in any field)");
+    warning (OPT_Wattributes, "misplaced ConstantValue attribute (not in any field)");
   else if (DECL_INITIAL (field) != NULL_TREE)
-    warning (0, "duplicate ConstantValue attribute for field '%s'",
+    warning (OPT_Wattributes, "duplicate ConstantValue attribute for field '%s'",
 	     IDENTIFIER_POINTER (DECL_NAME (field)));
   else
     {
Index: testsuite/gcc.dg/Wattributes-1.c
===================================================================
RCS file: testsuite/gcc.dg/Wattributes-1.c
diff -N testsuite/gcc.dg/Wattributes-1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/Wattributes-1.c	17 May 2005 19:27:13 -0000
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options -Wattributes } */
+
+void __attribute__((dj)) foo() { }		/* { dg-warning "attribute directive ignored" } */
+
+int j __attribute__((unrecognized));		/* { dg-warning "attribute directive ignored" } */
Index: testsuite/gcc.dg/Wattributes-2.c
===================================================================
RCS file: testsuite/gcc.dg/Wattributes-2.c
diff -N testsuite/gcc.dg/Wattributes-2.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/Wattributes-2.c	17 May 2005 19:27:13 -0000
@@ -0,0 +1,6 @@
+/* { dg-do compile } */
+/* { dg-options -Wno-attributes } */
+
+void __attribute__((dj)) foo() { }		/* { dg-bogus "attribute directive ignored" } */
+
+int j __attribute__((unrecognized));		/* { dg-bogus "attribute directive ignored" } */
Index: testsuite/gcc.dg/Wattributes-3.c
===================================================================
RCS file: testsuite/gcc.dg/Wattributes-3.c
diff -N testsuite/gcc.dg/Wattributes-3.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/Wattributes-3.c	17 May 2005 19:27:13 -0000
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+
+void __attribute__((dj)) foo() { }		/* { dg-warning "attribute directive ignored" } */
+
+int j __attribute__((unrecognized));		/* { dg-warning "attribute directive ignored" } */


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