aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-01-05 12:03:57 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-01-05 12:03:57 +0000
commit5bd012f83bcedad0e80280ffccaa0b5297d9bf98 (patch)
tree75038e2677f4f5b9b1ff57bf2ea4050b56336f91 /gcc/c-family
parent2c5103ffdd6542ac1f9a110f144034d9ec70488c (diff)
downloadgcc-5bd012f83bcedad0e80280ffccaa0b5297d9bf98.zip
gcc-5bd012f83bcedad0e80280ffccaa0b5297d9bf98.tar.gz
gcc-5bd012f83bcedad0e80280ffccaa0b5297d9bf98.tar.bz2
re PR c/64423 (Incorrect column number of -Wchar-subscripts)
PR c/64423 c-family/ * c-common.c (warn_array_subscript_with_type_char): Add location_t parameter. Use it. * c-common.h (warn_array_subscript_with_type_char): Update declaration. c/ * c-typeck.c (build_array_ref): Pass loc down to warn_array_subscript_with_type_char. cp/ * typeck.c (cp_build_array_ref): Pass loc down to warn_array_subscript_with_type_char. testsuite/ * gcc.dg/pr64423.c: New test. From-SVN: r219186
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/ChangeLog8
-rw-r--r--gcc/c-family/c-common.c5
-rw-r--r--gcc/c-family/c-common.h2
3 files changed, 12 insertions, 3 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 47aa690..960c7d1 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,11 @@
+2015-01-05 Marek Polacek <polacek@redhat.com>
+
+ PR c/64423
+ * c-common.c (warn_array_subscript_with_type_char): Add location_t
+ parameter. Use it.
+ * c-common.h (warn_array_subscript_with_type_char): Update
+ declaration.
+
2014-12-20 Edward Smith-Rowland <3dw4rd@verizon.net>
* c-cppbuiltin.c (__cpp_sized_deallocation): Uncomment and move macro.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 1066c6b..af7a07e 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -11238,11 +11238,12 @@ check_missing_format_attribute (tree ltype, tree rtype)
warning only for non-constant value of type char. */
void
-warn_array_subscript_with_type_char (tree index)
+warn_array_subscript_with_type_char (location_t loc, tree index)
{
if (TYPE_MAIN_VARIANT (TREE_TYPE (index)) == char_type_node
&& TREE_CODE (index) != INTEGER_CST)
- warning (OPT_Wchar_subscripts, "array subscript has type %<char%>");
+ warning_at (loc, OPT_Wchar_subscripts,
+ "array subscript has type %<char%>");
}
/* Implement -Wparentheses for the unexpected C precedence rules, to
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index c7eebcf..d1f09a6 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1014,7 +1014,7 @@ extern tree builtin_type_for_size (int, bool);
extern void c_common_mark_addressable_vec (tree);
-extern void warn_array_subscript_with_type_char (tree);
+extern void warn_array_subscript_with_type_char (location_t, tree);
extern void warn_about_parentheses (location_t,
enum tree_code,
enum tree_code, tree,