This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB 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]

[COMMIT] Fix compiler warnings in ada-lang.c


This patch fixes a compiler warning in ada-lang.c:lim_warning().  GCC
was complaining about not being able to check the format string in the
warning() call.  Solved by turning lim_warning into a varargs
function.  I don't think there is another way.

Committed as obvious.

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* ada-lang.c (lim_warning): Re-implement as a varargs function.
	(decode_packed_array_type, value_subscript_packed)
	(ada_evaluate_subexp, to_fixed_range_type): Remove redundant
	argument in call to lim_warning.

Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.56
diff -u -p -r1.56 ada-lang.c
--- ada-lang.c 8 Oct 2004 09:40:12 -0000 1.56
+++ ada-lang.c 10 Oct 2004 16:00:06 -0000
@@ -477,12 +477,18 @@ cond_offset_target (CORE_ADDR address, l
    with exactly one argument rather than ...), unless the limit on the
    number of warnings has passed during the evaluation of the current
    expression.  */
+
 static void
-lim_warning (const char *format, long arg)
+lim_warning (const char *format, ...)
 {
+  va_list args;
+  va_start (args, format);
+
   warnings_issued += 1;
   if (warnings_issued <= warning_limit)
-    warning (format, arg);
+    vwarning (format, args);
+
+  va_end (args);
 }
 
 /* Note: would have used MAX_OF_TYPE and MIN_OF_TYPE macros from
@@ -1604,22 +1610,21 @@ decode_packed_array_type (struct type *t
   sym = standard_lookup (name, get_selected_block (0), VAR_DOMAIN);
   if (sym == NULL || SYMBOL_TYPE (sym) == NULL)
     {
-      lim_warning ("could not find bounds information on packed array", 0);
+      lim_warning ("could not find bounds information on packed array");
       return NULL;
     }
   shadow_type = SYMBOL_TYPE (sym);
 
   if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY)
     {
-      lim_warning ("could not understand bounds information on packed array",
-                   0);
+      lim_warning ("could not understand bounds information on packed array");
       return NULL;
     }
 
   if (sscanf (tail + sizeof ("___XP") - 1, "%ld", &bits) != 1)
     {
       lim_warning
-        ("could not understand bit size information on packed array", 0);
+	("could not understand bit size information on packed array");
       return NULL;
     }
 
@@ -1705,7 +1710,7 @@ value_subscript_packed (struct value *ar
 
           if (get_discrete_bounds (range_type, &lowerbound, &upperbound) < 0)
             {
-              lim_warning ("don't know bounds of array", 0);
+              lim_warning ("don't know bounds of array");
               lowerbound = upperbound = 0;
             }
 
@@ -7417,7 +7422,7 @@ ada_evaluate_subexp (struct type *expect
         {
         default:
           lim_warning ("Membership test incompletely implemented; "
-                       "always returns true", 0);
+                       "always returns true");
           return value_from_longest (builtin_type_int, (LONGEST) 1);
 
         case TYPE_CODE_RANGE:
@@ -8079,7 +8084,7 @@ to_fixed_range_type (char *name, struct 
           L = get_int_var_value (name_buf, &ok);
           if (!ok)
             {
-              lim_warning ("Unknown lower bound, using 1.", 1);
+              lim_warning ("Unknown lower bound, using 1.");
               L = 1;
             }
         }


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