On 06/17/2013 06:02 PM, Sandra Loosemore wrote:
I had another thought: perhaps -fstrict-volatile-bitfields could remain the default on targets where it currently is, but it can be overridden by an appropriate -std= option. Perhaps also GCC could give an error if -fstrict-volatile-bitfields is given explicitly with an incompatible -std= option.
Like this. This patch is intended to be applied on top of the other 5 pieces in this series, although in theory it's independent of them. OK to commit, and does this resolve the objection to part 3?
-Sandra
2013-06-19 Sandra Loosemore <san...@codesourcery.com> gcc/c-family/ * c-opts.c (c_common_post_options): Check for conflict between -std= and -fstrict-volatile-bitfields. gcc/ * doc/invoke.texi (Code Gen Options): Document what happens when -fstrict-volatile-bitfields conflicts with -std=.
Index: gcc/c-family/c-opts.c =================================================================== --- gcc/c-family/c-opts.c (revision 199963) +++ gcc/c-family/c-opts.c (working copy) @@ -813,6 +813,18 @@ c_common_post_options (const char **pfil C_COMMON_OVERRIDE_OPTIONS; #endif + /* C11 and C++11 specify a memory model that is incompatible with + -fstrict-volatile-bitfields. Warn if that option is given explicitly + and prevent backends from defaulting to turning it on. */ + if (flag_isoc11 || cxx_dialect >= cxx11) + { + if (flag_strict_volatile_bitfields > 0) + warning (0, "-fstrict-volatile-bitfields conflicts with the " + "C11 and C++11 memory model"); + else + flag_strict_volatile_bitfields = 0; + } + /* Excess precision other than "fast" requires front-end support. */ if (c_dialect_cxx ()) Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 199963) +++ gcc/doc/invoke.texi (working copy) @@ -20899,4 +20899,12 @@ AAPCS, @option{-fstrict-volatile-bitfields} is the default. +Note that @option{-fstrict-volatile-bitfields} is incompatible with +the bit-field access behavior required by the ISO C11 and C++11 +standards. GCC warns if @option{-fstrict-volatile-bitfields} is given +explicitly with an incompatible @option{-std=} option. On targets +that otherwise default to @option{-fstrict-volatile-bitfields}, +providing an incompatible @option{-std=} option implicitly disables +@option{-fstrict-volatile-bitfields}. + @item -fsync-libcalls @opindex fsync-libcalls