diff --git a/headers/cpp/stl_alloc.h b/headers/cpp/stl_alloc.h index b44f5f305a..206fd0fa2e 100644 --- a/headers/cpp/stl_alloc.h +++ b/headers/cpp/stl_alloc.h @@ -30,7 +30,6 @@ # define __USE_MALLOC #endif - // This implements some standard node allocators. These are // NOT the same as the allocators in the C++ draft standard or in // in the original STL. They do not encapsulate different pointer @@ -329,11 +328,7 @@ private: // instead of enum { x = N }, but few compilers accept the former. # ifndef __SUNPRO_CC enum {_ALIGN = 8}; -# if (defined(__BEOS__) || defined(__HAIKU__)) - enum {_MAX_BYTES = 0}; -# else enum {_MAX_BYTES = 128}; -# endif enum {_NFREELISTS = _MAX_BYTES/_ALIGN}; # endif static size_t @@ -710,11 +705,7 @@ template __default_alloc_template<__threads, __inst>::_Obj* __VOLATILE __default_alloc_template<__threads, __inst> ::_S_free_list[ _NFREELISTS -#if (defined(__BEOS__) || defined(__HAIKU__)) -] = { }; -#else ] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -#endif // The 16 zeros are necessary to make version 4.1 of the SunPro // compiler happy. Otherwise it appears to allocate too little // space for the array. diff --git a/headers/cpp/stl_config.h b/headers/cpp/stl_config.h index 2e29bca27f..5c619adf1a 100644 --- a/headers/cpp/stl_config.h +++ b/headers/cpp/stl_config.h @@ -87,6 +87,19 @@ // * _NOTHREADS: if defined, don't use any multithreading support. +# define __USE_MALLOC + // BeOS used to trick the STL allocator (in stl_alloc.h) into falling back + // to malloc/free-allocation by setting MAX_BYTES to 0. + // By requesting to use those directly, we should get the same allocator, + // but will avoid the '... creates array of size 0'-warnings that are + // produced by 'gcc -strict' (for instance when building ICU). + // Alternatively, we could define _PTHREADS here and use the real STL + // allocator with posix threads enabled (however, this would have to be + // tested first, and most probably requires a rebuild of gcc2, too, + // in order to make sure that no code existing in libstdc++.r4.so is + // still using the old allocator). + + // Other macros defined by this file: // * bool, true, and false, if __STL_NO_BOOL is defined.