[PATCH] Simplify dg-options for tests using pthreads

Jonathan Wakely jwakely@redhat.com
Tue Aug 23 09:34:00 GMT 2016


On 23/08/16 11:19 +0200, Rainer Orth wrote:
>Hi Jonathan,
>
>>>The next step would be to replace the explict target list with an
>>>effective-target keyword ;-)
>>
>> Yes, I've started doing that in a local branch, so we'd use something
>> like:
>>
>> { dg-do run { target libstdc++-threads-supported } }
>> { dg-add-options libstdc++-threads-flags }
>>
>> Where that would only run the test where supported, and would add
>> -pthread if the target needs it.
>
>good.  However, those are quite a mouthful.  Why not just use pthread
>for both keywords (the namespaces are disjunct), or even omit

Currently we only support std::thread etc. for pthread targets, but
that is only because nobody has done the work to support it on
non-pthread targets. It's not an inherent property of std::thread that
it depends on pthreads.

>dg-add-options if -pthread works everywhere "target pthread" does?  The

I'm not sure if that's true today, but it certainly won't be if we
merge the new Windows thread model that somebody is working on.

>keywords are supposed to name the feature itself; -supported and -flags
>are redundant and I have a hard time believing there's something
>libstdc++ specific in there.

Well the list of targets that support std::thread etc. is arguably
libstdc++ specific. Currently it's identical to the list of targets
that define __GTHREADS_CXX0X in gthr.h, but that could change. Maybe
gthreads-cxx0x would be the most accurate name for the effective
target, although the "0x" is anachronistic.

You're right that my names are bad though, so I'll definitely improve
them :-)



More information about the Gcc-patches mailing list