Message ID | 568AEF81.7040809@gmail.com |
---|---|
State | New |
Headers | show |
On 01/04/2016 03:17 PM, Martin Sebor wrote: > As discussed in c/69104, the -Winvalid-memory-model option is > not documented in the manual. The attached patch rectifies that. Thanks for tackling this. > Index: doc/invoke.texi > =================================================================== > --- doc/invoke.texi (revision 232047) > +++ doc/invoke.texi (working copy) > @@ -263,7 +263,8 @@ > -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol > -Winvalid-pch -Wlarger-than=@var{len} @gol > -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol > --Wmain -Wmaybe-uninitialized -Wmemset-transposed-args @gol > +-Wmain -Wmaybe-uninitialized -Winvalid-memory-model @gol > +-Wmemset-transposed-args @gol > -Wmisleading-indentation -Wmissing-braces @gol > -Wmissing-field-initializers -Wmissing-include-dirs @gol > -Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol We just had a patch a month or so ago (r231022) to sort this table into something approaching alphabetical order, module no- prefixes, I guess. Can you please insert the new entry into a less random place? > @@ -4305,6 +4306,26 @@ > computations may be deleted by data flow analysis before the warnings > are printed. > > +@item -Winvalid-memory-model > +@opindex Winvalid-memory-model > +@opindex Wno-invalid-memory-model > +Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, > +and the C11 atomic generic functions with a memory consistency argument > +that is either invalid for the operation or outside the range of values > +of the @code{memory_order} enumeration. For example, since the > +@code{__atomic_store} and @code{__atomic_store_n} built-ins are only s/built-ins/builtins/ (like in the @refs you used previously) > +defined for the relaxed, relase, and sequentially consistent memory s/relase/release/ > +orders the following code is diagnosed: > + > +@smallexample > +void store (int *i) > +@{ > + __atomic_store_n (i, 0, memory_order_consume); > +@} > +@end smallexample > + > +@option{-Winvalid-memory-model} is enabled by default. > + > @item -Wmaybe-uninitialized > @opindex Wmaybe-uninitialized > @opindex Wno-maybe-uninitialized OK with those changes. -Sandra
gcc/ChangeLog: 2016-01-04 Martin Sebor <msebor@redhat.com> * doc/invoke.texi (Warning Options): Document -Winvalid-memory-model. Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 232047) +++ doc/invoke.texi (working copy) @@ -263,7 +263,8 @@ -Wno-int-to-pointer-cast -Wno-invalid-offsetof @gol -Winvalid-pch -Wlarger-than=@var{len} @gol -Wlogical-op -Wlogical-not-parentheses -Wlong-long @gol --Wmain -Wmaybe-uninitialized -Wmemset-transposed-args @gol +-Wmain -Wmaybe-uninitialized -Winvalid-memory-model @gol +-Wmemset-transposed-args @gol -Wmisleading-indentation -Wmissing-braces @gol -Wmissing-field-initializers -Wmissing-include-dirs @gol -Wno-multichar -Wnonnull -Wnormalized=@r{[}none@r{|}id@r{|}nfc@r{|}nfkc@r{]} @gol @@ -4305,6 +4306,26 @@ computations may be deleted by data flow analysis before the warnings are printed. +@item -Winvalid-memory-model +@opindex Winvalid-memory-model +@opindex Wno-invalid-memory-model +Warn for invocations of @ref{__atomic Builtins}, @ref{__sync Builtins}, +and the C11 atomic generic functions with a memory consistency argument +that is either invalid for the operation or outside the range of values +of the @code{memory_order} enumeration. For example, since the +@code{__atomic_store} and @code{__atomic_store_n} built-ins are only +defined for the relaxed, relase, and sequentially consistent memory +orders the following code is diagnosed: + +@smallexample +void store (int *i) +@{ + __atomic_store_n (i, 0, memory_order_consume); +@} +@end smallexample + +@option{-Winvalid-memory-model} is enabled by default. + @item -Wmaybe-uninitialized @opindex Wmaybe-uninitialized @opindex Wno-maybe-uninitialized