typeck.c (check_for_casting_away_constness): Add location_t parameter and use it.
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 9 Dec 2019 20:28:39 +0000 (20:28 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 9 Dec 2019 20:28:39 +0000 (20:28 +0000)
commitca6932ad0ccbbbe3c788cd71595d9a25b8ae0d20
treeab35bcb3daba1f0f37edbaa49c7d876b4d1cfa69
parentee9256409f21eab5df5076e46d220d6a0b995f79
typeck.c (check_for_casting_away_constness): Add location_t parameter and use it.

gcc/cp
2019-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

* typeck.c (check_for_casting_away_constness): Add location_t
parameter and use it.
(maybe_warn_about_useless_cast): Likewise.
(maybe_warn_about_cast_ignoring_quals): Likewise.
(build_static_cast_1): Likewise.
(build_static_cast): Likewise; sets the location of the returned tree.
(build_reinterpret_cast_1): Likewise.
(build_reinterpret_cast): Likewise; sets the location of the returned
tree.
(build_const_cast_1): Likewise.
(build_const_cast): Likewise; sets the location of the returned tree.
(cp_build_c_cast): Likewise.
(build_c_cast): Adjust.
(build_ptrmemfunc): Adjust calls.
(cp_build_unary_op): Pass the location to invert_truthvalue_loc.
* rtti.c (build_dynamic_cast_1): Add location_t parameter and
use it.
(build_dynamic_cast): Likewise.
* cp-tree.h: Adjust declarations.
* parser.c (cp_parser_postfix_expression): Pass cp_cast_loc to
the various build_*_cast functions.
(get_cast_suggestion): Adjust calls.
(cp_parser_builtin_offsetof): Likewise.
* decl.c (reshape_init): Adjust call.
* method.c (forward_parm): Likewise.
(build_comparison_op): Likewise.
* pt.c (tsubst_copy_and_build): Likewise.
* semantics.c (finish_omp_reduction_clause): Likewise.
(cp_omp_finish_iterators): Likewise.
* tree.c (cp_stabilize_reference): Likewise.
(move): Likewise.
* typeck2.c (build_functional_cast): Likewise.

* typeck2.c (build_functional_cast_1): New.
(build_functional_cast_1): Calls the latter and sets the location
of the returned tree.

/libcc1
2019-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

* libcp1plugin.cc (plugin_build_cast_expr): Adjust build_cast
declaration.

gcc/testsuite
2019-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

* c-c++-common/Wcast-align.c: Check location(s) too.
* c-c++-common/Wcast-function-type.c: Likewise.
* c-c++-common/Wint-to-pointer-cast-1.c: Likewise.
* c-c++-common/Wint-to-pointer-cast-2.c: Likewise.
* c-c++-common/Wint-to-pointer-cast-3.c: Likewise.
* g++.dg/Wcast-function-type.C: Likewise.
* g++.dg/addr_builtin-1.C: Likewise.
* g++.dg/conversion/const2.C: Likewise.
* g++.dg/conversion/dynamic1.C: Likewise.
* g++.dg/conversion/ptrmem2.C: Likewise.
* g++.dg/conversion/ptrmem3.C: Likewise.
* g++.dg/conversion/qual3.C: Likewise.
* g++.dg/conversion/reinterpret3.C: Likewise.
* g++.dg/cpp0x/constexpr-cast.C: Likewise.
* g++.dg/cpp0x/lambda/lambda-conv11.C: Likewise.
* g++.dg/cpp0x/nullptr04.C: Likewise.
* g++.dg/cpp0x/reinterpret_cast2.C: Likewise.
* g++.dg/cpp0x/rv-cast2.C: Likewise.
* g++.dg/cpp1y/lambda-conv1.C: Likewise.
* g++.dg/cpp1z/noexcept-type7.C: Likewise.
* g++.dg/cpp2a/array-conv9.C: Likewise.
* g++.dg/expr/cast11.C: Likewise.
* g++.dg/expr/static_cast8.C: Likewise.
* g++.dg/ext/vector6.C: Likewise.
* g++.dg/other/conversion1.C: Likewise.
* g++.dg/parse/pr26997.C: Likewise.
* g++.dg/rtti/no-rtti.C: Likewise.
* g++.dg/tc1/dr137.C: Likewise.
* g++.dg/template/cast4.C: Likewise.
* g++.dg/warn/Wcast-qual1.C: Likewise.
* g++.dg/warn/Wcast-qual2.C: Likewise.
* g++.dg/warn/Wconditionally-supported-1.C: Likewise.
* g++.dg/warn/Wuseless-cast.C: Likewise.
* g++.dg/warn/pr35711.C: Likewise.
* g++.old-deja/g++.bugs/900227_01.C: Likewise.
* g++.old-deja/g++.bugs/900404_07.C: Likewise.
* g++.old-deja/g++.jason/overload1.C: Likewise.
* g++.old-deja/g++.jason/rfg26.C: Likewise.
* g++.old-deja/g++.jason/rvalue3.C: Likewise.
* g++.old-deja/g++.jason/warning2.C: Likewise.
* g++.old-deja/g++.mike/dyncast4.C: Likewise.
* g++.old-deja/g++.mike/dyncast6.C: Likewise.
* g++.old-deja/g++.mike/p11482.C: Likewise.
* g++.old-deja/g++.mike/p2573.C: Likewise.
* g++.old-deja/g++.mike/p2855.C: Likewise.
* g++.old-deja/g++.mike/p7476.C: Likewise.
* g++.old-deja/g++.mike/p8039.C: Likewise.
* g++.old-deja/g++.other/cast2.C: Likewise.
* g++.old-deja/g++.other/cast3.C: Likewise.
* g++.old-deja/g++.other/dcast1.C: Likewise.
* g++.old-deja/g++.other/dcast2.C: Likewise.

From-SVN: r279138
65 files changed:
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/method.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/rtti.c
gcc/cp/semantics.c
gcc/cp/tree.c
gcc/cp/typeck.c
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wcast-align.c
gcc/testsuite/c-c++-common/Wcast-function-type.c
gcc/testsuite/c-c++-common/Wint-to-pointer-cast-1.c
gcc/testsuite/c-c++-common/Wint-to-pointer-cast-2.c
gcc/testsuite/c-c++-common/Wint-to-pointer-cast-3.c
gcc/testsuite/g++.dg/Wcast-function-type.C
gcc/testsuite/g++.dg/addr_builtin-1.C
gcc/testsuite/g++.dg/conversion/const2.C
gcc/testsuite/g++.dg/conversion/dynamic1.C
gcc/testsuite/g++.dg/conversion/ptrmem2.C
gcc/testsuite/g++.dg/conversion/ptrmem3.C
gcc/testsuite/g++.dg/conversion/qual3.C
gcc/testsuite/g++.dg/conversion/reinterpret3.C
gcc/testsuite/g++.dg/cpp0x/constexpr-cast.C
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-conv11.C
gcc/testsuite/g++.dg/cpp0x/nullptr04.C
gcc/testsuite/g++.dg/cpp0x/reinterpret_cast2.C
gcc/testsuite/g++.dg/cpp0x/rv-cast2.C
gcc/testsuite/g++.dg/cpp1y/lambda-conv1.C
gcc/testsuite/g++.dg/cpp1z/noexcept-type7.C
gcc/testsuite/g++.dg/cpp2a/array-conv9.C
gcc/testsuite/g++.dg/expr/cast11.C
gcc/testsuite/g++.dg/expr/static_cast8.C
gcc/testsuite/g++.dg/ext/vector6.C
gcc/testsuite/g++.dg/other/conversion1.C
gcc/testsuite/g++.dg/parse/pr26997.C
gcc/testsuite/g++.dg/rtti/no-rtti.C
gcc/testsuite/g++.dg/tc1/dr137.C
gcc/testsuite/g++.dg/template/cast4.C
gcc/testsuite/g++.dg/warn/Wcast-qual1.C
gcc/testsuite/g++.dg/warn/Wcast-qual2.C
gcc/testsuite/g++.dg/warn/Wconditionally-supported-1.C
gcc/testsuite/g++.dg/warn/Wuseless-cast.C
gcc/testsuite/g++.dg/warn/pr35711.C
gcc/testsuite/g++.old-deja/g++.bugs/900227_01.C
gcc/testsuite/g++.old-deja/g++.bugs/900404_07.C
gcc/testsuite/g++.old-deja/g++.jason/overload1.C
gcc/testsuite/g++.old-deja/g++.jason/rfg26.C
gcc/testsuite/g++.old-deja/g++.jason/rvalue3.C
gcc/testsuite/g++.old-deja/g++.jason/warning2.C
gcc/testsuite/g++.old-deja/g++.mike/dyncast4.C
gcc/testsuite/g++.old-deja/g++.mike/dyncast6.C
gcc/testsuite/g++.old-deja/g++.mike/p11482.C
gcc/testsuite/g++.old-deja/g++.mike/p2573.C
gcc/testsuite/g++.old-deja/g++.mike/p2855.C
gcc/testsuite/g++.old-deja/g++.mike/p7476.C
gcc/testsuite/g++.old-deja/g++.mike/p8039.C
gcc/testsuite/g++.old-deja/g++.other/cast2.C
gcc/testsuite/g++.old-deja/g++.other/cast3.C
gcc/testsuite/g++.old-deja/g++.other/dcast1.C
gcc/testsuite/g++.old-deja/g++.other/dcast2.C
libcc1/ChangeLog
libcc1/libcp1plugin.cc