summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-19 03:26:11 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-19 03:26:11 +0000
commite0bc5413a640e88da968397f6292c21e39e0d44a (patch)
treebea5d273a641ed7dce8b14e7877a7f9c20e1ab85
parent5e0e5c5e16ea6956d90bef7f09da2e31c9147440 (diff)
downloadgcc-e0bc5413a640e88da968397f6292c21e39e0d44a.tar.gz
* Makefile.in (c-common.o): Depend on diagnostic.h.
* c-common.c: Include diagnostic.h. (tfaff): Delete. (status_warning): New function. (check_format_info, maybe_read_dollar_number, check_format_types, finish_dollar_format_checking, check_function_format): Accept a `status' parameter. All callers changed. * c-common.h (check_function_format): Accept a `status' parameter. * c-typeck.c: Update call to `check_function_format'. cp: * cp-tree.h (check_function_format): Accept a `status' parameter. * call.c, typeck.c: Updates calls to `check_function_format'. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36524 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/c-common.c201
-rw-r--r--gcc/c-common.h2
-rw-r--r--gcc/c-typeck.c2
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/cp/cp-tree.h2
-rw-r--r--gcc/cp/typeck.c2
9 files changed, 145 insertions, 89 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 66f269b4ba0..29ba53e461b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,18 @@
+2000-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * Makefile.in (c-common.o): Depend on diagnostic.h.
+
+ * c-common.c: Include diagnostic.h.
+ (tfaff): Delete.
+ (status_warning): New function.
+ (check_format_info, maybe_read_dollar_number, check_format_types,
+ finish_dollar_format_checking, check_function_format): Accept a
+ `status' parameter. All callers changed.
+
+ * c-common.h (check_function_format): Accept a `status' parameter.
+
+ * c-typeck.c: Update call to `check_function_format'.
+
2000-09-18 Richard Henderson <rth@cygnus.com>
* c-decl.c (c_expand_body): Call mark_varargs before
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 2734aebda04..f090996cb3f 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1162,7 +1162,7 @@ s-under: $(GCC_PASSES)
c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) \
$(C_COMMON_H) flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
- $(EXPR_H)
+ $(EXPR_H) diagnostic.h
c-semantics.o : c-semantics.c $(CONFIG_H) system.h $(TREE_H) $(C_TREE_H) \
c-lex.h flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 6a1e687f42c..5ede422d311 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */
#include "c-common.h"
#include "tm_p.h"
#include "intl.h"
+#include "diagnostic.h"
#if USE_CPPLIB
#include "cpplib.h"
@@ -187,7 +188,6 @@ typedef struct
int needs_warning;
tree if_stmt;
} if_elt;
-static void tfaff PARAMS ((void));
static if_elt *if_stack;
@@ -1535,14 +1535,16 @@ typedef struct international_format_info
static international_format_info *international_format_list = NULL;
-static void check_format_info PARAMS ((function_format_info *, tree));
+static void check_format_info PARAMS ((int *, function_format_info *, tree));
+static void status_warning PARAMS ((int *, const char *, ...))
+ ATTRIBUTE_PRINTF_2;
static void init_dollar_format_checking PARAMS ((int, tree));
-static int maybe_read_dollar_number PARAMS ((const char **, int,
+static int maybe_read_dollar_number PARAMS ((int *, const char **, int,
tree, tree *));
-static void finish_dollar_format_checking PARAMS ((void));
+static void finish_dollar_format_checking PARAMS ((int *));
-static void check_format_types PARAMS ((format_wanted_type *));
+static void check_format_types PARAMS ((int *, format_wanted_type *));
/* Initialize the table of functions to perform format checking on.
The ISO C functions are always checked (whether <stdio.h> is
@@ -1686,12 +1688,6 @@ record_international_format (name, assembler_name, format_num)
info->format_num = format_num;
}
-
-static void
-tfaff ()
-{
- warning ("too few arguments for format");
-}
/* Check the argument list of a call to printf, scanf, etc.
NAME is the function identifier.
@@ -1700,7 +1696,8 @@ tfaff ()
PARAMS is the list of argument values. */
void
-check_function_format (name, assembler_name, params)
+check_function_format (status, name, assembler_name, params)
+ int *status;
tree name;
tree assembler_name;
tree params;
@@ -1715,12 +1712,46 @@ check_function_format (name, assembler_name, params)
: (info->name == name))
{
/* Yup; check it. */
- check_format_info (info, params);
+ check_format_info (status, info, params);
break;
}
}
}
+/* This function replaces `warning' inside the printf format checking
+ functions. If the `status' parameter is non-NULL, then it is
+ dereferenced and set to 1 whenever a warning is caught. Otherwise
+ it warns as usual by replicating the innards of the warning
+ function from diagnostic.c. */
+static void
+status_warning VPARAMS ((int *status, const char *msgid, ...))
+{
+#ifndef ANSI_PROTOTYPES
+ int *status;
+ const char *msgid;
+#endif
+ va_list ap;
+ diagnostic_context dc;
+
+ if (status)
+ *status = 1;
+ else
+ {
+ VA_START (ap, msgid);
+
+#ifndef ANSI_PROTOTYPES
+ status = va_arg (ap, int *);
+ msgid = va_arg (ap, const char *);
+#endif
+
+ /* This duplicates the warning function behavior. */
+ set_diagnostic_context
+ (&dc, msgid, &ap, input_filename, lineno, /* warn = */ 1);
+ report_diagnostic (&dc);
+
+ va_end (ap);
+ }
+}
/* Variables used by the checking of $ operand number formats. */
static char *dollar_arguments_used = NULL;
@@ -1775,7 +1806,8 @@ init_dollar_format_checking (first_arg_num, params)
a $ format is found, *FORMAT is updated to point just after it. */
static int
-maybe_read_dollar_number (format, dollar_needed, params, param_ptr)
+maybe_read_dollar_number (status, format, dollar_needed, params, param_ptr)
+ int *status;
const char **format;
int dollar_needed;
tree params;
@@ -1788,7 +1820,7 @@ maybe_read_dollar_number (format, dollar_needed, params, param_ptr)
{
if (dollar_needed)
{
- warning ("missing $ operand number in format");
+ status_warning (status, "missing $ operand number in format");
return -1;
}
else
@@ -1809,7 +1841,7 @@ maybe_read_dollar_number (format, dollar_needed, params, param_ptr)
{
if (dollar_needed)
{
- warning ("missing $ operand number in format");
+ status_warning (status, "missing $ operand number in format");
return -1;
}
else
@@ -1818,13 +1850,13 @@ maybe_read_dollar_number (format, dollar_needed, params, param_ptr)
*format = fcp + 1;
if (pedantic && !dollar_format_warned)
{
- warning ("ISO C does not support %%n$ operand number formats");
+ status_warning (status, "ISO C does not support %%n$ operand number formats");
dollar_format_warned = 1;
}
if (overflow_flag || argnum == 0
|| (dollar_first_arg_num && argnum > dollar_arguments_count))
{
- warning ("operand number out of range in format");
+ status_warning (status, "operand number out of range in format");
return -1;
}
if (argnum > dollar_max_arg_used)
@@ -1870,17 +1902,18 @@ maybe_read_dollar_number (format, dollar_needed, params, param_ptr)
here. */
static void
-finish_dollar_format_checking ()
+finish_dollar_format_checking (status)
+ int *status;
{
int i;
for (i = 0; i < dollar_max_arg_used; i++)
{
if (!dollar_arguments_used[i])
- warning ("format argument %d unused before used argument %d in $-style format",
+ status_warning (status, "format argument %d unused before used argument %d in $-style format",
i + 1, dollar_max_arg_used);
}
if (dollar_first_arg_num && dollar_max_arg_used < dollar_arguments_count)
- warning ("unused arguments in $-style format");
+ status_warning (status, "unused arguments in $-style format");
}
@@ -1889,7 +1922,8 @@ finish_dollar_format_checking ()
PARAMS is the list of argument values. */
static void
-check_format_info (info, params)
+check_format_info (status, info, params)
+ int *status;
function_format_info *info;
tree params;
{
@@ -1976,7 +2010,7 @@ check_format_info (info, params)
if (integer_zerop (format_tree))
{
- warning ("null format string");
+ status_warning (status, "null format string");
return;
}
if (TREE_CODE (format_tree) != ADDR_EXPR)
@@ -1987,7 +2021,7 @@ check_format_info (info, params)
string. These functions typically are declared with
first_arg_num == 0, so avoid warning in those cases. */
if (info->first_arg_num != 0 && warn_format > 1)
- warning ("format not a string literal, argument types not checked");
+ status_warning (status, "format not a string literal, argument types not checked");
return;
}
format_tree = TREE_OPERAND (format_tree, 0);
@@ -1999,16 +2033,16 @@ check_format_info (info, params)
string. These functions typically are declared with
first_arg_num == 0, so avoid warning in those cases. */
if (info->first_arg_num != 0 && warn_format > 1)
- warning ("format not a string literal, argument types not checked");
+ status_warning (status, "format not a string literal, argument types not checked");
return;
}
format_chars = TREE_STRING_POINTER (format_tree);
format_length = TREE_STRING_LENGTH (format_tree);
if (format_length <= 1)
- warning ("zero-length format string");
+ status_warning (status, "zero-length format string");
if (format_chars[--format_length] != 0)
{
- warning ("unterminated format string");
+ status_warning (status, "unterminated format string");
return;
}
/* Skip to first argument to check. */
@@ -2031,19 +2065,19 @@ check_format_info (info, params)
if (*format_chars == 0)
{
if (format_chars - TREE_STRING_POINTER (format_tree) != format_length)
- warning ("embedded `\\0' in format");
+ status_warning (status, "embedded `\\0' in format");
if (info->first_arg_num != 0 && params != 0
&& has_operand_number <= 0)
- warning ("too many arguments for format");
+ status_warning (status, "too many arguments for format");
if (has_operand_number > 0)
- finish_dollar_format_checking ();
+ finish_dollar_format_checking (status);
return;
}
if (*format_chars++ != '%')
continue;
if (*format_chars == 0)
{
- warning ("spurious trailing `%%' in format");
+ status_warning (status, "spurious trailing `%%' in format");
continue;
}
if (*format_chars == '%')
@@ -2064,7 +2098,7 @@ check_format_info (info, params)
else if (has_operand_number != 0)
{
int opnum;
- opnum = maybe_read_dollar_number (&format_chars,
+ opnum = maybe_read_dollar_number (status, &format_chars,
has_operand_number == 1,
first_fillin_param,
&main_arg_params);
@@ -2086,18 +2120,18 @@ check_format_info (info, params)
++format_chars;
}
if (wide && !non_zero_width_char)
- warning ("zero width in scanf format");
+ status_warning (status, "zero width in scanf format");
}
else if (info->format_type == strftime_format_type)
{
while (*format_chars != 0 && index ("_-0^#", *format_chars) != 0)
{
if (pedantic)
- warning ("ISO C does not support the strftime `%c' flag",
+ status_warning (status, "ISO C does not support the strftime `%c' flag",
*format_chars);
if (index (flag_chars, *format_chars) != 0)
{
- warning ("repeated `%c' flag in format",
+ status_warning (status, "repeated `%c' flag in format",
*format_chars);
++format_chars;
}
@@ -2114,7 +2148,7 @@ check_format_info (info, params)
++format_chars;
}
if (wide && pedantic)
- warning ("ISO C does not support strftime format width");
+ status_warning (status, "ISO C does not support strftime format width");
if (*format_chars == 'E' || *format_chars == 'O')
{
i = strlen (flag_chars);
@@ -2122,7 +2156,7 @@ check_format_info (info, params)
flag_chars[i] = 0;
if (*format_chars == 'E' || *format_chars == 'O')
{
- warning ("multiple E/O modifiers in format");
+ status_warning (status, "multiple E/O modifiers in format");
while (*format_chars == 'E' || *format_chars == 'O')
++format_chars;
}
@@ -2133,7 +2167,7 @@ check_format_info (info, params)
if (has_operand_number != 0)
{
int opnum;
- opnum = maybe_read_dollar_number (&format_chars,
+ opnum = maybe_read_dollar_number (status, &format_chars,
0, first_fillin_param,
&main_arg_params);
if (opnum == -1)
@@ -2148,7 +2182,7 @@ check_format_info (info, params)
while (*format_chars != 0 && index (" +#0-'I", *format_chars) != 0)
{
if (index (flag_chars, *format_chars) != 0)
- warning ("repeated `%c' flag in format", *format_chars++);
+ status_warning (status, "repeated `%c' flag in format", *format_chars++);
else
{
i = strlen (flag_chars);
@@ -2160,16 +2194,16 @@ check_format_info (info, params)
the space flag will be ignored." */
if (index (flag_chars, ' ') != 0
&& index (flag_chars, '+') != 0)
- warning ("use of both ` ' and `+' flags in format");
+ status_warning (status, "use of both ` ' and `+' flags in format");
/* "If the 0 and - flags both appear,
the 0 flag will be ignored." */
if (index (flag_chars, '0') != 0
&& index (flag_chars, '-') != 0)
- warning ("use of both `0' and `-' flags in format");
+ status_warning (status, "use of both `0' and `-' flags in format");
if (index (flag_chars, '\'') && pedantic)
- warning ("ISO C does not support the `'' format flag");
+ status_warning (status, "ISO C does not support the `'' format flag");
if (index (flag_chars, 'I') && pedantic)
- warning ("ISO C does not support the `I' format flag");
+ status_warning (status, "ISO C does not support the `I' format flag");
if (*format_chars == '*')
{
wide = TRUE;
@@ -2178,13 +2212,13 @@ check_format_info (info, params)
++format_chars;
if (params == 0)
{
- tfaff ();
+ status_warning (status, "too few arguments for format");
return;
}
if (has_operand_number != 0)
{
int opnum;
- opnum = maybe_read_dollar_number (&format_chars,
+ opnum = maybe_read_dollar_number (status, &format_chars,
has_operand_number == 1,
first_fillin_param,
&params);
@@ -2242,7 +2276,7 @@ check_format_info (info, params)
if (has_operand_number != 0)
{
int opnum;
- opnum = maybe_read_dollar_number (&format_chars,
+ opnum = maybe_read_dollar_number (status, &format_chars,
has_operand_number == 1,
first_fillin_param,
&params);
@@ -2260,7 +2294,7 @@ check_format_info (info, params)
{
if (params == 0)
{
- tfaff ();
+ status_warning (status, "too few arguments for format");
return;
}
cur_param = TREE_VALUE (params);
@@ -2327,11 +2361,11 @@ check_format_info (info, params)
{
/* Warn if the length modifier is non-standard. */
if (length_chars_std == STD_EXT)
- warning ("ISO C does not support the `%s' %s length modifier",
+ status_warning (status, "ISO C does not support the `%s' %s length modifier",
length_chars, fki->name);
else if ((length_chars_std == STD_C99 && !flag_isoc99)
|| (length_chars_std == STD_C94 && !flag_isoc94))
- warning ("ISO C89 does not support the `%s' %s length modifier",
+ status_warning (status, "ISO C89 does not support the `%s' %s length modifier",
length_chars, fki->name);
}
if (*format_chars == 'a' && info->format_type == scanf_format_type
@@ -2346,13 +2380,13 @@ check_format_info (info, params)
}
}
if (suppressed && length_chars_val != FMT_LEN_none)
- warning ("use of `*' and `%s' together in format", length_chars);
+ status_warning (status, "use of `*' and `%s' together in format", length_chars);
}
format_char = *format_chars;
if (format_char == 0
|| (info->format_type != strftime_format_type && format_char == '%'))
{
- warning ("conversion lacks type at end of format");
+ status_warning (status, "conversion lacks type at end of format");
continue;
}
format_chars++;
@@ -2363,51 +2397,51 @@ check_format_info (info, params)
if (fci->format_chars == 0)
{
if (ISGRAPH(format_char))
- warning ("unknown conversion type character `%c' in format",
+ status_warning (status, "unknown conversion type character `%c' in format",
format_char);
else
- warning ("unknown conversion type character 0x%x in format",
+ status_warning (status, "unknown conversion type character 0x%x in format",
format_char);
continue;
}
if (pedantic)
{
if (fci->std == STD_EXT)
- warning ("ISO C does not support the `%%%c' %s format",
+ status_warning (status, "ISO C does not support the `%%%c' %s format",
format_char, fki->name);
else if ((fci->std == STD_C99 && !flag_isoc99)
|| (fci->std == STD_C94 && !flag_isoc94))
- warning ("ISO C89 does not support the `%%%c' %s format",
+ status_warning (status, "ISO C89 does not support the `%%%c' %s format",
format_char, fki->name);
if (index (flag_chars, 'O') != 0)
{
if (index (fci->flag_chars, 'o') != 0)
- warning ("ISO C does not support `%%O%c'", format_char);
+ status_warning (status, "ISO C does not support `%%O%c'", format_char);
else if (!flag_isoc99 && index (fci->flag_chars, 'O') != 0)
- warning ("ISO C89 does not support `%%O%c'", format_char);
+ status_warning (status, "ISO C89 does not support `%%O%c'", format_char);
}
if (!flag_isoc99 && index (flag_chars, 'E'))
- warning ("ISO C89 does not support `%%E%c'", format_char);
+ status_warning (status, "ISO C89 does not support `%%E%c'", format_char);
}
if (wide && index (fci->flag_chars, 'w') == 0)
- warning ("width used with `%c' format", format_char);
+ status_warning (status, "width used with `%c' format", format_char);
if (index (fci->flag_chars, '3') != 0
|| (format_char == 'y' && index (flag_chars, 'E')))
- warning ("`%%%c' yields only last 2 digits of year in some locales",
+ status_warning (status, "`%%%c' yields only last 2 digits of year in some locales",
format_char);
else if (index (fci->flag_chars, '2') != 0)
- warning ("`%%%c' yields only last 2 digits of year", format_char);
+ status_warning (status, "`%%%c' yields only last 2 digits of year", format_char);
if (precise && index (fci->flag_chars, 'p') == 0)
- warning ("precision used with `%c' format", format_char);
+ status_warning (status, "precision used with `%c' format", format_char);
if (aflag && index (fci->flag_chars, 'a') == 0)
{
- warning ("`a' flag used with `%c' format", format_char);
+ status_warning (status, "`a' flag used with `%c' format", format_char);
/* To simplify the following code. */
aflag = 0;
}
/* The a flag is a GNU extension. */
else if (pedantic && aflag)
- warning ("ISO C does not support the `a' flag");
+ status_warning (status, "ISO C does not support the `a' flag");
if (info->format_type == scanf_format_type && format_char == '[')
{
/* Skip over scan set, in case it happens to have '%' in it. */
@@ -2421,18 +2455,18 @@ check_format_info (info, params)
++format_chars;
if (*format_chars != ']')
/* The end of the format string was reached. */
- warning ("no closing `]' for `%%[' format");
+ status_warning (status, "no closing `]' for `%%[' format");
}
if (suppressed)
{
if (index (fci->flag_chars, '*') == 0)
- warning ("suppression of `%c' conversion in format", format_char);
+ status_warning (status, "suppression of `%c' conversion in format", format_char);
continue;
}
for (i = 0; flag_chars[i] != 0; ++i)
{
if (index (fci->flag_chars, flag_chars[i]) == 0)
- warning ("flag `%c' used with type `%c'",
+ status_warning (status, "flag `%c' used with type `%c'",
flag_chars[i], format_char);
}
if (info->format_type == strftime_format_type)
@@ -2441,7 +2475,7 @@ check_format_info (info, params)
&& (format_char == 'd' || format_char == 'i'
|| format_char == 'o' || format_char == 'u'
|| format_char == 'x' || format_char == 'X'))
- warning ("`0' flag ignored with precision specifier and `%c' format",
+ status_warning (status, "`0' flag ignored with precision specifier and `%c' format",
format_char);
wanted_type = (fci->types[length_chars_val].type
? *fci->types[length_chars_val].type : 0);
@@ -2449,14 +2483,14 @@ check_format_info (info, params)
wanted_type_std = fci->types[length_chars_val].std;
if (wanted_type == 0)
{
- warning ("use of `%s' length modifier with `%c' type character",
+ status_warning (status, "use of `%s' length modifier with `%c' type character",
length_chars, format_char);
/* Heuristic: skip one argument when an invalid length/type
combination is encountered. */
arg_num++;
if (params == 0)
{
- tfaff ();
+ status_warning (status, "too few arguments for format");
return;
}
params = TREE_CHAIN (params);
@@ -2470,11 +2504,11 @@ check_format_info (info, params)
&& wanted_type_std > fci->std)
{
if (wanted_type_std == STD_EXT)
- warning ("ISO C does not support the `%%%s%c' %s format",
+ status_warning (status, "ISO C does not support the `%%%s%c' %s format",
length_chars, format_char, fki->name);
else if ((wanted_type_std == STD_C99 && !flag_isoc99)
|| (wanted_type_std == STD_C94 && !flag_isoc94))
- warning ("ISO C89 does not support the `%%%s%c' %s format",
+ status_warning (status, "ISO C89 does not support the `%%%s%c' %s format",
length_chars, format_char, fki->name);
}
@@ -2484,7 +2518,7 @@ check_format_info (info, params)
if (fci->pointer_count == 0 && wanted_type == void_type_node)
{
if (main_arg_num != 0)
- warning ("operand number specified for format taking no argument");
+ status_warning (status, "operand number specified for format taking no argument");
}
else
{
@@ -2498,14 +2532,14 @@ check_format_info (info, params)
++arg_num;
if (has_operand_number > 0)
{
- warning ("missing $ operand number in format");
+ status_warning (status, "missing $ operand number in format");
return;
}
else
has_operand_number = 0;
if (params == 0)
{
- tfaff ();
+ status_warning (status, "too few arguments for format");
return;
}
}
@@ -2532,7 +2566,7 @@ check_format_info (info, params)
}
if (first_wanted_type != 0)
- check_format_types (first_wanted_type);
+ check_format_types (status, first_wanted_type);
}
}
@@ -2541,7 +2575,8 @@ check_format_info (info, params)
/* Check the argument types from a single format conversion (possibly
including width and precision arguments). */
static void
-check_format_types (types)
+check_format_types (status, types)
+ int *status;
format_wanted_type *types;
{
for (; types != 0; types = types->next)
@@ -2596,7 +2631,7 @@ check_format_types (types)
&& (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'c'
|| (DECL_P (cur_param)
&& TREE_READONLY (cur_param))))))
- warning ("writing into constant object (arg %d)", arg_num);
+ status_warning (status, "writing into constant object (arg %d)", arg_num);
/* If there are extra type qualifiers beyond the first
indirection, then this makes the types technically
@@ -2606,16 +2641,16 @@ check_format_types (types)
&& (TYPE_READONLY (cur_type)
|| TYPE_VOLATILE (cur_type)
|| TYPE_RESTRICT (cur_type)))
- warning ("extra type qualifiers in format argument (arg %d)",
+ status_warning (status, "extra type qualifiers in format argument (arg %d)",
arg_num);
}
else
{
if (types->pointer_count == 1)
- warning ("format argument is not a pointer (arg %d)", arg_num);
+ status_warning (status, "format argument is not a pointer (arg %d)", arg_num);
else
- warning ("format argument is not a pointer to a pointer (arg %d)", arg_num);
+ status_warning (status, "format argument is not a pointer to a pointer (arg %d)", arg_num);
break;
}
}
@@ -2709,10 +2744,10 @@ check_format_types (types)
&& strcmp (types->wanted_type_name, that) != 0)
this = types->wanted_type_name;
if (types->name != 0)
- warning ("%s is not type %s (arg %d)", types->name, this,
+ status_warning (status, "%s is not type %s (arg %d)", types->name, this,
arg_num);
else
- warning ("%s format, %s arg (arg %d)", this, that, arg_num);
+ status_warning (status, "%s format, %s arg (arg %d)", this, that, arg_num);
}
}
}
diff --git a/gcc/c-common.h b/gcc/c-common.h
index 2477a0f33ae..bb9eee7a6ea 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -396,7 +396,7 @@ extern tree (*make_fname_decl) PARAMS ((tree, const char *, int
extern void declare_function_name PARAMS ((void));
extern void decl_attributes PARAMS ((tree, tree, tree));
extern void init_function_format_info PARAMS ((void));
-extern void check_function_format PARAMS ((tree, tree, tree));
+extern void check_function_format PARAMS ((int *, tree, tree, tree));
extern void c_apply_type_quals_to_decl PARAMS ((int, tree));
/* Print an error message for invalid operands to arith operation CODE.
NOP_EXPR is used as a special case (see truthvalue_conversion). */
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index aa5dbaaeae1..146143205c6 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -1533,7 +1533,7 @@ build_function_call (function, params)
/* Check for errors in format strings. */
if (warn_format && (name || assembler_name))
- check_function_format (name, assembler_name, coerced_params);
+ check_function_format (NULL, name, assembler_name, coerced_params);
/* Recognize certain built-in functions so we can make tree-codes
other than CALL_EXPR. We do this when it enables fold-const.c
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b0781e2deec..62fa62dd213 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-18 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * cp-tree.h (check_function_format): Accept a `status' parameter.
+
+ * call.c, typeck.c: Updates calls to `check_function_format'.
+
2000-09-17 Geoffrey Keating <geoffk@cygnus.com>
* decl2.c (handle_class_head): Always push some scope even
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index ff72fc8d1a0..5af56a47444 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4050,7 +4050,7 @@ build_over_call (cand, args, flags)
converted_args = nreverse (converted_args);
if (warn_format && (DECL_NAME (fn) || DECL_ASSEMBLER_NAME (fn)))
- check_function_format (DECL_NAME (fn), DECL_ASSEMBLER_NAME (fn),
+ check_function_format (NULL, DECL_NAME (fn), DECL_ASSEMBLER_NAME (fn),
converted_args);
/* Avoid actually calling copy constructors and copy assignment operators,
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index b7bc919791b..adea1b55d93 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -3186,7 +3186,7 @@ extern void declare_function_name PARAMS ((void));
extern void decl_attributes PARAMS ((tree, tree, tree));
extern void init_function_format_info PARAMS ((void));
extern void record_function_format PARAMS ((tree, tree, int, int, int));
-extern void check_function_format PARAMS ((tree, tree, tree));
+extern void check_function_format PARAMS ((int *, tree, tree, tree));
/* Print an error message for invalid operands to arith operation CODE.
NOP_EXPR is used as a special case (see truthvalue_conversion). */
extern void binary_op_error PARAMS ((enum tree_code));
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 3a16526b434..f6f7efd5312 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3026,7 +3026,7 @@ build_function_call_real (function, params, require_complete, flags)
/* Check for errors in format strings. */
if (warn_format && (name || assembler_name))
- check_function_format (name, assembler_name, coerced_params);
+ check_function_format (NULL, name, assembler_name, coerced_params);
/* Recognize certain built-in functions so we can make tree-codes
other than CALL_EXPR. We do this when it enables fold-const.c