aboutsummaryrefslogtreecommitdiff
path: root/gcc/toplev.c
diff options
context:
space:
mode:
authorGreg McGary <gkm@gnu.org>1999-12-03 19:02:20 +0000
committerGeoffrey Keating <geoffk@gcc.gnu.org>1999-12-03 19:02:20 +0000
commit3c12fcc27809a223032e1b0ad2beba1f6844a5c6 (patch)
tree7d5534785288859eef23b404bed24959cca1f313 /gcc/toplev.c
parent7337695dc2c8f106fbad8b59ad2b4a2c9d413710 (diff)
downloadgcc-3c12fcc27809a223032e1b0ad2beba1f6844a5c6.zip
gcc-3c12fcc27809a223032e1b0ad2beba1f6844a5c6.tar.gz
gcc-3c12fcc27809a223032e1b0ad2beba1f6844a5c6.tar.bz2
flags.h (warn_padded, [...]): Add global var decls.
* flags.h (warn_padded, warn_packed): Add global var decls. * toplev.c (warn_padded, warn_packed): Add global var defns. (W_options): Add warnings `-Wpacked' and `-Wpadded'. * stor-layout.c (layout_record): Add local variable `type' to hold often-used TREE_TYPE (field). Add local variable `unpacked_align' to hold alignment that would be in force if no `packed' attribute were present. Warn if `packed' attribute is unnecessary, or even harmful. Warn when gcc inserts padding to satisfy alignment requirements of members. Use NULL_TREE when checking whether var_size is set. * invoke.texi: Document new flags. Co-Authored-By: Geoff Keating <geoffk@cygnus.com> From-SVN: r30770
Diffstat (limited to 'gcc/toplev.c')
-rw-r--r--gcc/toplev.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 0678915..70ea2a1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1258,6 +1258,14 @@ int warn_inline;
int warn_aggregate_return;
+/* Warn if packed attribute on struct is unnecessary and inefficient. */
+
+int warn_packed;
+
+/* Warn when gcc pads a structure to an alignment boundary. */
+
+int warn_padded;
+
/* Likewise for -W. */
lang_independent_options W_options[] =
@@ -1276,7 +1284,11 @@ lang_independent_options W_options[] =
{"uninitialized", &warn_uninitialized, 1,
"Warn about unitialized automatic variables"},
{"inline", &warn_inline, 1,
- "Warn when an inlined function cannot be inlined"}
+ "Warn when an inlined function cannot be inlined"},
+ {"packed", &warn_packed, 1,
+ "Warn when the packed attribute has no effect on struct layout"},
+ {"padded", &warn_padded, 1,
+ "Warn when padding is required to align struct members"}
};
/* Output files for assembler code (real compiler output)