diff options
author | Nathan Sidwell <nathan@gcc.gnu.org> | 1999-12-15 12:39:02 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 1999-12-15 12:39:02 +0000 |
commit | 8be7ab5d48fe7798721464d797634301f33a85bc (patch) | |
tree | 5f41cb2afe297f199c497cd8277d599cf3291cf9 /gcc | |
parent | 33848bb0281d0be603c0391342284273c123ae4a (diff) | |
download | gcc-8be7ab5d48fe7798721464d797634301f33a85bc.zip gcc-8be7ab5d48fe7798721464d797634301f33a85bc.tar.gz gcc-8be7ab5d48fe7798721464d797634301f33a85bc.tar.bz2 |
typeck.c (build_c_cast): Expand warning message.
* typeck.c (build_c_cast): Expand warning message. Move pointer
alignment warning to after the cast. Don't warn about pointer
alignment when given a pointer to incomplete.
fix cut-n-paste error on 1999-12-09 Andreas Jaeger and
1999-12-09 Mark Mitchell (was 11999 & 999)
From-SVN: r30952
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 25 |
2 files changed, 24 insertions, 12 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 949e64a..ac432dc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1999-12-15 Nathan Sidwell <nathan@acm.org> + + * typeck.c (build_c_cast): Expand warning message. Move pointer + alignment warning to after the cast. Don't warn about pointer + alignment when given a pointer to incomplete. + 1999-12-15 Richard Henderson <rth@cygnus.com> * cp-tree.h (make_aggr_type): Declare. @@ -61,6 +67,7 @@ (reinit_parse_for_expr): Use. (check_newline): Use. +>>>>>>> 1.1463 1999-12-13 Mark Mitchell <mark@codesourcery.com> * optimize.c (initialize_inlined_parameters): Take FN to which the @@ -89,7 +96,7 @@ * pt.c (for_each_template_parm_r): Add static prototype. -11999-12-09 Andreas Jaeger <aj@suse.de> +1999-12-09 Andreas Jaeger <aj@suse.de> * except.c (expand_throw): Add static attribute to match prototype. @@ -98,7 +105,7 @@ * semantics.c: Include output.h for declaration of make_function_rtl. -999-12-09 Mark Mitchell <mark@codesourcery.com> +1999-12-09 Mark Mitchell <mark@codesourcery.com> * decl.c (init_decl_processing): Reenable inlining on trees. (finish_function): Likewise. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 7325653..c99d153 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -5499,16 +5499,8 @@ build_c_cast (type, expr) && TREE_CODE (otype) == POINTER_TYPE && !at_least_as_qualified_p (TREE_TYPE (type), TREE_TYPE (otype))) - cp_warning ("cast discards qualifiers from pointer target type"); - - /* Warn about possible alignment problems. */ - if (STRICT_ALIGNMENT && warn_cast_align - && TREE_CODE (type) == POINTER_TYPE - && TREE_CODE (otype) == POINTER_TYPE - && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE - && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE - && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) - warning ("cast increases required alignment of target type"); + cp_warning ("cast from `%T' to `%T' discards qualifiers from pointer target type", + otype, type); #if 0 /* We should see about re-enabling these, they seem useful to @@ -5549,6 +5541,19 @@ build_c_cast (type, expr) } } + /* Warn about possible alignment problems. Do this here when we will have + instantiated any necessary template types. */ + if (STRICT_ALIGNMENT && warn_cast_align + && TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (otype) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE + && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE + && TYPE_SIZE (TREE_TYPE (otype)) + && TYPE_SIZE (TREE_TYPE (type)) + && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype))) + cp_warning ("cast from `%T' to `%T' increases required alignment of target type", + otype, type); + /* Always produce some operator for an explicit cast, so we can tell (for -pedantic) that the cast is no lvalue. */ if (TREE_CODE (type) != REFERENCE_TYPE && value == expr |