* typeck.c (build_c_cast): Expand warning message. Move pointer
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 12:39:02 +0000 (12:39 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 12:39:02 +0000 (12:39 +0000)
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)

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30952 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/typeck.c

index 949e64a..ac432dc 100644 (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.
        * 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.
index 7325653..c99d153 100644 (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