Skip to content

Commit 0df94c6

Browse files
committed
clang: Fix build with LLVM 19
1 parent 2998568 commit 0df94c6

File tree

7 files changed

+26
-28
lines changed

7 files changed

+26
-28
lines changed

datamodel/datamodel.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ InitReturnVal_t CDataModel::Init( )
151151
//#define _ELEMENT_HISTOGRAM_
152152
#ifdef _ELEMENT_HISTOGRAM_
153153
CUtlMap< UtlSymId_t, int > g_typeHistogram( 0, 100, DefLessFunc( UtlSymId_t ) );
154-
#endif _ELEMENT_HISTOGRAM_
154+
#endif
155155

156156

157157
//-----------------------------------------------------------------------------
@@ -166,7 +166,7 @@ void CDataModel::Shutdown()
166166
Msg( "%d\t%s\n", g_typeHistogram.Element( i ), GetString( g_typeHistogram.Key( i ) ) );
167167
}
168168
Msg( "\n" );
169-
#endif _ELEMENT_HISTOGRAM_
169+
#endif
170170

171171
int c = GetAllocatedElementCount();
172172
if ( c > 0 )
@@ -1934,7 +1934,7 @@ CDmElement* CDataModel::CreateElement( const DmElementReference_t &ref, const ch
19341934
{
19351935
g_typeHistogram.Insert( typeSym, 1 );
19361936
}
1937-
#endif _ELEMENT_HISTOGRAM_
1937+
#endif
19381938
}
19391939

19401940
return pElement;

public/datamodel/dmattributevar.h

+7-4
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,9 @@ class CDmaDataInternal
368368

369369
const T& Value() const { return m_Storage; }
370370
T& Value( ) { return m_Storage; }
371-
const D& Data() const { return m_Storage; }
372371
D& Data( ) { return m_Storage; }
372+
public:
373+
const D& Data() const { return m_Storage; }
373374

374375
private:
375376
D m_Storage;
@@ -385,8 +386,9 @@ class CDmaDataExternal
385386
void Attach( void *pData ) { m_pStorage = (D*)pData; }
386387
const T& Value() const { return *m_pStorage; }
387388
T& Value( ) { return *m_pStorage; }
388-
const D& Data() const { return *m_pStorage; }
389389
D& Data( ) { return *m_pStorage; }
390+
public:
391+
const D& Data() const { return *m_pStorage; }
390392

391393
private:
392394
D* m_pStorage;
@@ -1152,7 +1154,7 @@ inline void CDmaElement<T>::Init( CDmElement *pOwner, const char *pAttributeName
11521154
template <class T>
11531155
inline UtlSymId_t CDmaElement<T>::GetElementType() const
11541156
{
1155-
return this->Data().m_ElementType;
1157+
return static_cast<CDmaDataInternal<const T>*>(this)->Data().m_ElementType;
11561158
}
11571159

11581160
template <class T>
@@ -1350,7 +1352,8 @@ inline int CDmaStringArrayBase<B>::InsertBefore( int elem, const char *pValue )
13501352
template< class E, class B >
13511353
inline UtlSymId_t CDmaElementArrayConstBase<E,B>::GetElementType() const
13521354
{
1353-
return this->Data().m_ElementType;
1355+
// Fuck MSVC, anyway I'm unsure about if this code was called
1356+
return static_cast<const B*>(this)->Data().m_ElementType;
13541357
}
13551358

13561359
template< class E, class B >

public/tier1/utlblockmemory.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ CUtlBlockMemory<T,I>::~CUtlBlockMemory()
137137
template< class T, class I >
138138
void CUtlBlockMemory<T,I>::Swap( CUtlBlockMemory< T, I > &mem )
139139
{
140-
this->swap( m_pMemory, mem.m_pMemory );
141-
this->swap( m_nBlocks, mem.m_nBlocks );
142-
this->swap( m_nIndexMask, mem.m_nIndexMask );
143-
this->swap( m_nIndexShift, mem.m_nIndexShift );
140+
Swap( m_pMemory, mem.m_pMemory );
141+
Swap( m_nBlocks, mem.m_nBlocks );
142+
Swap( m_nIndexMask, mem.m_nIndexMask );
143+
Swap( m_nIndexShift, mem.m_nIndexShift );
144144
}
145145

146146

public/tier3/tier3dm.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class CTier3DmAppSystem : public CTier2DmAppSystem< IInterface, ConVarFlag >
3333
if ( !BaseClass::Connect( factory ) )
3434
return false;
3535

36-
if ( IsPrimaryAppSystem() )
36+
if ( this->IsPrimaryAppSystem() )
3737
{
3838
ConnectTier3Libraries( &factory, 1 );
3939
}
@@ -42,7 +42,7 @@ class CTier3DmAppSystem : public CTier2DmAppSystem< IInterface, ConVarFlag >
4242

4343
virtual void Disconnect()
4444
{
45-
if ( IsPrimaryAppSystem() )
45+
if ( this->IsPrimaryAppSystem() )
4646
{
4747
DisconnectTier3Libraries();
4848
}

tier0/threadtools.cpp

+8-11
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,20 @@
2626
#include <sys/time.h>
2727
#define GetLastError() errno
2828
typedef void *LPVOID;
29-
#if !defined(OSX)
30-
#include <fcntl.h>
31-
#include <unistd.h>
32-
#define sem_unlink( arg )
33-
#define OS_TO_PTHREAD(x) (x)
34-
#else
29+
#if defined(OSX)
3530
#define pthread_yield pthread_yield_np
3631
#include <mach/thread_act.h>
3732
#include <mach/mach.h>
3833
#define OS_TO_PTHREAD(x) pthread_from_mach_thread_np( x )
34+
#elif defined(PLATFORM_BSD)
35+
#define OS_TO_PTHREAD(x) (pthread_t)(x)
36+
#else
37+
#include <fcntl.h>
38+
#include <unistd.h>
39+
#define sem_unlink( arg )
40+
#define OS_TO_PTHREAD(x) (x)
3941
#endif // !OSX
4042

41-
#ifdef PLATFORM_BSD
42-
# undef OS_TO_PTRHEAD
43-
# define OS_TO_PTHREAD(x) (pthread_t)(x)
44-
#endif
45-
4643
#endif
4744

4845
#ifndef _PS3

tier0/wscript

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def configure(conf):
1515
conf.define('WAF_CFLAGS', conf.env.CFLAGS)
1616
conf.define('WAF_LDFLAGS', conf.env.LINKFLAGS)
1717
conf.define('TIER0_DLL_EXPORT',1)
18+
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
1819
# conf.define('NO_HOOK_MALLOC',1)
1920

2021
def build(bld):

wscript

+1-4
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,6 @@ def define_platform(conf):
279279
'NDEBUG'
280280
])
281281

282-
conf.define('GIT_COMMIT_HASH', conf.env.GIT_VERSION)
283-
284-
285282
def options(opt):
286283
grp = opt.add_option_group('Common options')
287284

@@ -518,7 +515,7 @@ def configure(conf):
518515
]
519516

520517
flags += ['-funwind-tables', '-g']
521-
elif conf.env.COMPILER_CC != 'msvc' and conf.env.DEST_OS != 'darwin' and conf.env.DEST_CPU in ['x86', 'x86_64']:
518+
elif conf.env.COMPILER_CC != 'msvc' and conf.env.DEST_OS not in ['darwin', 'freebsd'] and conf.env.DEST_CPU in ['x86', 'x86_64']:
522519
flags += ['-march=core2']
523520

524521
if conf.env.DEST_CPU in ['x86', 'x86_64']:

0 commit comments

Comments
 (0)