1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-01-03 16:13:22 +08:00

Various fixes for building static libs on Mac OS X and Linux.

This commit is contained in:
Scott Ehlert 2014-03-01 13:28:50 -06:00
parent 86892164eb
commit 755381dc49
10 changed files with 103 additions and 79 deletions

View File

@ -30,12 +30,13 @@ ifeq "$(OS)" "Darwin"
CC = /usr/bin/clang CC = /usr/bin/clang
CPLUS = /usr/bin/clang++ CPLUS = /usr/bin/clang++
CLINK = /usr/bin/clang CLINK = /usr/bin/clang
CPP_LIB =
else else
CC = /usr/bin/gcc CC = /usr/bin/gcc
CPLUS = /usr/bin/g++ CPLUS = /usr/bin/g++
CLINK = /usr/bin/gcc CLINK = /usr/bin/gcc
CPP_LIB = "$(SRCDS_DIR)/bin/libstdc++.so.6 $(SRCDS_DIR)/bin/libgcc_s.so.1"
endif endif
CPP_LIB = "libstdc++.a libgcc_eh.a"
# put any compiler flags you want passed here # put any compiler flags you want passed here
USER_CFLAGS = USER_CFLAGS =
@ -56,7 +57,16 @@ DEBUG = false
############################################################################# #############################################################################
# Things below here shouldn't need to be altered # Things below here shouldn't need to be altered
############################################################################# #############################################################################
OS := $(shell uname -s) IS_CLANG := $(shell $(CPP) --version | head -1 | grep clang > /dev/null && echo "1" || echo "0")
ifeq "$(IS_CLANG)" "1"
CPP_MAJOR := $(shell $(CPP) --version | grep clang | sed "s/.*version \([0-9]\)*\.[0-9]*.*/\1/")
CPP_MINOR := $(shell $(CPP) --version | grep clang | sed "s/.*version [0-9]*\.\([0-9]\)*.*/\1/")
else
CPP_MAJOR := $(shell $(CPP) -dumpversion >&1 | cut -b1)
CPP_MINOR := $(shell $(CPP) -dumpversion >&1 | cut -b3)
endif
MAKE = make MAKE = make
AR = "ar rvs" AR = "ar rvs"
@ -80,20 +90,30 @@ ARCH = i486
ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -msse -msse2 -m32 ARCH_CFLAGS = -mtune=i686 -march=pentium3 -mmmx -msse -msse2 -m32
ifeq "$(OS)" "Darwin" ifeq "$(OS)" "Darwin"
DEFINES = -D_OSX -DOSX DEFINES = -D_OSX -DOSX -D_DLL_EXT=.dylib
ARCH_CFLAGS += -mmacosx-version-min=10.7 ARCH_CFLAGS += -mmacosx-version-min=10.7
SHLIBEXT = dylib
SHLIBLDFLAGS = -dynamiclib -mmacosx-version-min=10.7
SHLIBSUFFIX =
else else
DEFINES = -D_LINUX -DLINUX DEFINES = -D_LINUX -DLINUX -D_DLL_EXT=.so
SHLIBEXT = so
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt
SHLIBSUFFIX =
endif endif
DEFINES += -DCOMPILER_GCC -DPOSIX -DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp \ DEFINES +=-DVPROF_LEVEL=1 -DSWDS -D_finite=finite -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp \
-D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Dstrnicmp=strncasecmp -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -DPOSIX -DGNUC -DCOMPILER_GCC -DNO_MALLOC_OVERRIDE
UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE UNDEF = -Usprintf -Ustrncpy -UPROTECTED_THINGS_ENABLE
BASE_CFLAGS = -fno-strict-aliasing -Wall -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof BASE_CFLAGS = -fno-strict-aliasing -Wall -Wsign-compare -Werror -Wno-conversion -Wno-overloaded-virtual -Wno-non-virtual-dtor -Wno-invalid-offsetof \
SHLIBEXT = so -Wno-unknown-pragmas -Wno-unused
SHLIBCFLAGS = -fPIC SHLIBCFLAGS = -fPIC
SHLIBLDFLAGS = -shared -Wl,-Map,$@_map.txt -Wl
# Clang >= 3 || GCC >= 4.7
ifeq "$(shell expr $(IS_CLANG) \& $(CPP_MAJOR) \>= 3 \| $(CPP_MAJOR) \>= 4 \& $(CPP_MINOR) \>= 7)" "1"
BASE_CFLAGS += -Wno-delete-non-virtual-dtor -Wno-narrowing
endif
# Flags passed to the c compiler # Flags passed to the c compiler
CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -O3 $(BASE_CFLAGS) CFLAGS = $(DEFINES) $(ARCH_CFLAGS) -O3 $(BASE_CFLAGS)
@ -109,7 +129,7 @@ DBG_CFLAGS = "$(DEFINES) $(ARCH_CFLAGS) -g -ggdb $(BASE_CFLAGS) $(UNDEF)"
# define list passed to make for the sub makefile # define list passed to make for the sub makefile
BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG) \ BASE_DEFINES = CC=$(CC) AR=$(AR) CPLUS=$(CPLUS) CPP_LIB=$(CPP_LIB) DEBUG=$(DEBUG) \
BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SRC_DIR=$(SRC_DIR) \ BUILD_DIR=$(BUILD_DIR) BUILD_OBJ_DIR=$(BUILD_OBJ_DIR) SRC_DIR=$(SRC_DIR) \
LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS=$(SHLIBLDFLAGS) SHLIBEXT=$(SHLIBEXT) \ LIB_DIR=$(LIB_DIR) SHLIBLDFLAGS="$(SHLIBLDFLAGS)" SHLIBEXT=$(SHLIBEXT) SHLIBSUFFIX=$(SHLIBSUFFIX) \
CLINK=$(CLINK) CFLAGS="$(CFLAGS)" DBG_CFLAGS=$(DBG_CFLAGS) LDFLAGS=$(LDFLAGS) \ CLINK=$(CLINK) CFLAGS="$(CFLAGS)" DBG_CFLAGS=$(DBG_CFLAGS) LDFLAGS=$(LDFLAGS) \
DEFINES="$(DEFINES)" DBG_DEFINES=$(DBG_DEFINES) \ DEFINES="$(DEFINES)" DBG_DEFINES=$(DBG_DEFINES) \
ARCH=$(ARCH) SRCDS_DIR=$(SRCDS_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \ ARCH=$(ARCH) SRCDS_DIR=$(SRCDS_DIR) MOD_CONFIG=$(MOD_CONFIG) NAME=$(NAME) \
@ -133,10 +153,10 @@ check:
cd $(BUILD_DIR) cd $(BUILD_DIR)
if [ ! -e "$(LIB_DIR)/tier1_i486.a" ]; then $(MAKE) tier1;fi if [ ! -e "$(LIB_DIR)/tier1_i486.a" ]; then $(MAKE) tier1;fi
if [ ! -e "$(LIB_DIR)/mathlib_i486.a" ]; then $(MAKE) mathlib;fi if [ ! -e "$(LIB_DIR)/mathlib_i486.a" ]; then $(MAKE) mathlib;fi
if [ ! -e "$(LIB_DIR)/choreoobjects_i486.a" ]; then $(MAKE) choreo;fi if [ ! -e "$(LIB_DIR)/interfaces_i486.a" ]; then $(MAKE) interfaces;fi
if [ ! -f "tier0_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/tier0_i486.so .; fi if [ ! -f "libtier0$(SHLIBSUFFIX).$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libtier0$(SHLIBSUFFIX).$(SHLIBEXT) .; fi
if [ ! -f "vstdlib_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/vstdlib_i486.so .; fi if [ ! -f "libvstdlib$(SHLIBSUFFIX).$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libvstdlib$(SHLIBSUFFIX).$(SHLIBEXT) .; fi
if [ ! -f "steam_api_i486.so" ]; then ln -s $(SRCDS_DIR)/bin/steam_api_i486.so .; fi if [ ! -f "libsteam_api.$(SHLIBEXT)" ]; then ln -fs $(LIB_DIR)/libsteam_api.$(SHLIBEXT) .; fi
vcpm: check vcpm: check
if [ ! -e "vcpm" ]; then $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES);fi if [ ! -e "vcpm" ]; then $(MAKE) -f $(MAKE_VCPM) $(BASE_DEFINES);fi

View File

@ -23,7 +23,7 @@
#include "tier1/interface.h" #include "tier1/interface.h"
#include "tier1/utlvector.h" #include "tier1/utlvector.h"
#include "tier1/utldict.h" #include "tier1/utldict.h"
#include "tier1/utlstringmap.h" #include "tier1/UtlStringMap.h"
#include "IAppSystem.h" #include "IAppSystem.h"
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -351,6 +351,7 @@ public:
case DC_AGE_DISCARD: case DC_AGE_DISCARD:
case DC_FLUSH_DISCARD: case DC_FLUSH_DISCARD:
case DC_REMOVED: case DC_REMOVED:
default:
Assert ( 0 ); Assert ( 0 );
return false; return false;
} }
@ -536,6 +537,7 @@ public:
case DC_AGE_DISCARD: case DC_AGE_DISCARD:
case DC_FLUSH_DISCARD: case DC_FLUSH_DISCARD:
case DC_REMOVED: case DC_REMOVED:
default:
STORAGE_TYPE *p = (STORAGE_TYPE *)notification.clientId; STORAGE_TYPE *p = (STORAGE_TYPE *)notification.clientId;
p->DestroyResource(); p->DestroyResource();
return true; return true;

