aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-03-02 07:24:19 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-03-02 07:24:19 +0000
commitbd02f00fcf86a29295f3369cfbcd0b9ae10ae86d (patch)
treedc025e1e4cea0463d2ff40c5300fd93c68650529 /gcc/gimplify.c
parent1e840f39746e6b7bb8d62c7909921fe730730a66 (diff)
downloadgcc-bd02f00fcf86a29295f3369cfbcd0b9ae10ae86d.zip
gcc-bd02f00fcf86a29295f3369cfbcd0b9ae10ae86d.tar.gz
gcc-bd02f00fcf86a29295f3369cfbcd0b9ae10ae86d.tar.bz2
re PR c/67854 (Missing diagnostic for passing bool to va_arg)
PR c/67854 * gimplify.c (gimplify_va_arg_expr): Use expanded location for the "is promoted to" warning. * gcc.dg/pr67854.c: New test. From-SVN: r233891
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 7be6bd7..e7ea974 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -11573,24 +11573,28 @@ gimplify_va_arg_expr (tree *expr_p, gimple_seq *pre_p,
{
static bool gave_help;
bool warned;
+ /* Use the expansion point to handle cases such as passing bool (defined
+ in a system header) through `...'. */
+ source_location xloc
+ = expansion_point_location_if_in_system_header (loc);
/* Unfortunately, this is merely undefined, rather than a constraint
violation, so we cannot make this an error. If this call is never
executed, the program is still strictly conforming. */
- warned = warning_at (loc, 0,
- "%qT is promoted to %qT when passed through %<...%>",
+ warned = warning_at (xloc, 0,
+ "%qT is promoted to %qT when passed through %<...%>",
type, promoted_type);
if (!gave_help && warned)
{
gave_help = true;
- inform (loc, "(so you should pass %qT not %qT to %<va_arg%>)",
+ inform (xloc, "(so you should pass %qT not %qT to %<va_arg%>)",
promoted_type, type);
}
/* We can, however, treat "undefined" any way we please.
Call abort to encourage the user to fix the program. */
if (warned)
- inform (loc, "if this code is reached, the program will abort");
+ inform (xloc, "if this code is reached, the program will abort");
/* Before the abort, allow the evaluation of the va_list
expression to exit or longjmp. */
gimplify_and_add (valist, pre_p);