On 05/22/2012 05:42 PM, Jason Merrill wrote:
On 05/22/2012 08:22 AM, Paolo Carlini wrote:
Ok, thanks. Today I wanted to concretely test and post a patch but I
noticed this other objc bit in objc-next-runtime-abi-01.c which I don't
know how to handle due to the OPT_Wall gate:

warning_at (UNKNOWN_LOCATION, OPT_Wall,
"%<-fobjc-sjlj-exceptions%> is the only supported exceptions "
"system for %<-fnext-runtime%> with %<-fobjc-abi-version%> < 2");

If the objc maintainers could help with those uses of warning_at (0 in
the objc tree, I have a patch ready for the asserts proper.

What if we just changed UNKNOWN_LOCATION to BUILTINS_LOCATION for these diagnostics?
Maybe... I don't know really, what happens with that location. Alternately, I bootstrapped and I'm finishing testing the below. Let me know, I don't have a strong opinion at the moment: if we can consistently use inform for all those general messages provided by objc, I think it would be good, I don't know how "bad" is adding warn_all.

Thanks,
Paolo.

///////////////////////
2012-05-22  Paolo Carlini  <paolo.carl...@oracle.com>

        * diagnostic.c (warning_at, error_n, error_at): Assert location !=
        UNKNOWN_LOCATION.

/c-family
2012-05-22  Paolo Carlini  <paolo.carl...@oracle.com>

        * c.opt [Wall]: Define warn_all.

/objc
2012-05-22  Paolo Carlini  <paolo.carl...@oracle.com>

        * objc-gnu-runtime-abi-01.c (objc_gnu_runtime_abi_01_init): Use
        inform instead of warning_at (0; minor formatting fixes.
        * objc-next-runtime-abi-01.c (objc_next_runtime_abi_01_init):
        Likewise.
Index: diagnostic.c
===================================================================
--- diagnostic.c        (revision 187760)
+++ diagnostic.c        (working copy)
@@ -798,6 +798,8 @@ warning_at (location_t location, int opt, const ch
   diagnostic_info diagnostic;
   va_list ap;
   bool ret;
+  
+  gcc_assert (location != UNKNOWN_LOCATION);
 
   va_start (ap, gmsgid);
   diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_WARNING);
@@ -881,6 +883,8 @@ error_n (location_t location, int n, const char *s
   diagnostic_info diagnostic;
   va_list ap;
 
+  gcc_assert (location != UNKNOWN_LOCATION);
+
   va_start (ap, plural_gmsgid);
   diagnostic_set_info_translated (&diagnostic,
                                   ngettext (singular_gmsgid, plural_gmsgid, n),
@@ -891,13 +895,15 @@ error_n (location_t location, int n, const char *s
 
 /* Same as ebove, but use location LOC instead of input_location.  */
 void
-error_at (location_t loc, const char *gmsgid, ...)
+error_at (location_t location, const char *gmsgid, ...)
 {
   diagnostic_info diagnostic;
   va_list ap;
 
+  gcc_assert (location != UNKNOWN_LOCATION);
+
   va_start (ap, gmsgid);
-  diagnostic_set_info (&diagnostic, gmsgid, &ap, loc, DK_ERROR);
+  diagnostic_set_info (&diagnostic, gmsgid, &ap, location, DK_ERROR);
   report_diagnostic (&diagnostic);
   va_end (ap);
 }
Index: c-family/c.opt
===================================================================
--- c-family/c.opt      (revision 187760)
+++ c-family/c.opt      (working copy)
@@ -265,7 +265,7 @@ C ObjC C++ ObjC++ Var(warn_address) Warning
 Warn about suspicious uses of memory addresses
 
 Wall
-C ObjC C++ ObjC++ Warning
+C ObjC C++ ObjC++ Var(warn_all) Warning
 Enable most warning messages
 
 Wassign-intercept
Index: objc/objc-next-runtime-abi-01.c
===================================================================
--- objc/objc-next-runtime-abi-01.c     (revision 187760)
+++ objc/objc-next-runtime-abi-01.c     (working copy)
@@ -146,12 +146,11 @@ bool
 objc_next_runtime_abi_01_init (objc_runtime_hooks *rthooks)
 {
   if (flag_objc_exceptions
-      && !flag_objc_sjlj_exceptions)
-    {
-      warning_at (UNKNOWN_LOCATION, OPT_Wall,
-               "%<-fobjc-sjlj-exceptions%> is the only supported exceptions "
-               "system for %<-fnext-runtime%> with %<-fobjc-abi-version%> < 
2");
-    }
+      && !flag_objc_sjlj_exceptions
+      && warn_all)
+    inform (UNKNOWN_LOCATION,
+           "%<-fobjc-sjlj-exceptions%> is the only supported exceptions "
+           "system for %<-fnext-runtime%> with %<-fobjc-abi-version%> < 2");
 
   rthooks->initialize = next_runtime_01_initialize;
   rthooks->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME;
Index: objc/objc-gnu-runtime-abi-01.c
===================================================================
--- objc/objc-gnu-runtime-abi-01.c      (revision 187760)
+++ objc/objc-gnu-runtime-abi-01.c      (working copy)
@@ -1,5 +1,5 @@
 /* GNU Runtime ABI version 8
-   Copyright (C) 2011 Free Software Foundation, Inc.
+   Copyright (C) 2011, 2012 Free Software Foundation, Inc.
    Contributed by Iain Sandoe (split from objc-act.c)
 
 This file is part of GCC.
@@ -128,15 +128,17 @@ objc_gnu_runtime_abi_01_init (objc_runtime_hooks *
   /* GNU runtime does not need the compiler to change code in order to do GC. 
*/
   if (flag_objc_gc)
     {
-      warning_at (0, 0, "%<-fobjc-gc%> is ignored for %<-fgnu-runtime%>");
+      inform (UNKNOWN_LOCATION, "%<-fobjc-gc%> is ignored for "
+             "%<-fgnu-runtime%>");
       flag_objc_gc = 0;
     }
 
-  /* Although I guess we could, we don't currently support SJLJ exceptions for 
the
-     GNU runtime.  */
+  /* Although I guess we could, we don't currently support SJLJ exceptions 
+     for the GNU runtime.  */
   if (flag_objc_sjlj_exceptions)
     {
-      inform (UNKNOWN_LOCATION, "%<-fobjc-sjlj-exceptions%> is ignored for 
%<-fgnu-runtime%>");
+      inform (UNKNOWN_LOCATION, "%<-fobjc-sjlj-exceptions%> is ignored for "
+             "%<-fgnu-runtime%>");
       flag_objc_sjlj_exceptions = 0;
     }
 

Reply via email to