aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-format.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-format.c')
-rw-r--r--gcc/c-format.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/c-format.c b/gcc/c-format.c
index daa071e61ab..f27d6d03a11 100644
--- a/gcc/c-format.c
+++ b/gcc/c-format.c
@@ -833,7 +833,8 @@ check_function_format (tree attrs, tree params)
break;
}
if (args != 0)
- warning (0, "function might be possible candidate for %qs format attribute",
+ warning (OPT_Wattributes, "function might be possible "
+ "candidate for %qs format attribute",
format_types[info.format_type].name);
}
}
@@ -1140,8 +1141,8 @@ check_format_info (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)
- warning (0, "format not a string literal, format string not checked");
+ warning (OPT_Wformat_nonliteral,
+ "format not a string literal, format string not checked");
}
else if (info->first_arg_num != 0)
{
@@ -1154,10 +1155,15 @@ check_format_info (function_format_info *info, tree params)
params = TREE_CHAIN (params);
++arg_num;
}
- if (params == 0 && (warn_format_nonliteral || warn_format_security))
- warning (0, "format not a string literal and no format arguments");
- else if (warn_format_nonliteral)
- warning (0, "format not a string literal, argument types not checked");
+ if (params == 0 && warn_format_security)
+ warning (OPT_Wformat_security,
+ "format not a string literal and no format arguments");
+ else if (params == 0 && warn_format_nonliteral)
+ warning (OPT_Wformat_nonliteral,
+ "format not a string literal and no format arguments");
+ else
+ warning (OPT_Wformat_nonliteral,
+ "format not a string literal, argument types not checked");
}
}