From 9980154889a2bfd00c0c76176595948768be1487 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 30 Jun 2004 23:28:02 +0100 Subject: [PATCH] c-common.h (check_function_format): Remove first parameter. * c-common.h (check_function_format): Remove first parameter. * c-format.c (format_check_context): Remove status. (check_format_info, check_format_info_main, maybe_read_dollar_number, avoid_dollar_number, finish_dollar_format_checking, check_format_types, check_function_format): Remove first parameter. Don't use status_warning. (check_format_arg): Don't use status_warning. (status_warning): Remove. * c-common.c (check_function_arguments): Update call to check_function_format. cp: * call.c (build_over_call), typeck.c (build_function_call): Update calls to check_function_format. From-SVN: r83935 --- gcc/ChangeLog | 14 +++ gcc/c-common.c | 2 +- gcc/c-common.h | 2 +- gcc/c-format.c | 241 ++++++++++++++++++++--------------------------- gcc/cp/ChangeLog | 5 + gcc/cp/call.c | 2 +- gcc/cp/typeck.c | 2 +- 7 files changed, 124 insertions(+), 144 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3ea59d6eb24..bb253b74ecb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2004-06-30 Joseph S. Myers + + * c-common.h (check_function_format): Remove first parameter. + * c-format.c (format_check_context): Remove status. + (check_format_info, check_format_info_main, + maybe_read_dollar_number, avoid_dollar_number, + finish_dollar_format_checking, check_format_types, + check_function_format): Remove first parameter. Don't use + status_warning. + (check_format_arg): Don't use status_warning. + (status_warning): Remove. + * c-common.c (check_function_arguments): Update call to + check_function_format. + 2004-06-30 Eric Botcazou * config/sparc/sparc-protos.h (output_cbranch): Constify return diff --git a/gcc/c-common.c b/gcc/c-common.c index 9d07efbbfce..fda7126c274 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -5023,7 +5023,7 @@ check_function_arguments (tree attrs, tree params) /* Check for errors in format strings. */ if (warn_format) - check_function_format (NULL, attrs, params); + check_function_format (attrs, params); } /* Generic argument checking recursion routine. PARAM is the argument to diff --git a/gcc/c-common.h b/gcc/c-common.h index 454d4899237..2ae116efe07 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -627,7 +627,7 @@ extern void check_function_arguments_recurse (void (*) unsigned HOST_WIDE_INT), void *, tree, unsigned HOST_WIDE_INT); -extern void check_function_format (int *, tree, tree); +extern void check_function_format (tree, tree); extern void set_Wformat (int); extern tree handle_format_attribute (tree *, tree, tree, int, bool *); extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); diff --git a/gcc/c-format.c b/gcc/c-format.c index 0b27741184a..5551ad135c4 100644 --- a/gcc/c-format.c +++ b/gcc/c-format.c @@ -1013,28 +1013,25 @@ typedef struct format_check_results *res; function_format_info *info; tree params; - int *status; } format_check_context; -static void check_format_info (int *, function_format_info *, tree); +static void check_format_info (function_format_info *, tree); static void check_format_arg (void *, tree, unsigned HOST_WIDE_INT); -static void check_format_info_main (int *, format_check_results *, +static void check_format_info_main (format_check_results *, function_format_info *, const char *, int, tree, unsigned HOST_WIDE_INT); -static void status_warning (int *, const char *, ...) - ATTRIBUTE_GCC_DIAG(2, 3); static void init_dollar_format_checking (int, tree); -static int maybe_read_dollar_number (int *, const char **, int, +static int maybe_read_dollar_number (const char **, int, tree, tree *, const format_kind_info *); -static bool avoid_dollar_number (int *, const char *); -static void finish_dollar_format_checking (int *, format_check_results *, int); +static bool avoid_dollar_number (const char *); +static void finish_dollar_format_checking (format_check_results *, int); static const format_flag_spec *get_flag_spec (const format_flag_spec *, int, const char *); -static void check_format_types (int *, format_wanted_type *); +static void check_format_types (format_wanted_type *); /* Decode a format type from a string, returning the type, or format_type_error if not valid, in which case the caller should print an @@ -1067,7 +1064,7 @@ decode_format_type (const char *s) attribute themselves. */ void -check_function_format (int *status, tree attrs, tree params) +check_function_format (tree attrs, tree params) { tree a; @@ -1079,7 +1076,7 @@ check_function_format (int *status, tree attrs, tree params) /* Yup; check it. */ function_format_info info; decode_format_attr (TREE_VALUE (a), &info, 1); - check_format_info (status, &info, params); + check_format_info (&info, params); if (warn_missing_format_attribute && info.first_arg_num == 0 && (format_types[info.format_type].flags & (int) FMT_FLAG_ARG_CONVERT)) @@ -1118,31 +1115,6 @@ check_function_format (int *status, tree attrs, tree params) } } -/* 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 (int *status, const char *msgid, ...) -{ - diagnostic_info diagnostic ; - va_list ap; - - va_start (ap, msgid); - - if (status) - *status = 1; - else - { - /* This duplicates the warning function behavior. */ - diagnostic_set_info (&diagnostic, _(msgid), &ap, - input_location, DK_WARNING); - report_diagnostic (&diagnostic); - } - - va_end (ap); -} /* Variables used by the checking of $ operand number formats. */ static char *dollar_arguments_used = NULL; @@ -1215,7 +1187,7 @@ init_dollar_format_checking (int first_arg_num, tree params) a $ format is found, *FORMAT is updated to point just after it. */ static int -maybe_read_dollar_number (int *status, const char **format, +maybe_read_dollar_number (const char **format, int dollar_needed, tree params, tree *param_ptr, const format_kind_info *fki) { @@ -1226,7 +1198,7 @@ maybe_read_dollar_number (int *status, const char **format, { if (dollar_needed) { - status_warning (status, "missing $ operand number in format"); + warning ("missing $ operand number in format"); return -1; } else @@ -1247,7 +1219,7 @@ maybe_read_dollar_number (int *status, const char **format, { if (dollar_needed) { - status_warning (status, "missing $ operand number in format"); + warning ("missing $ operand number in format"); return -1; } else @@ -1256,15 +1228,14 @@ maybe_read_dollar_number (int *status, const char **format, *format = fcp + 1; if (pedantic && !dollar_format_warned) { - status_warning (status, - "%s does not support %%n$ operand number formats", - C_STD_NAME (STD_EXT)); + warning ("%s does not support %%n$ operand number formats", + C_STD_NAME (STD_EXT)); dollar_format_warned = 1; } if (overflow_flag || argnum == 0 || (dollar_first_arg_num && argnum > dollar_arguments_count)) { - status_warning (status, "operand number out of range in format"); + warning ("operand number out of range in format"); return -1; } if (argnum > dollar_max_arg_used) @@ -1286,9 +1257,8 @@ maybe_read_dollar_number (int *status, const char **format, && dollar_arguments_used[argnum - 1] == 1) { dollar_arguments_used[argnum - 1] = 2; - status_warning (status, - "format argument %d used more than once in %s format", - argnum, fki->name); + warning ("format argument %d used more than once in %s format", + argnum, fki->name); } else dollar_arguments_used[argnum - 1] = 1; @@ -1314,7 +1284,7 @@ maybe_read_dollar_number (int *status, const char **format, a $; give a diagnostic and return true if it does, false otherwise. */ static bool -avoid_dollar_number (int *status, const char *format) +avoid_dollar_number (const char *format) { if (!ISDIGIT (*format)) return false; @@ -1322,9 +1292,7 @@ avoid_dollar_number (int *status, const char *format) format++; if (*format == '$') { - status_warning (status, - "$ operand number used after format" - " without operand number"); + warning ("$ operand number used after format without operand number"); return true; } return false; @@ -1342,7 +1310,7 @@ avoid_dollar_number (int *status, const char *format) pointers. */ static void -finish_dollar_format_checking (int *status, format_check_results *res, int pointer_gap_ok) +finish_dollar_format_checking (format_check_results *res, int pointer_gap_ok) { int i; bool found_pointer_gap = false; @@ -1354,8 +1322,8 @@ finish_dollar_format_checking (int *status, format_check_results *res, int point || dollar_arguments_pointer_p[i])) found_pointer_gap = true; else - status_warning (status, "format argument %d unused before used argument %d in $-style format", - i + 1, dollar_max_arg_used); + warning ("format argument %d unused before used argument %d in $-style format", + i + 1, dollar_max_arg_used); } } if (found_pointer_gap @@ -1405,7 +1373,7 @@ get_flag_spec (const format_flag_spec *spec, int flag, const char *predicates) PARAMS is the list of argument values. */ static void -check_format_info (int *status, function_format_info *info, tree params) +check_format_info (function_format_info *info, tree params) { format_check_context format_ctx; unsigned HOST_WIDE_INT arg_num; @@ -1437,7 +1405,6 @@ check_format_info (int *status, function_format_info *info, tree params) format_ctx.res = &res; format_ctx.info = info; format_ctx.params = params; - format_ctx.status = status; check_function_arguments_recurse (check_format_arg, &format_ctx, format_tree, arg_num); @@ -1452,7 +1419,7 @@ check_format_info (int *status, function_format_info *info, tree params) /* For strftime-like formats, warn for not checking the format string; but there are no arguments to check. */ if (warn_format_nonliteral) - status_warning (status, "format not a string literal, format string not checked"); + warning ("format not a string literal, format string not checked"); } else if (info->first_arg_num != 0) { @@ -1466,9 +1433,9 @@ check_format_info (int *status, function_format_info *info, tree params) ++arg_num; } if (params == 0 && (warn_format_nonliteral || warn_format_security)) - status_warning (status, "format not a string literal and no format arguments"); + warning ("format not a string literal and no format arguments"); else if (warn_format_nonliteral) - status_warning (status, "format not a string literal, argument types not checked"); + warning ("format not a string literal, argument types not checked"); } } @@ -1481,20 +1448,20 @@ check_format_info (int *status, function_format_info *info, tree params) case of extra format arguments. */ if (res.number_extra_args > 0 && res.number_non_literal == 0 && res.number_other == 0 && warn_format_extra_args) - status_warning (status, "too many arguments for format"); + warning ("too many arguments for format"); if (res.number_dollar_extra_args > 0 && res.number_non_literal == 0 && res.number_other == 0 && warn_format_extra_args) - status_warning (status, "unused arguments in $-style format"); + warning ("unused arguments in $-style format"); if (res.number_empty > 0 && res.number_non_literal == 0 && res.number_other == 0 && warn_format_zero_length) - status_warning (status, "zero-length %s format string", - format_types[info->format_type].name); + warning ("zero-length %s format string", + format_types[info->format_type].name); if (res.number_wide > 0) - status_warning (status, "format is a wide character string"); + warning ("format is a wide character string"); if (res.number_unterminated > 0) - status_warning (status, "unterminated format string"); + warning ("unterminated format string"); } /* Callback from check_function_arguments_recurse to check a @@ -1510,7 +1477,6 @@ check_format_arg (void *ctx, tree format_tree, format_check_results *res = format_ctx->res; function_format_info *info = format_ctx->info; tree params = format_ctx->params; - int *status = format_ctx->status; int format_length; HOST_WIDE_INT offset; @@ -1647,7 +1613,7 @@ check_format_arg (void *ctx, tree format_tree, will decrement it if it finds there are extra arguments, but this way need not adjust it for every return. */ res->number_other++; - check_format_info_main (status, res, info, format_chars, format_length, + check_format_info_main (res, info, format_chars, format_length, params, arg_num); } @@ -1660,7 +1626,7 @@ check_format_arg (void *ctx, tree format_tree, argument in the list of arguments. */ static void -check_format_info_main (int *status, format_check_results *res, +check_format_info_main (format_check_results *res, function_format_info *info, const char *format_chars, int format_length, tree params, unsigned HOST_WIDE_INT arg_num) @@ -1704,7 +1670,7 @@ check_format_info_main (int *status, format_check_results *res, if (*format_chars == 0) { if (format_chars - orig_format_chars != format_length) - status_warning (status, "embedded %<\\0%> in format"); + warning ("embedded %<\\0%> in format"); if (info->first_arg_num != 0 && params != 0 && has_operand_number <= 0) { @@ -1712,14 +1678,14 @@ check_format_info_main (int *status, format_check_results *res, res->number_extra_args++; } if (has_operand_number > 0) - finish_dollar_format_checking (status, res, fki->flags & (int) FMT_FLAG_DOLLAR_GAP_POINTER_OK); + finish_dollar_format_checking (res, fki->flags & (int) FMT_FLAG_DOLLAR_GAP_POINTER_OK); return; } if (*format_chars++ != '%') continue; if (*format_chars == 0) { - status_warning (status, "spurious trailing %<%%%> in format"); + warning ("spurious trailing %<%%%> in format"); continue; } if (*format_chars == '%') @@ -1736,7 +1702,7 @@ check_format_info_main (int *status, format_check_results *res, is not used here, we can't immediately conclude this is a format without them, since it could be printf %m or scanf %*. */ int opnum; - opnum = maybe_read_dollar_number (status, &format_chars, 0, + opnum = maybe_read_dollar_number (&format_chars, 0, first_fillin_param, &main_arg_params, fki); if (opnum == -1) @@ -1749,7 +1715,7 @@ check_format_info_main (int *status, format_check_results *res, } else if (fki->flags & FMT_FLAG_USE_DOLLAR) { - if (avoid_dollar_number (status, format_chars)) + if (avoid_dollar_number (format_chars)) return; } @@ -1763,7 +1729,7 @@ check_format_info_main (int *status, format_check_results *res, *format_chars, NULL); if (strchr (flag_chars, *format_chars) != 0) { - status_warning (status, "repeated %s in format", _(s->name)); + warning ("repeated %s in format", _(s->name)); } else { @@ -1776,7 +1742,7 @@ check_format_info_main (int *status, format_check_results *res, ++format_chars; if (*format_chars == 0) { - status_warning (status, "missing fill character at end of strfmon format"); + warning ("missing fill character at end of strfmon format"); return; } } @@ -1797,7 +1763,7 @@ check_format_info_main (int *status, format_check_results *res, if (has_operand_number != 0) { int opnum; - opnum = maybe_read_dollar_number (status, &format_chars, + opnum = maybe_read_dollar_number (&format_chars, has_operand_number == 1, first_fillin_param, ¶ms, fki); @@ -1813,14 +1779,14 @@ check_format_info_main (int *status, format_check_results *res, } else { - if (avoid_dollar_number (status, format_chars)) + if (avoid_dollar_number (format_chars)) return; } if (info->first_arg_num != 0) { if (params == 0) { - status_warning (status, "too few arguments for format"); + warning ("too few arguments for format"); return; } cur_param = TREE_VALUE (params); @@ -1861,8 +1827,7 @@ check_format_info_main (int *status, format_check_results *res, } if (found_width && !non_zero_width_char && (fki->flags & (int) FMT_FLAG_ZERO_WIDTH_BAD)) - status_warning (status, "zero width in %s format", - fki->name); + warning ("zero width in %s format", fki->name); if (found_width) { i = strlen (flag_chars); @@ -1880,8 +1845,7 @@ check_format_info_main (int *status, format_check_results *res, flag_chars[i++] = fki->left_precision_char; flag_chars[i] = 0; if (!ISDIGIT (*format_chars)) - status_warning (status, "empty left precision in %s format", - fki->name); + warning ("empty left precision in %s format", fki->name); while (ISDIGIT (*format_chars)) ++format_chars; } @@ -1901,7 +1865,7 @@ check_format_info_main (int *status, format_check_results *res, if (has_operand_number != 0) { int opnum; - opnum = maybe_read_dollar_number (status, &format_chars, + opnum = maybe_read_dollar_number (&format_chars, has_operand_number == 1, first_fillin_param, ¶ms, fki); @@ -1917,14 +1881,14 @@ check_format_info_main (int *status, format_check_results *res, } else { - if (avoid_dollar_number (status, format_chars)) + if (avoid_dollar_number (format_chars)) return; } if (info->first_arg_num != 0) { if (params == 0) { - status_warning (status, "too few arguments for format"); + warning ("too few arguments for format"); return; } cur_param = TREE_VALUE (params); @@ -1954,8 +1918,7 @@ check_format_info_main (int *status, format_check_results *res, { if (!(fki->flags & (int) FMT_FLAG_EMPTY_PREC_OK) && !ISDIGIT (*format_chars)) - status_warning (status, "empty precision in %s format", - fki->name); + warning ("empty precision in %s format", fki->name); while (ISDIGIT (*format_chars)) ++format_chars; } @@ -1994,9 +1957,9 @@ check_format_info_main (int *status, format_check_results *res, { /* Warn if the length modifier is non-standard. */ if (ADJ_STD (length_chars_std) > C_STD_VER) - status_warning (status, "%s does not support the %qs %s length modifier", - C_STD_NAME (length_chars_std), length_chars, - fki->name); + warning ("%s does not support the %qs %s length modifier", + C_STD_NAME (length_chars_std), length_chars, + fki->name); } } @@ -2010,7 +1973,7 @@ check_format_info_main (int *status, format_check_results *res, { const format_flag_spec *s = get_flag_spec (flag_specs, *format_chars, NULL); - status_warning (status, "repeated %s in format", _(s->name)); + warning ("repeated %s in format", _(s->name)); } else { @@ -2044,7 +2007,7 @@ check_format_info_main (int *status, format_check_results *res, || (!(fki->flags & (int) FMT_FLAG_FANCY_PERCENT_OK) && format_char == '%')) { - status_warning (status, "conversion lacks type at end of format"); + warning ("conversion lacks type at end of format"); continue; } format_chars++; @@ -2055,18 +2018,18 @@ check_format_info_main (int *status, format_check_results *res, if (fci->format_chars == 0) { if (ISGRAPH(format_char)) - status_warning (status, "unknown conversion type character %qc in format", + warning ("unknown conversion type character %qc in format", format_char); else - status_warning (status, "unknown conversion type character 0x%x in format", + warning ("unknown conversion type character 0x%x in format", format_char); continue; } if (pedantic) { if (ADJ_STD (fci->std) > C_STD_VER) - status_warning (status, "%s does not support the %<%%%c%> %s format", - C_STD_NAME (fci->std), format_char, fki->name); + warning ("%s does not support the %<%%%c%> %s format", + C_STD_NAME (fci->std), format_char, fki->name); } /* Validate the individual flags used, removing any that are invalid. */ @@ -2081,8 +2044,8 @@ check_format_info_main (int *status, format_check_results *res, continue; if (strchr (fci->flag_chars, flag_chars[i]) == 0) { - status_warning (status, "%s used with %<%%%c%> %s format", - _(s->name), format_char, fki->name); + warning ("%s used with %<%%%c%> %s format", + _(s->name), format_char, fki->name); d++; continue; } @@ -2090,8 +2053,8 @@ check_format_info_main (int *status, format_check_results *res, { const format_flag_spec *t; if (ADJ_STD (s->std) > C_STD_VER) - status_warning (status, "%s does not support %s", - C_STD_NAME (s->std), _(s->long_name)); + warning ("%s does not support %s", + C_STD_NAME (s->std), _(s->long_name)); t = get_flag_spec (flag_specs, flag_chars[i], fci->flags2); if (t != NULL && ADJ_STD (t->std) > ADJ_STD (s->std)) { @@ -2099,9 +2062,9 @@ check_format_info_main (int *status, format_check_results *res, ? t->long_name : s->long_name); if (ADJ_STD (t->std) > C_STD_VER) - status_warning (status, "%s does not support %s with the %<%%%c%> %s format", - C_STD_NAME (t->std), _(long_name), - format_char, fki->name); + warning ("%s does not support %s with the %<%%%c%> %s format", + C_STD_NAME (t->std), _(long_name), + format_char, fki->name); } } } @@ -2132,22 +2095,22 @@ check_format_info_main (int *status, format_check_results *res, if (bad_flag_pairs[i].ignored) { if (bad_flag_pairs[i].predicate != 0) - status_warning (status, "%s ignored with %s and %<%%%c%> %s format", - _(s->name), _(t->name), format_char, - fki->name); + warning ("%s ignored with %s and %<%%%c%> %s format", + _(s->name), _(t->name), format_char, + fki->name); else - status_warning (status, "%s ignored with %s in %s format", - _(s->name), _(t->name), fki->name); + warning ("%s ignored with %s in %s format", + _(s->name), _(t->name), fki->name); } else { if (bad_flag_pairs[i].predicate != 0) - status_warning (status, "use of %s and %s together with %<%%%c%> %s format", - _(s->name), _(t->name), format_char, - fki->name); + warning ("use of %s and %s together with %<%%%c%> %s format", + _(s->name), _(t->name), format_char, + fki->name); else - status_warning (status, "use of %s and %s together in %s format", - _(s->name), _(t->name), fki->name); + warning ("use of %s and %s together in %s format", + _(s->name), _(t->name), fki->name); } } @@ -2165,10 +2128,10 @@ check_format_info_main (int *status, format_check_results *res, else if (strchr (fci->flags2, '2') != 0) y2k_level = 2; if (y2k_level == 3) - status_warning (status, "%<%%%c%> yields only last 2 digits of year in some locales", - format_char); + warning ("%<%%%c%> yields only last 2 digits of year in some locales", + format_char); else if (y2k_level == 2) - status_warning (status, "%<%%%c%> yields only last 2 digits of year", format_char); + warning ("%<%%%c%> yields only last 2 digits of year", format_char); } if (strchr (fci->flags2, '[') != 0) @@ -2184,7 +2147,7 @@ check_format_info_main (int *status, format_check_results *res, ++format_chars; if (*format_chars != ']') /* The end of the format string was reached. */ - status_warning (status, "no closing %<]%> for %<%%[%> format"); + warning ("no closing %<]%> for %<%%[%> format"); } wanted_type = 0; @@ -2197,14 +2160,14 @@ check_format_info_main (int *status, format_check_results *res, wanted_type_std = fci->types[length_chars_val].std; if (wanted_type == 0) { - status_warning (status, "use of %qs length modifier with %qc type character", - length_chars, format_char); + warning ("use of %qs length modifier with %qc type character", + length_chars, format_char); /* Heuristic: skip one argument when an invalid length/type combination is encountered. */ arg_num++; if (params == 0) { - status_warning (status, "too few arguments for format"); + warning ("too few arguments for format"); return; } params = TREE_CHAIN (params); @@ -2218,9 +2181,9 @@ check_format_info_main (int *status, format_check_results *res, && ADJ_STD (wanted_type_std) > ADJ_STD (fci->std)) { if (ADJ_STD (wanted_type_std) > C_STD_VER) - status_warning (status, "%s does not support the %<%%%s%c%> %s format", - C_STD_NAME (wanted_type_std), length_chars, - format_char, fki->name); + warning ("%s does not support the %<%%%s%c%> %s format", + C_STD_NAME (wanted_type_std), length_chars, + format_char, fki->name); } } @@ -2233,9 +2196,9 @@ check_format_info_main (int *status, format_check_results *res, if (main_arg_num != 0) { if (suppressed) - status_warning (status, "operand number specified with suppressed assignment"); + warning ("operand number specified with suppressed assignment"); else - status_warning (status, "operand number specified for format taking no argument"); + warning ("operand number specified for format taking no argument"); } } else @@ -2250,14 +2213,14 @@ check_format_info_main (int *status, format_check_results *res, ++arg_num; if (has_operand_number > 0) { - status_warning (status, "missing $ operand number in format"); + warning ("missing $ operand number in format"); return; } else has_operand_number = 0; if (params == 0) { - status_warning (status, "too few arguments for format"); + warning ("too few arguments for format"); return; } } @@ -2292,7 +2255,7 @@ check_format_info_main (int *status, format_check_results *res, } if (first_wanted_type != 0) - check_format_types (status, first_wanted_type); + check_format_types (first_wanted_type); } } @@ -2301,7 +2264,7 @@ check_format_info_main (int *status, format_check_results *res, /* Check the argument types from a single format conversion (possibly including width and precision arguments). */ static void -check_format_types (int *status, format_wanted_type *types) +check_format_types (format_wanted_type *types) { for (; types != 0; types = types->next) { @@ -2346,18 +2309,16 @@ check_format_types (int *status, format_wanted_type *types) && i == 0 && cur_param != 0 && integer_zerop (cur_param)) - status_warning (status, - "writing through null pointer (arg %d)", - arg_num); + warning ("writing through null pointer (arg %d)", + arg_num); /* Check for reading through a NULL pointer. */ if (types->reading_from_flag && i == 0 && cur_param != 0 && integer_zerop (cur_param)) - status_warning (status, - "reading through null pointer (arg %d)", - arg_num); + warning ("reading through null pointer (arg %d)", + arg_num); if (cur_param != 0 && TREE_CODE (cur_param) == ADDR_EXPR) cur_param = TREE_OPERAND (cur_param, 0); @@ -2376,7 +2337,7 @@ check_format_types (int *status, format_wanted_type *types) && (TREE_CODE_CLASS (TREE_CODE (cur_param)) == 'c' || (DECL_P (cur_param) && TREE_READONLY (cur_param)))))) - status_warning (status, "writing into constant object (arg %d)", arg_num); + warning ("writing into constant object (arg %d)", arg_num); /* If there are extra type qualifiers beyond the first indirection, then this makes the types technically @@ -2386,16 +2347,16 @@ check_format_types (int *status, format_wanted_type *types) && (TYPE_READONLY (cur_type) || TYPE_VOLATILE (cur_type) || TYPE_RESTRICT (cur_type))) - status_warning (status, "extra type qualifiers in format argument (arg %d)", + warning ("extra type qualifiers in format argument (arg %d)", arg_num); } else { if (types->pointer_count == 1) - status_warning (status, "format argument is not a pointer (arg %d)", arg_num); + warning ("format argument is not a pointer (arg %d)", arg_num); else - status_warning (status, "format argument is not a pointer to a pointer (arg %d)", arg_num); + warning ("format argument is not a pointer to a pointer (arg %d)", arg_num); break; } } @@ -2494,10 +2455,10 @@ check_format_types (int *status, format_wanted_type *types) && strcmp (types->wanted_type_name, that) != 0) this = types->wanted_type_name; if (types->name != 0) - status_warning (status, "%s is not type %s (arg %d)", types->name, this, + warning ("%s is not type %s (arg %d)", types->name, this, arg_num); else - status_warning (status, "%s format, %s arg (arg %d)", this, that, arg_num); + warning ("%s format, %s arg (arg %d)", this, that, arg_num); } } } diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b094bac93f0..4174c4028bb 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2004-06-30 Joseph S. Myers + + * call.c (build_over_call), typeck.c (build_function_call): Update + calls to check_function_format. + 2004-06-30 Richard Henderson * call.c (build_over_call): Use __builtin_memcpy for copying diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 99603ea3eaa..290fd6b2b43 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4724,7 +4724,7 @@ build_over_call (struct z_candidate *cand, int flags) converted_args = nreverse (converted_args); if (warn_format) - check_function_format (NULL, TYPE_ATTRIBUTES (TREE_TYPE (fn)), + check_function_format (TYPE_ATTRIBUTES (TREE_TYPE (fn)), converted_args); /* Avoid actually calling copy constructors and copy assignment operators, diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 2dc21db1326..1dfb3375067 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -2486,7 +2486,7 @@ build_function_call (tree function, tree params) /* Check for errors in format strings. */ if (warn_format) - check_function_format (NULL, TYPE_ATTRIBUTES (fntype), coerced_params); + check_function_format (TYPE_ATTRIBUTES (fntype), coerced_params); return build_cxx_call (function, coerced_params); } -- 2.30.2