OSDN Git Service

(build_c_cast): Don't warn about alignment when we have an opaque type.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Jan 1996 12:36:59 +0000 (12:36 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 15 Jan 1996 12:36:59 +0000 (12:36 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10982 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-typeck.c

index 50fbad0..00e1466 100644 (file)
@@ -3712,6 +3712,11 @@ build_c_cast (type, expr)
          && TREE_CODE (otype) == POINTER_TYPE
          && TREE_CODE (TREE_TYPE (otype)) != VOID_TYPE
          && TREE_CODE (TREE_TYPE (otype)) != FUNCTION_TYPE
+         /* Don't warn about opaque types, where the actual alignment
+            restriction is unknown.  */
+         && !((TREE_CODE (TREE_TYPE (otype)) == UNION_TYPE
+               || TREE_CODE (TREE_TYPE (otype)) == RECORD_TYPE)
+              && TYPE_MODE (TREE_TYPE (otype)) == VOIDmode)
          && TYPE_ALIGN (TREE_TYPE (type)) > TYPE_ALIGN (TREE_TYPE (otype)))
        warning ("cast increases required alignment of target type");