aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1996-01-15 07:36:59 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1996-01-15 07:36:59 -0500
commitec9aa8950139f60e9dd6eb65f566a3fd94b4041b (patch)
treea35b23f57ba5b78c2a22674d0806cf3d62317dad /gcc
parentbd5f6d441a61660e8f22529802c81671922fc41b (diff)
downloadgcc-ec9aa8950139f60e9dd6eb65f566a3fd94b4041b.zip
gcc-ec9aa8950139f60e9dd6eb65f566a3fd94b4041b.tar.gz
gcc-ec9aa8950139f60e9dd6eb65f566a3fd94b4041b.tar.bz2
(build_c_cast): Don't warn about alignment when we have an opaque type.
From-SVN: r10982
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 50fbad0..00e1466 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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");