gcc: clean some warnings from -Wformat-security

Obtained from:	Apple GCC 4.2 - 5646 (Radar 5764921)
MFC after:	1 week
This commit is contained in:
Pedro F. Giffuni 2013-12-20 20:57:13 +00:00
parent ac4030b7e1
commit 5c3c610835
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=259666
13 changed files with 24 additions and 24 deletions

View File

@ -6014,11 +6014,11 @@ c_parse_error (const char *gmsgid, enum cpp_ttype token, tree value)
message = NULL; message = NULL;
} }
else else
error (gmsgid); error (gmsgid, "");
if (message) if (message)
{ {
error (message); error (message, "");
free (message); free (message);
} }
#undef catenate_messages #undef catenate_messages

View File

@ -80,7 +80,7 @@ convert (tree type, tree expr)
if ((invalid_conv_diag if ((invalid_conv_diag
= targetm.invalid_conversion (TREE_TYPE (expr), type))) = targetm.invalid_conversion (TREE_TYPE (expr), type)))
{ {
error (invalid_conv_diag); error (invalid_conv_diag, "");
return error_mark_node; return error_mark_node;
} }

View File

@ -72,7 +72,7 @@ free_path (struct cpp_dir *path, int reason)
case REASON_DUP_SYS: case REASON_DUP_SYS:
fprintf (stderr, _("ignoring duplicate directory \"%s\"\n"), path->name); fprintf (stderr, _("ignoring duplicate directory \"%s\"\n"), path->name);
if (reason == REASON_DUP_SYS) if (reason == REASON_DUP_SYS)
fprintf (stderr, fprintf (stderr, "%s",
_(" as it is a non-system directory that duplicates a system directory\n")); _(" as it is a non-system directory that duplicates a system directory\n"));
break; break;
@ -292,16 +292,16 @@ merge_include_chains (cpp_reader *pfile, int verbose)
{ {
struct cpp_dir *p; struct cpp_dir *p;
fprintf (stderr, _("#include \"...\" search starts here:\n")); fprintf (stderr, "%s", _("#include \"...\" search starts here:\n"));
for (p = heads[QUOTE];; p = p->next) for (p = heads[QUOTE];; p = p->next)
{ {
if (p == heads[BRACKET]) if (p == heads[BRACKET])
fprintf (stderr, _("#include <...> search starts here:\n")); fprintf (stderr, "%s", _("#include <...> search starts here:\n"));
if (!p) if (!p)
break; break;
fprintf (stderr, " %s\n", p->name); fprintf (stderr, " %s\n", p->name);
} }
fprintf (stderr, _("End of search list.\n")); fprintf (stderr, "%s", _("End of search list.\n"));
} }
} }

View File

@ -2584,7 +2584,7 @@ convert_arguments (tree typelist, tree values, tree function, tree fundecl)
else if ((invalid_func_diag = else if ((invalid_func_diag =
targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val))) targetm.calls.invalid_arg_for_unprototyped_fn (typelist, fundecl, val)))
{ {
error (invalid_func_diag); error (invalid_func_diag, "");
return error_mark_node; return error_mark_node;
} }
else else
@ -2781,7 +2781,7 @@ build_unary_op (enum tree_code code, tree xarg, int flag)
if ((invalid_op_diag if ((invalid_op_diag
= targetm.invalid_unary_op (code, TREE_TYPE (xarg)))) = targetm.invalid_unary_op (code, TREE_TYPE (xarg))))
{ {
error (invalid_op_diag); error (invalid_op_diag, "");
return error_mark_node; return error_mark_node;
} }
@ -7819,7 +7819,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if ((invalid_op_diag if ((invalid_op_diag
= targetm.invalid_binary_op (code, type0, type1))) = targetm.invalid_binary_op (code, type0, type1)))
{ {
error (invalid_op_diag); error (invalid_op_diag, "");
return error_mark_node; return error_mark_node;
} }

View File

@ -830,7 +830,7 @@ dump_cfg_bb_info (FILE *file, basic_block bb)
else else
fprintf (file, ", "); fprintf (file, ", ");
first = false; first = false;
fputs (bb_bitnames[i], file); fprintf (file, "%s", bb_bitnames[i]);
} }
if (!first) if (!first)
fprintf (file, ")"); fprintf (file, ")");

View File