View File

@ -12,7 +12,7 @@
#endif #endif
#include "tier0/platform.h" #include "tier0/platform.h"
#include "appframework/iappsystem.h" #include "appframework/IAppSystem.h"
enum LoaderError_t enum LoaderError_t
{ {

View File

@ -23,9 +23,8 @@
#include "tier1/strtools.h" #include "tier1/strtools.h"
#include "filesystem_init.h" #include "filesystem_init.h"
#include "tier0/icommandline.h" #include "tier0/icommandline.h"
#include "tier0/stacktools.h" #include "KeyValues.h"
#include "keyvalues.h" #include "appframework/IAppSystemGroup.h"
#include "appframework/iappsystemgroup.h"
#include "tier1/smartptr.h" #include "tier1/smartptr.h"
#if defined( _X360 ) #if defined( _X360 )
#include "xbox\xbox_win32stubs.h" #include "xbox\xbox_win32stubs.h"
@ -546,7 +545,7 @@ bool IsLowViolenceBuild( void )
return retVal; return retVal;
#elif POSIX #elif POSIX
return false; return false;
#elif #else
#error "Fix me" #error "Fix me"
#endif #endif
} }
@ -620,21 +619,6 @@ static void FileSystem_AddLoadedSearchPath(
initInfo.m_pFileSystem->AddSearchPath( fullLocationPath, pPathID, PATH_ADD_TO_TAIL ); initInfo.m_pFileSystem->AddSearchPath( fullLocationPath, pPathID, PATH_ADD_TO_TAIL );
} }
bool FileSystem_IsHldsUpdateToolDedicatedServer()
{
// To determine this, we see if the directory our executable was launched from is "orangebox".
// We only are under "orangebox" if we're run from hldsupdatetool.
char baseDir[MAX_PATH];
if ( !FileSystem_GetBaseDir( baseDir, sizeof( baseDir ) ) )
return false;
V_FixSlashes( baseDir );
V_StripTrailingSlash( baseDir );
const char *pLastDir = V_UnqualifiedFileName( baseDir );
return ( pLastDir && V_stricmp( pLastDir, "orangebox" ) == 0 );
}
#ifdef ENGINE_DLL #ifdef ENGINE_DLL
extern void FileSystem_UpdateAddonSearchPaths( IFileSystem *pFileSystem ); extern void FileSystem_UpdateAddonSearchPaths( IFileSystem *pFileSystem );
#endif #endif
@ -690,14 +674,6 @@ FSReturnCode_t FileSystem_LoadSearchPaths( CFSSearchPathsInit &initInfo )
// Add the Orange-box path (which also will include whatever the depots mapped in as well if we're // Add the Orange-box path (which also will include whatever the depots mapped in as well if we're
// running a Steam-launched app). // running a Steam-launched app).
FileSystem_AddLoadedSearchPath( initInfo, pPathID, &bFirstGamePath, baseDir, pLocation, bLowViolence ); FileSystem_AddLoadedSearchPath( initInfo, pPathID, &bFirstGamePath, baseDir, pLocation, bLowViolence );
if ( FileSystem_IsHldsUpdateToolDedicatedServer() )
{
// If we're using the hldsupdatetool dedicated server, then go up a directory to get the ep1-era files too.
char ep1EraPath[MAX_PATH];
V_snprintf( ep1EraPath, sizeof( ep1EraPath ), "..%c%s", CORRECT_PATH_SEPARATOR, pLocation );
FileSystem_AddLoadedSearchPath( initInfo, pPathID, &bFirstGamePath, baseDir, ep1EraPath, bLowViolence );
}
} }
else else
{ {

View File

@ -175,7 +175,7 @@ inline ICvar::Iterator::Iterator(ICvar *icvar)
inline ICvar::Iterator::~Iterator( void ) inline ICvar::Iterator::~Iterator( void )
{ {
g_pMemAlloc->Free(m_pIter); free(m_pIter);
} }
inline void ICvar::Iterator::SetFirst( void ) inline void ICvar::Iterator::SetFirst( void )

View File

@ -36,9 +36,11 @@
// Undefine this if using a compiler lacking threadsafe RTTI (like vc6) // Undefine this if using a compiler lacking threadsafe RTTI (like vc6)
#define MEM_DEBUG_CLASSNAME 1 #define MEM_DEBUG_CLASSNAME 1
#if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE)
#include <stddef.h> #include <stddef.h>
#if defined(OSX)
#include <malloc/malloc.h>
#endif
#ifdef LINUX #ifdef LINUX
#undef offsetof #undef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m) #define offsetof(s,m) (size_t)&(((s *)0)->m)
@ -46,6 +48,8 @@
#include "tier0/mem.h" #include "tier0/mem.h"
#if !defined(STEAM) && !defined(NO_MALLOC_OVERRIDE)
struct _CrtMemState; struct _CrtMemState;
#define MEMALLOC_VERSION 1 #define MEMALLOC_VERSION 1
@ -488,15 +492,59 @@ struct MemAllocFileLine_t
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#elif defined( POSIX )
#if defined( OSX )
// Mac always aligns allocs, don't need to call posix_memalign which doesn't exist in 10.5.8 which TF2 still needs to run on
//inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; posix_memalign(&pTmp, alignment, size); return pTmp;}
inline void *memalign(size_t alignment, size_t size) {void *pTmp=NULL; pTmp = malloc(size); return pTmp;}
#endif
inline void *_aligned_malloc( size_t nSize, size_t align ) { return memalign( align, nSize ); }
inline void _aligned_free( void *ptr ) { free( ptr ); }
inline void *MemAlloc_Alloc( size_t nSize, const char *pFileName = NULL, int nLine = 0 ) { return malloc( nSize ); }
inline void MemAlloc_Free( void *ptr, const char *pFileName = NULL, int nLine = 0 ) { free( ptr ); }
inline void *MemAlloc_AllocAligned( size_t size, size_t align, const char *pszFile = NULL, int nLine = 0 ) { return memalign( align, size ); }
inline void *MemAlloc_AllocAlignedFileLine( size_t size, size_t align, const char *pszFile = NULL, int nLine = 0 ) { return memalign( align, size ); }
inline void MemAlloc_FreeAligned( void *pMemBlock, const char *pszFile = NULL, int nLine = 0 ) { free( pMemBlock ); }
#if defined( OSX )
inline size_t _msize( void *ptr ) { return malloc_size( ptr ); }
#else
inline size_t _msize( void *ptr ) { return malloc_usable_size( ptr ); }
#endif
inline void *MemAlloc_ReallocAligned( void *ptr, size_t size, size_t align )
{
void *ptr_new_aligned = memalign( align, size );
if( ptr_new_aligned )
{
size_t old_size = _msize( ptr );
size_t copy_size = ( size < old_size ) ? size : old_size;
memcpy( ptr_new_aligned, ptr, copy_size );
free( ptr );
}
return ptr_new_aligned;
}
#else
#define MemAlloc_GetDebugInfoSize() g_pMemAlloc->GetDebugInfoSize()
#define MemAlloc_SaveDebugInfo( pvDebugInfo ) g_pMemAlloc->SaveDebugInfo( pvDebugInfo )
#define MemAlloc_RestoreDebugInfo( pvDebugInfo ) g_pMemAlloc->RestoreDebugInfo( pvDebugInfo )
#define MemAlloc_InitDebugInfo( pvDebugInfo, pchRootFileName, nLine ) g_pMemAlloc->InitDebugInfo( pvDebugInfo, pchRootFileName, nLine )
#endif // !STEAM && !NO_MALLOC_OVERRIDE #endif // !STEAM && !NO_MALLOC_OVERRIDE
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#if !defined(STEAM) && defined(NO_MALLOC_OVERRIDE) #if !defined(STEAM) && defined(NO_MALLOC_OVERRIDE)
#include <malloc.h>
#define MEM_ALLOC_CREDIT_(tag) ((void)0) #define MEM_ALLOC_CREDIT_(tag) ((void)0)
#define MEM_ALLOC_CREDIT() MEM_ALLOC_CREDIT_(__FILE__) #define MEM_ALLOC_CREDIT() MEM_ALLOC_CREDIT_(__FILE__)
#define MEM_ALLOC_CREDIT_FUNCTION()
#define MEM_ALLOC_CREDIT_CLASS() #define MEM_ALLOC_CREDIT_CLASS()
#define MEM_ALLOC_CLASSNAME(type) NULL #define MEM_ALLOC_CLASSNAME(type) NULL
@ -507,28 +555,6 @@ struct MemAllocFileLine_t
#define MemAlloc_RegisterExternalAllocation( tag, p, size ) ((void)0) #define MemAlloc_RegisterExternalAllocation( tag, p, size ) ((void)0)
#define MemAlloc_RegisterExternalDeallocation( tag, p, size ) ((void)0) #define MemAlloc_RegisterExternalDeallocation( tag, p, size ) ((void)0)
inline void *MemAlloc_AllocAligned( size_t size, size_t align )
{
return (void *)_aligned_malloc( size, align );
}
inline void *MemAlloc_AllocAligned( size_t size, size_t align, const char *pszFile, int nLine )
{
pszFile = pszFile;
nLine = nLine;
return (void *)_aligned_malloc( size, align );
}
inline void MemAlloc_FreeAligned( void *pMemBlock )
{
_aligned_free( pMemBlock );
}
inline void MemAlloc_FreeAligned( void *pMemBlock, const char *pszFile, int nLine )
{
pszFile = pszFile;
nLine = nLine;
_aligned_free( pMemBlock );
}
#endif // !STEAM && NO_MALLOC_OVERRIDE #endif // !STEAM && NO_MALLOC_OVERRIDE
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -21,13 +21,13 @@
//============================================================================= //=============================================================================
// using macro to be compatable with GCC // using macro to be compatable with GCC
#define FmtStrVSNPrintf( szBuf, nBufSize, ppszFormat ) \ #define FmtStrVSNPrintf( szBuf, nBufSize, ppszFormat, lastArg ) \
do \ do \
{ \ { \
int result; \ int result; \
va_list arg_ptr; \ va_list arg_ptr; \
\ \
va_start(arg_ptr, (*(ppszFormat))); \ va_start(arg_ptr, lastArg); \
result = Q_vsnprintf((szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr); \ result = Q_vsnprintf((szBuf), (nBufSize)-1, (*(ppszFormat)), arg_ptr); \
va_end(arg_ptr); \ va_end(arg_ptr); \
\ \
@ -50,26 +50,26 @@ public:
// Standard C formatting // Standard C formatting
CFmtStrN(const char *pszFormat, ...) FMTFUNCTION( 2, 3 ) CFmtStrN(const char *pszFormat, ...) FMTFUNCTION( 2, 3 )
{ {
FmtStrVSNPrintf(m_szBuf, SIZE_BUF, &pszFormat); FmtStrVSNPrintf(m_szBuf, SIZE_BUF, &pszFormat, pszFormat);
} }
// Use this for pass-through formatting // Use this for pass-through formatting
CFmtStrN(const char ** ppszFormat, ...) CFmtStrN(const char ** ppszFormat, ...)
{ {
FmtStrVSNPrintf(m_szBuf, SIZE_BUF, ppszFormat); FmtStrVSNPrintf(m_szBuf, SIZE_BUF, ppszFormat, ppszFormat);
} }
// Explicit reformat // Explicit reformat
const char *sprintf(const char *pszFormat, ...) FMTFUNCTION( 2, 3 ) const char *sprintf(const char *pszFormat, ...) FMTFUNCTION( 2, 3 )
{ {
FmtStrVSNPrintf(m_szBuf, SIZE_BUF, &pszFormat); FmtStrVSNPrintf(m_szBuf, SIZE_BUF, &pszFormat, pszFormat);
return m_szBuf; return m_szBuf;
} }
// Use this for pass-through formatting // Use this for pass-through formatting
void VSprintf(const char **ppszFormat, ...) void VSprintf(const char **ppszFormat, ...)
{ {
FmtStrVSNPrintf(m_szBuf, SIZE_BUF, ppszFormat); FmtStrVSNPrintf(m_szBuf, SIZE_BUF, ppszFormat, ppszFormat);
} }
// Use for access // Use for access
@ -81,7 +81,7 @@ public:
void Clear() { m_szBuf[0] = 0; } void Clear() { m_szBuf[0] = 0; }
void AppendFormat( const char *pchFormat, ... ) { int nLength = Length(); char *pchEnd = m_szBuf + nLength; FmtStrVSNPrintf( pchEnd, SIZE_BUF - nLength, &pchFormat ); } void AppendFormat( const char *pchFormat, ... ) { int nLength = Length(); char *pchEnd = m_szBuf + nLength; FmtStrVSNPrintf( pchEnd, SIZE_BUF - nLength, &pchFormat, pchFormat ); }
void AppendFormatV( const char *pchFormat, va_list args ); void AppendFormatV( const char *pchFormat, va_list args );
void Append( const char *pchValue ) { AppendFormat( pchValue ); } void Append( const char *pchValue ) { AppendFormat( pchValue ); }

View File

@ -107,7 +107,7 @@ template < typename T >
class CArrayAutoPtr : public CPlainAutoPtr < T > // Warning: no polymorphic destructor (delete on base class will be a mistake) class CArrayAutoPtr : public CPlainAutoPtr < T > // Warning: no polymorphic destructor (delete on base class will be a mistake)
{ {
public: public:
explicit CArrayAutoPtr( T *p = NULL ) { Attach( p ); } explicit CArrayAutoPtr( T *p = NULL ) { this->Attach( p ); }
~CArrayAutoPtr( void ) { Delete(); } ~CArrayAutoPtr( void ) { Delete(); }
public: public:

View File

@ -272,7 +272,7 @@ private:
char m_Memory[ SIZE*sizeof(T) + nAlignment ]; char m_Memory[ SIZE*sizeof(T) + nAlignment ];
}; };
#ifdef _LINUX #if defined(POSIX)
#define REMEMBER_ALLOC_SIZE_FOR_VALGRIND 1 #define REMEMBER_ALLOC_SIZE_FOR_VALGRIND 1
#endif #endif