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
This commit is contained in:
Nathan Sidwell 1999-12-15 12:39:02 +00:00
parent 33848bb028
commit 8be7ab5d48
2 changed files with 24 additions and 12 deletions

View File

@ -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.

View File

@ -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