Browse Source

clang: Fix build with LLVM 19

pull/389/head
Er2 2 months ago
parent
commit
0df94c6d28
  1. 6
      datamodel/datamodel.cpp
  2. 11
      public/datamodel/dmattributevar.h
  3. 8
      public/tier1/utlblockmemory.h
  4. 4
      public/tier3/tier3dm.h
  5. 19
      tier0/threadtools.cpp
  6. 1
      tier0/wscript
  7. 5
      wscript

6
datamodel/datamodel.cpp

@ -151,7 +151,7 @@ InitReturnVal_t CDataModel::Init( )
//#define _ELEMENT_HISTOGRAM_ //#define _ELEMENT_HISTOGRAM_
#ifdef _ELEMENT_HISTOGRAM_ #ifdef _ELEMENT_HISTOGRAM_
CUtlMap< UtlSymId_t, int > g_typeHistogram( 0, 100, DefLessFunc( UtlSymId_t ) ); CUtlMap< UtlSymId_t, int > g_typeHistogram( 0, 100, DefLessFunc( UtlSymId_t ) );
#endif _ELEMENT_HISTOGRAM_ #endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -166,7 +166,7 @@ void CDataModel::Shutdown()
Msg( "%d\t%s\n", g_typeHistogram.Element( i ), GetString( g_typeHistogram.Key( i ) ) ); Msg( "%d\t%s\n", g_typeHistogram.Element( i ), GetString( g_typeHistogram.Key( i ) ) );
} }
Msg( "\n" ); Msg( "\n" );
#endif _ELEMENT_HISTOGRAM_ #endif
int c = GetAllocatedElementCount(); int c = GetAllocatedElementCount();
if ( c > 0 ) if ( c > 0 )
@ -1934,7 +1934,7 @@ CDmElement* CDataModel::CreateElement( const DmElementReference_t &ref, const ch
{ {
g_typeHistogram.Insert( typeSym, 1 ); g_typeHistogram.Insert( typeSym, 1 );
} }
#endif _ELEMENT_HISTOGRAM_ #endif
} }
return pElement; return pElement;

11
public/datamodel/dmattributevar.h

