mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
update for new Linux gcc
This commit is contained in:
parent
a01e4d38fe
commit
c5e2eefa80
@ -97,5 +97,5 @@
|
||||
// Must global operator new and delete functions throw exceptions?
|
||||
#define GLOBAL_OPERATOR_NEW_EXCEPTIONS 1
|
||||
|
||||
// Do we expect the old STL allocator?
|
||||
#define OLD_STYLE_ALLOCATOR 1
|
||||
// What style STL allocator should we declare?
|
||||
#define GNU_STYLE_ALLOCATOR 1
|
||||
|
@ -190,8 +190,9 @@ $[cdefine HAVE_RTTI]
|
||||
/* Must global operator new and delete functions throw exceptions? */
|
||||
$[cdefine GLOBAL_OPERATOR_NEW_EXCEPTIONS]
|
||||
|
||||
/* Do we expect the old style STL allocator? */
|
||||
/* What style STL allocator should we declare? */
|
||||
$[cdefine OLD_STYLE_ALLOCATOR]
|
||||
$[cdefine GNU_STYLE_ALLOCATOR]
|
||||
|
||||
#end dtool_config.h
|
||||
|
||||
|
@ -16,13 +16,13 @@
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef OLD_STYLE_ALLOCATOR
|
||||
#if defined(OLD_STYLE_ALLOCATOR)
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<class Type>
|
||||
INLINE void *pallocator<Type>::
|
||||
INLINE Type *pallocator<Type>::
|
||||
allocate(size_t n) {
|
||||
return (*global_operator_new)(n);
|
||||
return (Type *)(*global_operator_new)(n);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
@ -32,7 +32,23 @@ deallocate(void *p, size_t) {
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
#else // OLD_STYLE_ALLOCATOR
|
||||
#elif defined(GNU_STYLE_ALLOCATOR)
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<class Type>
|
||||
INLINE Type *pallocator<Type>::
|
||||
allocate(size_t n) {
|
||||
return (Type *)(*global_operator_new)(n);
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
INLINE void pallocator<Type>::
|
||||
deallocate(void *p, size_t) {
|
||||
(*global_operator_delete)(p);
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
#else // *_STYLE_ALLOCATOR
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<class Type>
|
||||
@ -49,4 +65,4 @@ deallocate(void *p, allocator<Type>::size_type) {
|
||||
}
|
||||
#endif // NDEBUG
|
||||
|
||||
#endif // OLD_STYLE_ALLOCATOR
|
||||
#endif // *_STYLE_ALLOCATOR
|
||||
|
@ -34,21 +34,41 @@
|
||||
// to use a pallocator.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef OLD_STYLE_ALLOCATOR
|
||||
// Early versions of gcc used its own kind of allocator, somewhat
|
||||
// different from the STL standard.
|
||||
#if defined(OLD_STYLE_ALLOCATOR)
|
||||
// Early versions of gcc wanted to use its own kind of allocator,
|
||||
// somewhat different from the STL standard. Irix uses this one too.
|
||||
// It might be inherited from an early draft of the STL standard.
|
||||
|
||||
template<class Type>
|
||||
class pallocator : public alloc {
|
||||
public:
|
||||
#ifndef NDEBUG
|
||||
static void *allocate(size_t n);
|
||||
static void deallocate(void *p, size_t n);
|
||||
INLINE static Type *allocate(size_t n);
|
||||
INLINE static void deallocate(void *p, size_t n);
|
||||
#endif // NDEBUG
|
||||
};
|
||||
|
||||
#else // OLD_STYLE_ALLOCATOR
|
||||
#elif defined(GNU_STYLE_ALLOCATOR)
|
||||
// Later versions of gcc want to use a still different, nonstandard
|
||||
// definition. Sheesh.
|
||||
|
||||
template<class Type>
|
||||
class pallocator : public allocator<Type> {
|
||||
public:
|
||||
#ifndef NDEBUG
|
||||
INLINE Type *allocate(size_t n);
|
||||
INLINE void deallocate(void *p, size_t n);
|
||||
#endif // NDEBUG
|
||||
|
||||
template <class _Tp1> struct rebind {
|
||||
typedef pallocator<_Tp1> other;
|
||||
};
|
||||
};
|
||||
|
||||
#else // *_STYLE_ALLOCATOR
|
||||
|
||||
// This is the correct allocator declaration as the current C++
|
||||
// standard defines it.
|
||||
template<class Type>
|
||||
class pallocator : public allocator<Type> {
|
||||
public:
|
||||
@ -57,8 +77,16 @@ public:
|
||||
// INLINE void deallocate(pointer p, size_type n);
|
||||
INLINE void deallocate(void *p, size_type n);
|
||||
#endif // NDEBUG
|
||||
|
||||
#ifdef __GNUC__
|
||||
// Some versions of the gcc library require this structure to be
|
||||
// declared. I don't know what it's all about.
|
||||
template <class _Tp1> struct rebind {
|
||||
typedef pallocator<_Tp1> other;
|
||||
};
|
||||
#endif
|
||||
};
|
||||
#endif // OLD_STYLE_ALLOCATOR
|
||||
#endif // *_STYLE_ALLOCATOR
|
||||
|
||||
#include "pallocator.T"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user