aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2012-05-10 21:14:09 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2012-05-10 21:14:09 +0000
commit5a3c9cf200bc4614ae9b6390835759365d4663e5 (patch)
tree2c4209dd21db6e45465e20c55250c2a8de94b87d /gcc/c-family
parente5f13bf49ae0c4fd0ee897c0614ad8631afdb407 (diff)
downloadgcc-5a3c9cf200bc4614ae9b6390835759365d4663e5.zip
gcc-5a3c9cf200bc4614ae9b6390835759365d4663e5.tar.gz
gcc-5a3c9cf200bc4614ae9b6390835759365d4663e5.tar.bz2
re PR c++/53158 ([C++11] Bogus error in loop condition)
/cp 2012-05-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53158 * cvt.c (ocp_convert): Error out early for void -> bool conversions. * typeck.c (decay_conversion): Use error_at. * call.c (build_integral_nontype_arg_conv, convert_like_real, convert_arg_to_ellipsis, perform_implicit_conversion_flags, initialize_reference): Likewise. * cvt.c (warn_ref_binding): Add location_t parameter. (cp_convert_to_pointer, convert_to_reference, ocp_convert, convert_to_void, ): Use error_at and warning_at. /c-family 2012-05-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53158 * c-common.c (warnings_for_convert_and_check): Use warning_at. /testsuite 2012-05-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53158 * g++.dg/cpp0x/lambda/lambda-err2.C: New. * g++.dg/parse/error26.C: Tweak dg-error column number. From-SVN: r187380
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c14
2 files changed, 13 insertions, 6 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index f0e6147..a01f3ea 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/53158
+ * c-common.c (warnings_for_convert_and_check): Use warning_at.
+
2012-05-10 Richard Guenther <rguenther@suse.de>
* c-common.c (c_sizeof_or_alignof_type): Remove assert and
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index a5ddbee..ad98828 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -2329,6 +2329,8 @@ conversion_warning (tree type, tree expr)
void
warnings_for_convert_and_check (tree type, tree expr, tree result)
{
+ location_t loc = EXPR_LOC_OR_HERE (expr);
+
if (TREE_CODE (expr) == INTEGER_CST
&& (TREE_CODE (type) == INTEGER_TYPE
|| TREE_CODE (type) == ENUMERAL_TYPE)
@@ -2344,8 +2346,8 @@ warnings_for_convert_and_check (tree type, tree expr, tree result)
/* This detects cases like converting -129 or 256 to
unsigned char. */
if (!int_fits_type_p (expr, c_common_signed_type (type)))
- warning (OPT_Woverflow,
- "large integer implicitly truncated to unsigned type");
+ warning_at (loc, OPT_Woverflow,
+ "large integer implicitly truncated to unsigned type");
else
conversion_warning (type, expr);
}
@@ -2357,16 +2359,16 @@ warnings_for_convert_and_check (tree type, tree expr, tree result)
&& (TREE_CODE (TREE_TYPE (expr)) != INTEGER_TYPE
|| TYPE_PRECISION (TREE_TYPE (expr))
!= TYPE_PRECISION (type)))
- warning (OPT_Woverflow,
- "overflow in implicit constant conversion");
+ warning_at (loc, OPT_Woverflow,
+ "overflow in implicit constant conversion");
else
conversion_warning (type, expr);
}
else if ((TREE_CODE (result) == INTEGER_CST
|| TREE_CODE (result) == FIXED_CST) && TREE_OVERFLOW (result))
- warning (OPT_Woverflow,
- "overflow in implicit constant conversion");
+ warning_at (loc, OPT_Woverflow,
+ "overflow in implicit constant conversion");
else
conversion_warning (type, expr);
}