@ -368,8 +368,9 @@ protected:
const T& Value() const { return m_Storage; } const T& Value() const { return m_Storage; }
T& Value( ) { return m_Storage; } T& Value( ) { return m_Storage; }
const D& Data() const { return m_Storage; }
D& Data( ) { return m_Storage; } D& Data( ) { return m_Storage; }
public:
const D& Data() const { return m_Storage; }
private: private:
D m_Storage; D m_Storage;
@ -385,8 +386,9 @@ protected:
void Attach( void *pData ) { m_pStorage = (D*)pData; } void Attach( void *pData ) { m_pStorage = (D*)pData; }
const T& Value() const { return *m_pStorage; } const T& Value() const { return *m_pStorage; }
T& Value( ) { return *m_pStorage; } T& Value( ) { return *m_pStorage; }
const D& Data() const { return *m_pStorage; }
D& Data( ) { return *m_pStorage; } D& Data( ) { return *m_pStorage; }
public:
const D& Data() const { return *m_pStorage; }
private: private:
D* m_pStorage; D* m_pStorage;
@ -1152,7 +1154,7 @@ inline void CDmaElement<T>::Init( CDmElement *pOwner, const char *pAttributeName
template <class T> template <class T>
inline UtlSymId_t CDmaElement<T>::GetElementType() const inline UtlSymId_t CDmaElement<T>::GetElementType() const
{ {
return this->Data().m_ElementType; return static_cast<CDmaDataInternal<const T>*>(this)->Data().m_ElementType;
} }
template <class T> template <class T>
@ -1350,7 +1352,8 @@ inline int CDmaStringArrayBase<B>::InsertBefore( int elem, const char *pValue )
template< class E, class B > template< class E, class B >
inline UtlSymId_t CDmaElementArrayConstBase<E,B>::GetElementType() const inline UtlSymId_t CDmaElementArrayConstBase<E,B>::GetElementType() const
{ {
return this->Data().m_ElementType; // Fuck MSVC, anyway I'm unsure about if this code was called
return static_cast<const B*>(this)->Data().m_ElementType;
} }
template< class E, class B > template< class E, class B >

8
public/tier1/utlblockmemory.h

@ -137,10 +137,10 @@ CUtlBlockMemory<T,I>::~CUtlBlockMemory()
template< class T, class I > template< class T, class I >
void CUtlBlockMemory<T,I>::Swap( CUtlBlockMemory< T, I > &mem ) void CUtlBlockMemory<T,I>::Swap( CUtlBlockMemory< T, I > &mem )
{ {
this->swap( m_pMemory, mem.m_pMemory ); Swap( m_pMemory, mem.m_pMemory );
this->swap( m_nBlocks, mem.m_nBlocks ); Swap( m_nBlocks, mem.m_nBlocks );
this->swap( m_nIndexMask, mem.m_nIndexMask ); Swap( m_nIndexMask, mem.m_nIndexMask );
this->swap( m_nIndexShift, mem.m_nIndexShift ); Swap( m_nIndexShift, mem.m_nIndexShift );
} }

4
public/tier3/tier3dm.h

@ -33,7 +33,7 @@ public:
if ( !BaseClass::Connect( factory ) ) if ( !BaseClass::Connect( factory ) )
return false; return false;
if ( IsPrimaryAppSystem() ) if ( this->IsPrimaryAppSystem() )
{ {
ConnectTier3Libraries( &factory, 1 ); ConnectTier3Libraries( &factory, 1 );
} }
@ -42,7 +42,7 @@ public:
virtual void Disconnect() virtual void Disconnect()
{ {
if ( IsPrimaryAppSystem() ) if ( this->IsPrimaryAppSystem() )
{ {
DisconnectTier3Libraries(); DisconnectTier3Libraries();
} }

19
tier0/threadtools.cpp

@ -26,22 +26,19 @@
#include <sys/time.h> #include <sys/time.h>
#define GetLastError() errno #define GetLastError() errno
typedef void *LPVOID; typedef void *LPVOID;
#if !defined(OSX) #if defined(OSX)
#include <fcntl.h>
#include <unistd.h>
#define sem_unlink( arg )
#define OS_TO_PTHREAD(x) (x)
#else
#define pthread_yield pthread_yield_np #define pthread_yield pthread_yield_np
#include <mach/thread_act.h> #include <mach/thread_act.h>
#include <mach/mach.h> #include <mach/mach.h>
#define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x ) #define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x )
#endif // !OSX #elif defined(PLATFORM_BSD)
#ifdef PLATFORM_BSD
# undef OS_TO_PTRHEAD
#define OS_TO_PTHREAD(x) (pthread_t)(x) #define OS_TO_PTHREAD(x) (pthread_t)(x)
#endif #else
#include <fcntl.h>
#include <unistd.h>
#define sem_unlink( arg )
#define OS_TO_PTHREAD(x) (x)
#endif // !OSX
#endif #endif

1
tier0/wscript

@ -15,6 +15,7 @@ def configure(conf):
conf.define('WAF_CFLAGS', conf.env.CFLAGS) conf.define('WAF_CFLAGS', conf.env.CFLAGS)
conf.define('WAF_LDFLAGS', conf.env.LINKFLAGS) conf.define('WAF_LDFLAGS', conf.env.LINKFLAGS)
conf.define('TIER0_DLL_EXPORT',1) conf.define('TIER0_DLL_EXPORT',1)
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
# conf.define('NO_HOOK_MALLOC',1) # conf.define('NO_HOOK_MALLOC',1)
def build(bld): def build(bld):

5
wscript

@ -279,9 +279,6 @@ def define_platform(conf):
'NDEBUG' 'NDEBUG'
]) ])
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
def options(opt): def options(opt):
grp = opt.add_option_group('Common options') grp = opt.add_option_group('Common options')
@ -518,7 +515,7 @@ def configure(conf):
] ]
flags += ['-funwind-tables', '-g'] flags += ['-funwind-tables', '-g']
elif conf.env.COMPILER_CC != 'msvc' and conf.env.DEST_OS != 'darwin' and conf.env.DEST_CPU in ['x86', 'x86_64']: elif conf.env.COMPILER_CC != 'msvc' and conf.env.DEST_OS not in ['darwin', 'freebsd'] and conf.env.DEST_CPU in ['x86', 'x86_64']:
flags += ['-march=core2'] flags += ['-march=core2']
if conf.env.DEST_CPU in ['x86', 'x86_64']: if conf.env.DEST_CPU in ['x86', 'x86_64']:

Loading…
Cancel
Save