This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix generic std::atomic<T>::compare_exchange_{weak,strong}
- From: Nathan Froyd <froydnj at mozilla dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Jul 2013 11:42:34 -0700 (PDT)
- Subject: Re: [PATCH] fix generic std::atomic<T>::compare_exchange_{weak,strong}
- References: <20130726173426 dot GA11900 at cerebro> <3c498ca8-12e6-48ec-9e2b-bb2abc6e3851 at email dot android dot com>
Sure, I can do that. For maximum effectiveness, it'd be good to have it check the specializations for atomic<>, too. Is there something in the libstdc++ testsuite for iterating template instantiations over a list of types, or do I have to roll the list myself?
Thanks,
-Nathan
----- Original Message -----
>
>
> Hi,
>
> Nathan Froyd <nfroyd@mozilla.com> ha scritto:
> >Compiling the test program:
> >
> >#include <atomic>
> >
> >enum x { a, b };
> >
> >std::atomic<x> v;
> >
> >bool test_strong()
> >{
> > x expected = a;
> >return v.compare_exchange_strong(expected, b,
> >std::memory_order_acq_rel);
> >}
> >
> >bool test_weak()
> >{
> > x expected = a;
> >return v.compare_exchange_weak(expected, b, std::memory_order_acq_rel);
> >}
>
> In any case, why not adding the testcase?
>
> Paolo
>