diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2006-05-05 19:57:38 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2006-05-05 19:57:38 +0000 |
commit | 8d8d1a280135e6530e1d2eb42c5ff8b91a8f570c (patch) | |
tree | 31aff53c7f9388180b8f468318913668e9cb42be /gcc/cp | |
parent | b207220873a208cab0b8fea85bf5be77bcd15914 (diff) | |
download | gcc-8d8d1a280135e6530e1d2eb42c5ff8b91a8f570c.zip gcc-8d8d1a280135e6530e1d2eb42c5ff8b91a8f570c.tar.gz gcc-8d8d1a280135e6530e1d2eb42c5ff8b91a8f570c.tar.bz2 |
c-parser.c (c_parser_cast_expression): Only insert casts into hash table if pointer.
PR/21391
* c-parser.c (c_parser_cast_expression): Only insert casts into
hash table if pointer.
* function.c (used_types_insert_helper): Rename from
used_types_insert.
(used_types_insert): Call used_types_insert_helper.
* function.h (used_types_insert): Accept only one argument.
* cp/typeck.c (build_static_cast_1): Save casted types in used types
hash table.
(build_reinterpret_cast_1): Same.
* cp/rtti.c (build_dynamic_cast_1): Same.
* testsuite/g++.dg/other/unused1.C: New.
From-SVN: r113561
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/cp/rtti.c | 3 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 9 |
3 files changed, 20 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d4a01fc..f423f4f 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2006-05-03 Aldy Hernandez <aldyh@redhat.com> + + PR/21391 + * typeck.c (build_static_cast_1): Save casted types in used types + hash table. + (build_reinterpret_cast_1): Same. + * rtti.c (build_dynamic_cast_1): Same. + 2006-05-04 Jakub Jelinek <jakub@redhat.com> PR c++/27359 diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 5c6d38d..6242e44 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -464,6 +464,9 @@ build_dynamic_cast_1 (tree type, tree expr) tree old_expr = expr; const char *errstr = NULL; + /* Save casted types in the function's used types hash table. */ + used_types_insert (type); + /* T shall be a pointer or reference to a complete class type, or `pointer to cv void''. */ switch (tc) diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 394a4ec..78e3a2b 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -4759,6 +4759,9 @@ build_static_cast_1 (tree type, tree expr, bool c_cast_p, intype = TREE_TYPE (expr); + /* Save casted types in the function's used types hash table. */ + used_types_insert (type); + /* Determine what to do when casting away constness. */ if (c_cast_p) { @@ -5047,6 +5050,9 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p, intype = TREE_TYPE (expr); + /* Save casted types in the function's used types hash table. */ + used_types_insert (type); + /* [expr.reinterpret.cast] An lvalue expression of type T1 can be cast to the type "reference to T2" if an expression of type "pointer to T1" can be @@ -5242,6 +5248,9 @@ build_const_cast_1 (tree dst_type, tree expr, bool complain, return error_mark_node; } + /* Save casted types in the function's used types hash table. */ + used_types_insert (dst_type); + src_type = TREE_TYPE (expr); /* Expressions do not really have reference types. */ if (TREE_CODE (src_type) == REFERENCE_TYPE) |