diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-04-24 16:35:17 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-04-24 16:35:17 +0000 |
commit | 44d90fe1c00fa4bf947716cbfecf945892f182a6 (patch) | |
tree | 5e50f567107a826356fa5426fbedd18bebb7acde /gcc/c-family | |
parent | f6ce35ac7cd0498638a00396ae4a47269def92ac (diff) | |
download | gcc-44d90fe1c00fa4bf947716cbfecf945892f182a6.zip gcc-44d90fe1c00fa4bf947716cbfecf945892f182a6.tar.gz gcc-44d90fe1c00fa4bf947716cbfecf945892f182a6.tar.bz2 |
c.opt ([Wpointer-arith]): Enabled by -Wpedantic, as documented.
/c-family
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
Manuel Lopez-Ibanez <manu@gcc.gnu.org>
* c.opt ([Wpointer-arith]): Enabled by -Wpedantic, as documented.
* c-common.c (pointer_int_sum): Change -Wpointer-arith pedwarns
to simply use OPT_Wpointer_arith.
(c_sizeof_or_alignof_type): Likewise.
/cp
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
* typeck.c (cxx_sizeof_or_alignof_type): Change -Wpointer-arith
pedwarn to simply use OPT_Wpointer_arith.
(cp_build_unary_op): Likewise.
/c
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
* c-typeck.c (pointer_diff): Change -Wpointer-arith pedwarns
to simply use OPT_Wpointer_arith.
(build_unary_op): Likewise.
/testsuite
2013-04-24 Paolo Carlini <paolo.carlini@oracle.com>
* c-c++-common/Wpointer-arith-1.c: New.
Co-Authored-By: Manuel López-Ibáñez <manu@gcc.gnu.org>
From-SVN: r198256
Diffstat (limited to 'gcc/c-family')
-rw-r--r-- | gcc/c-family/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c-family/c-common.c | 12 | ||||
-rw-r--r-- | gcc/c-family/c.opt | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index a768499..275b20d 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,4 +1,12 @@ 2013-04-24 Paolo Carlini <paolo.carlini@oracle.com> + Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + * c.opt ([Wpointer-arith]): Enabled by -Wpedantic, as documented. + * c-common.c (pointer_int_sum): Change -Wpointer-arith pedwarns + to simply use OPT_Wpointer_arith. + (c_sizeof_or_alignof_type): Likewise. + +2013-04-24 Paolo Carlini <paolo.carlini@oracle.com> * c-cppbuiltin.c (c_cpp_builtins): Define __GXX_EXPERIMENTAL_CXX1Y__. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index dd94ff1..b29f5fa 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -4280,13 +4280,13 @@ pointer_int_sum (location_t loc, enum tree_code resultcode, if (TREE_CODE (TREE_TYPE (result_type)) == VOID_TYPE) { - pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith, + pedwarn (loc, OPT_Wpointer_arith, "pointer of type %<void *%> used in arithmetic"); size_exp = integer_one_node; } else if (TREE_CODE (TREE_TYPE (result_type)) == FUNCTION_TYPE) { - pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith, + pedwarn (loc, OPT_Wpointer_arith, "pointer to a function used in arithmetic"); size_exp = integer_one_node; } @@ -4864,8 +4864,8 @@ c_sizeof_or_alignof_type (location_t loc, { if (is_sizeof) { - if (complain && (pedantic || warn_pointer_arith)) - pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith, + if (complain && warn_pointer_arith) + pedwarn (loc, OPT_Wpointer_arith, "invalid application of %<sizeof%> to a function type"); else if (!complain) return error_mark_node; @@ -4888,8 +4888,8 @@ c_sizeof_or_alignof_type (location_t loc, else if (type_code == VOID_TYPE || type_code == ERROR_MARK) { if (type_code == VOID_TYPE - && complain && (pedantic || warn_pointer_arith)) - pedwarn (loc, pedantic ? OPT_Wpedantic : OPT_Wpointer_arith, + && complain && warn_pointer_arith) + pedwarn (loc, OPT_Wpointer_arith, "invalid application of %qs to a void type", op_name); else if (!complain) return error_mark_node; diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 10ae84d..124c139 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -614,7 +614,7 @@ C++ ObjC++ Var(warn_pmf2ptr) Init(1) Warning Warn when converting the type of pointers to member functions Wpointer-arith -C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning +C ObjC C++ ObjC++ Var(warn_pointer_arith) Warning LangEnabledBy(C ObjC C++ ObjC++,Wpedantic) Warn about function pointer arithmetic Wpointer-sign |