@ -1562,10 +1562,10 @@ collect_execute (const char *prog, char **argv, const char *outname,
if (err != 0) if (err != 0)
{ {
errno = err; errno = err;
fatal_perror (errmsg); fatal_perror ("%s", errmsg);
} }
else else
fatal (errmsg); fatal ("%s", errmsg);
} }
return pex; return pex;
@ -2050,10 +2050,10 @@ scan_prog_file (const char *prog_name, enum pass which_pass)
if (err != 0) if (err != 0)
{ {
errno = err; errno = err;
fatal_perror (errmsg); fatal_perror ("%s", errmsg);
} }
else else
fatal (errmsg); fatal ("%s", errmsg);
} }
int_handler = (void (*) (int)) signal (SIGINT, SIG_IGN); int_handler = (void (*) (int)) signal (SIGINT, SIG_IGN);

View File

@ -615,7 +615,7 @@ ocp_convert (tree type, tree expr, int convtype, int flags)
if ((invalid_conv_diag if ((invalid_conv_diag
= targetm.invalid_conversion (TREE_TYPE (expr), type))) = targetm.invalid_conversion (TREE_TYPE (expr), type)))
{ {
error (invalid_conv_diag); error (invalid_conv_diag, "");
return error_mark_node; return error_mark_node;
} }

View File

@ -8925,7 +8925,7 @@ tsubst_copy_and_build (tree t,
/*template_arg_p=*/false, /*template_arg_p=*/false,
&error_msg); &error_msg);
if (error_msg) if (error_msg)
error (error_msg); error ("%s", error_msg);
if (!function_p && TREE_CODE (decl) == IDENTIFIER_NODE) if (!function_p && TREE_CODE (decl) == IDENTIFIER_NODE)
decl = unqualified_name_lookup_error (decl); decl = unqualified_name_lookup_error (decl);
return decl; return decl;

View File

@ -3107,7 +3107,7 @@ build_binary_op (enum tree_code code, tree orig_op0, tree orig_op1,
if ((invalid_op_diag if ((invalid_op_diag
= targetm.invalid_binary_op (code, type0, type1))) = targetm.invalid_binary_op (code, type0, type1)))
{ {
error (invalid_op_diag); error (invalid_op_diag, "");
return error_mark_node; return error_mark_node;
} }
@ -4034,7 +4034,7 @@ build_unary_op (enum tree_code code, tree xarg, int noconvert)
: code), : code),
TREE_TYPE (xarg)))) TREE_TYPE (xarg))))
{ {
error (invalid_op_diag); error (invalid_op_diag, "");
return error_mark_node; return error_mark_node;
} }

View File

@ -992,7 +992,7 @@ fold_overflow_warning (const char* gmsgid, enum warn_strict_overflow_code wc)
} }
} }
else if (issue_strict_overflow_warning (wc)) else if (issue_strict_overflow_warning (wc))
warning (OPT_Wstrict_overflow, gmsgid); warning (OPT_Wstrict_overflow, "%s", gmsgid);
} }
/* Return true if the built-in mathematical function specified by CODE /* Return true if the built-in mathematical function specified by CODE

View File

@ -2974,7 +2974,7 @@ execute (void)
if (errmsg != NULL) if (errmsg != NULL)
{ {
if (err == 0) if (err == 0)
fatal (errmsg); fatal ("%s", errmsg);
else else
{ {
errno = err; errno = err;
@ -6525,7 +6525,7 @@ main (int argc, char **argv)
if (! verbose_flag) if (! verbose_flag)
{ {
printf (_("\nFor bug reporting instructions, please see:\n")); printf ("%s", _("\nFor bug reporting instructions, please see:\n"));
printf ("%s.\n", bug_report_url); printf ("%s.\n", bug_report_url);
return (0); return (0);

View File

@ -414,7 +414,7 @@ print_usage (int error_p)
static void static void
print_version (void) print_version (void)
{ {
fnotice (stdout, "gcov (GCC) %s\n", version_string); fnotice (stdout, "%s", "gcov (GCC) %s\n", version_string);
fprintf (stdout, "Copyright %s 2006 Free Software Foundation, Inc.\n", fprintf (stdout, "Copyright %s 2006 Free Software Foundation, Inc.\n",
_("(C)")); _("(C)"));
fnotice (stdout, fnotice (stdout,

View File

@ -381,7 +381,7 @@ read_repo_file (file *f)
FILE *stream = fopen (f->key, "r"); FILE *stream = fopen (f->key, "r");
if (tlink_verbose >= 2) if (tlink_verbose >= 2)
fprintf (stderr, _("collect: reading %s\n"), f->key); fprintf (stderr, "%s", _("collect: reading %s\n"), f->key);
while (fscanf (stream, "%c ", &c) == 1) while (fscanf (stream, "%c ", &c) == 1)
{ {