[PATCH] libstdc++: Add mem_order_hle_acquire/release to atomic.h

Andi Kleen andi@firstfloor.org
Fri Nov 9 20:36:00 GMT 2012


On Fri, Nov 09, 2012 at 07:56:21PM +0000, Jonathan Wakely wrote:
> >> constexpr memory_order
> >> operator|(memory_order __m, __memory_order_hle_mod __mod)
> >> {
> >>     return memory_order(__m | __mod);
> >> }
> >>
> >> This ensures users *cannot* call a.store(1,
> >> __memory_order_hle_acquire) because it's the wrong type, but they
> >
> > They would get a warning in any case.
> 
> Only if a compile-time constant is used, if it's passed in as a
> function parameter it won't be:

gcc will error out if the result is not constant. builtins.c
needs to see a number to generate the right instructions.

Ok that is why the constexpr was added originally I suppose?
Good that you added it back.

-Andi



More information about the Libstdc++ mailing list