This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [v3] libstdc++/49745 (review required for the gthr-posix.h changes)


On Fri, Jul 15, 2011 at 09:36:48AM -0400, Jason Merrill wrote:
> On 07/15/2011 08:47 AM, Paolo Carlini wrote:
> >The patch should be in general quite conservative and safe, in
> >particular, the gthr-posix.h changes, which I cannot approve myself,
> >touch bits only used by libstdc++-v3 + the macro avoiding the
> >unconditional inclusion of <unistd.h>, which, according to Jakub's
> >analysis, should be required only by objc.
> 
> I'm a little uncomfortable with defining a macro in libstdc++ to be
> used by the gthr files in gcc.  I would lean more toward a
> gthr-posix-conf.h generated by GCC configure.

gthr-posix.h already uses other macros defined by other library
headers, like _LIBOBJC.  gthr-posix-conf.h looks like an overkill to me,
but if e.g. libstdc++ headers defined a 0/1 macro always
(_GTHREAD_USE_TIMEDLOCK 0 would mean don't define it, _GTHREAD_USE_TIMEDLOCK 1
would mean you can safely assume timedlock is available, and not presence
of that macro would lead to inclusion of unistd.h and deciding itself
based on _POSIX_TIMEOUTS:

#ifndef _GTHREAD_USE_TIMEDLOCK
#include <unistd.h>
#ifdef _POSIX_TIMEOUTS
#if _POSIX_TIMEOUTS >= 0
#define _GTHREAD_USE_TIMEDLOCK 1
#else
#define _GTHREAD_USE_TIMEDLOCK 0
#else
#define _GTHREAD_USE_TIMEDLOCK 0
#endif
and use

#if _GTHREAD_USE_TIMEDLOCK
...
#endif

then when gthr.h is used outside of libstdc++ it wouldn't depend on
libstdc++ configury.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]