Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2004-10-05 11:05:54


John Maddock wrote:

>> When compiling the smart pointer tests with gcc 3.4.2 on Tru64, two
>> tests fail with an error message. (See http://tinyurl.com/4jngu )
>>
>> As far as I can see, the shared pointer implementation at some point
>> includes the "pthread.h" system header file but gcc on Tru64 requires
>> that -pthread must be specified on the command line when including
>> this header file.
>>
>> When running this test with gcc 3.4.2 on Linux the file "pthread.h" is
>> also included but gcc doesn't require the addition of -pthread in the
>> command line on this platform.
>>
>> This leads to the question whether it is ok to include "pthread.h"
>> without specifying -pthread on the command line. Does anyone know an
>> answer to this?
>
> I think on some platforms <pthread.h> doesn't compile unless _REENTRANT
> or some similar compiler-specific magic symbol is defined: in other
> words it's an assert that the compiler is indeed in thread safe mode.

Yes, it's true. _REENTRANT has to be defined, there is an explicit check in
"pthread.h" for this.

> It looks to me as though BOOST_HAS_THREADS is getting set
> unconditionally for gcc on this platform, and presumably we should only
> set it when _REENTRANT is defined (I'm assuming that's the symbol that
> gets defined when the -thread option is used - can you check?).
>
> Hold on... checked the output from config_info and looks as though
> _REENTRANT *is* defined, so I'm mystified. I also note that the
> platform is detected as "generic unix". Do you know what macros gcc
> defines to identify this platform?

Attached is the output of "gcc -ansi -dM". I hope it contains enough
information to answer your questions. Note also that _REENTRANT is not
defined here, therefore its source must be somewhere outside of gcc.

Markus


#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 4294967295U
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __FLT_EVAL_METHOD__ 0
#define __alpha_bwx__ 1
#define __DBL_MIN_10_EXP__ (-307)
#define __FINITE_MATH_ONLY__ 0
#define __LP64__ 1
#define __GNUC_PATCHLEVEL__ 2
#define __SHRT_MAX__ 32767
#define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L
#define __SYSTYPE_BSD 1
#define __unix 1
#define __alpha_ev5__ 1
#define __LDBL_MAX_EXP__ 16384
#define __LANGUAGE_C_PLUS_PLUS 1
#define __SCHAR_MAX__ 127
#define __USER_LABEL_PREFIX__
#define __STDC_HOSTED__ 1
#define __osf__ 1
#define __LDBL_HAS_INFINITY__ 1
#define __DBL_DIG__ 15
#define __FLT_EPSILON__ 1.19209290e-7F
#define __GXX_WEAK__ 0
#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
#define __digital__ 1
#define __unix__ 1
#define __DECIMAL_DIG__ 36
#define __LDBL_HAS_QUIET_NAN__ 1
#define _REENTRANT 1
#define __GNUC__ 3
#define __DBL_MAX__ 1.7976931348623157e+308
#define __DBL_HAS_INFINITY__ 1
#define __X_FLOAT 1
#define __STRICT_ANSI__ 1
#define __cplusplus 1
#define __DEPRECATED 1
#define __DBL_MAX_EXP__ 1024
#define __GNUG__ 3
#define __LANGUAGE_C_PLUS_PLUS__ 1
#define __LONG_LONG_MAX__ 9223372036854775807LL
#define __GXX_ABI_VERSION 1002
#define __FLT_MIN_EXP__ (-125)
#define __DBL_MIN__ 2.2250738585072014e-308
#define __FLT_MIN_10_EXP__ (-37)
#define __DBL_HAS_QUIET_NAN__ 1
#define __REGISTER_PREFIX__
#define __NO_INLINE__ 1
#define __FLT_MANT_DIG__ 24
#define __VERSION__ "3.4.2"
#define __PRAGMA_EXTERN_PREFIX 1
#define __alpha 1
#define __SIZE_TYPE__ long unsigned int
#define __FLT_RADIX__ 2
#define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MAX_10_EXP__ 38
#define __LONG_MAX__ 9223372036854775807L
#define __FLT_HAS_INFINITY__ 1
#define _SYSTYPE_BSD 1
#define __STDC_VERSION__ 199409L
#define __EXCEPTIONS 1
#define __LDBL_MANT_DIG__ 113
#define _LONGLONG 1
#define __WCHAR_TYPE__ unsigned int
#define __FLT_DIG__ 6
#define __INT_MAX__ 2147483647
#define __LONG_DOUBLE_128__ 1
#define __FLT_MAX_EXP__ 128
#define __DBL_MANT_DIG__ 53
#define __WINT_TYPE__ unsigned int
#define __LDBL_MIN_EXP__ (-16381)
#define __WCHAR_UNSIGNED__ 1
#define __LDBL_MAX_10_EXP__ 4932
#define __DBL_EPSILON__ 2.2204460492503131e-16
#define _LP64 1
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __FLT_MAX__ 3.40282347e+38F
#define __GNUC_MINOR__ 4
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L
#define __SYSTYPE_BSD__ 1
#define __PTRDIFF_TYPE__ long int
#define __arch64__ 1
#define __LDBL_MIN_10_EXP__ (-4931)
#define __alpha__ 1
#define __LDBL_DIG__ 33


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk