diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-12 15:28:08 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-12 15:28:08 +0000 |
commit | 22a3f7bd7a199d7ed5a4890535fbdb8bad8431d6 (patch) | |
tree | e015f7057ed3ce7ab6a9895c022fd4e6f3c51088 /gcc/cp/typeck2.c | |
parent | dc0b0e333f2f3c9c9cbde066c5539f120288f46e (diff) |
PR c/70756
* c-common.c (pointer_int_sum): Call size_in_bytes_loc instead of
size_in_bytes and pass LOC to it.
* c-decl.c (build_compound_literal): Pass LOC down to
c_incomplete_type_error.
* c-tree.h (require_complete_type): Adjust declaration.
(c_incomplete_type_error): Likewise.
* c-typeck.c (require_complete_type): Add location parameter, pass it
down to c_incomplete_type_error.
(c_incomplete_type_error): Add location parameter, pass it down to
error_at.
(build_component_ref): Pass location down to c_incomplete_type_error.
(default_conversion): Pass location down to require_complete_type.
(build_array_ref): Likewise.
(build_function_call_vec): Likewise.
(convert_arguments): Likewise.
(build_unary_op): Likewise.
(build_c_cast): Likewise.
(build_modify_expr): Likewise.
(convert_for_assignment): Likewise.
(c_finish_omp_clauses): Likewise.
* call.c (build_new_op_1): Pass LOC to cp_build_modify_expr.
* cp-tree.h (cp_build_modify_expr): Update declaration.
(cxx_incomplete_type_error, cxx_incomplete_type_diagnostic): New inline
overloads.
* cp-ubsan.c (cp_ubsan_dfs_initialize_vtbl_ptrs): Pass INPUT_LOCATION to
cp_build_modify_expr.
* decl2.c (set_guard): Likewise.
(handle_tls_init): Likewise.
* init.c (perform_member_init): Likewise.
(expand_virtual_init): Likewise.
(build_new_1): Likewise.
(build_vec_delete_1): Likewise.
(get_temp_regvar): Likewise.
(build_vec_init): Likewise.
* method.c (do_build_copy_assign): Likewise.
(assignable_expr): Likewise.
* semantics.c (finish_omp_for): Likewise.
* typeck.c (cp_build_binary_op): Pass LOCATION to pointer_diff and
cp_pointer_int_sum.
(cp_pointer_int_sum): Add location parameter. Pass it down to
pointer_int_sum.
(pointer_diff): Add location parameter. Use it.
(build_modify_expr): Pass location down to cp_build_modify_expr.
(cp_build_modify_expr): Add location parameter. Use it.
(build_x_modify_expr): Pass location down to cp_build_modify_expr.
* typeck2.c (cxx_incomplete_type_diagnostic,
cxx_incomplete_type_error): Add location parameter.
* langhooks-def.h (lhd_incomplete_type_error): Adjust declaration.
* langhooks.c (lhd_incomplete_type_error): Add location parameter.
* langhooks.h (incomplete_type_error): Likewise.
* tree.c (size_in_bytes_loc): Renamed from size_in_bytes. Add location
parameter, pass it down to incomplete_type_error.
* tree.h (size_in_bytes): New inline overload.
(size_in_bytes_loc): Renamed from size_in_bytes.
* c-c++-common/pr70756-2.c: New test.
* c-c++-common/pr70756.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236180 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index e59ad51c3bd..1c4e832ff85 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -451,8 +451,8 @@ cxx_incomplete_type_inform (const_tree type) type of diagnostic (see diagnostic.def). */ void -cxx_incomplete_type_diagnostic (const_tree value, const_tree type, - diagnostic_t diag_kind) +cxx_incomplete_type_diagnostic (location_t loc, const_tree value, + const_tree type, diagnostic_t diag_kind) { bool is_decl = false, complained = false; @@ -475,8 +475,6 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, retry: /* We must print an error message. Be clever about what it says. */ - location_t loc = EXPR_LOC_OR_LOC (value, input_location); - switch (TREE_CODE (type)) { case RECORD_TYPE: @@ -570,13 +568,14 @@ cxx_incomplete_type_diagnostic (const_tree value, const_tree type, } } -/* Backward-compatibility interface to incomplete_type_diagnostic; - required by ../tree.c. */ -#undef cxx_incomplete_type_error +/* Print an error message for invalid use of an incomplete type. + VALUE is the expression that was used (or 0 if that isn't known) + and TYPE is the type that was invalid. */ + void -cxx_incomplete_type_error (const_tree value, const_tree type) +cxx_incomplete_type_error (location_t loc, const_tree value, const_tree type) { - cxx_incomplete_type_diagnostic (value, type, DK_ERROR); + cxx_incomplete_type_diagnostic (loc, value, type, DK_ERROR); } |