diff options
author | Jan Beulich <jbeulich@novell.com> | 2004-09-03 17:22:40 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2004-09-03 10:22:40 -0700 |
commit | 467cecf3b892c8b74cf0aafe0d6974c9ee66700a (patch) | |
tree | 63c3bd6632b4fa9e9fe6de7b0c1e6e63755301d5 /gcc/opts.c | |
parent | 90300b8ca23bb39af5196a9fa1d5c20f829ae537 (diff) | |
download | gcc-467cecf3b892c8b74cf0aafe0d6974c9ee66700a.zip gcc-467cecf3b892c8b74cf0aafe0d6974c9ee66700a.tar.gz gcc-467cecf3b892c8b74cf0aafe0d6974c9ee66700a.tar.bz2 |
re PR c/7054 (#pragma pack handled incorrectly)
PR c/7054
* defaults.h (TARGET_DEFAULT_PACK_STRUCT): Provide default.
* tree.h (initial_max_fld_align): Declare
* stor-layout.c (initial_max_fld_align): Define and initialize.
(maximum_field_alignment): Initialize to the same value.
* common.opt: Add -fpack-struct= variant of switch.
* opts.c: Handle -fpack-struct= variant of switch.
* c-pragma.c: Change #pragma pack() handling so that it becomes
compatible to other compilers: accept individual 'push' argument,
make final pop restore (command line) default, correct interaction
of push/pop and sole specification of a new alignment (so that the
sequence #pragma pack(push) - #pragma pack(<n>) becomes identical
to #pragma pack(push, <n>).
* doc/extend.texi: New node "Structure-Packing Pragmas" under
"Pragmas", describing #pragma pack.
* doc/invoke.texi: Document -fpack-struct=<n> variant of switch.
* doc/tm.texi: Adjust description for HANDLE_PRAGMA_PACK_PUSH_POP.
Document new TARGET_DEFAULT_PACK_STRUCT.
testsuite:
* gcc.dg/pack-test-2.c: Adjust to permit and check #pragma pack(push).
* gcc.dg/c99-flex-array-4.c: Add -fpack-struct=8 to provide a
deterministic starting point for the alignment of structure fields.
* gcc.dg/Wpadded.c: Dito.
* g++.dg/abi/vbase10.C: Dito.
From-SVN: r87037
Diffstat (limited to 'gcc/opts.c')
-rw-r--r-- | gcc/opts.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -810,6 +810,16 @@ common_handle_option (size_t scode, const char *arg, int value) pp_set_line_maximum_length (global_dc->printer, value); break; + case OPT_fpack_struct_: + if (value <= 0 || (value & (value - 1)) || value > 16) + error("structure alignment must be a small power of two, not %d", value); + else + { + initial_max_fld_align = value; + maximum_field_alignment = value * BITS_PER_UNIT; + } + break; + case OPT_fpeel_loops: flag_peel_loops_set = true; break; |