Skip to content

Commit c617351

Browse files
[Build] Fix latest MSVC and CLang compiler errors (alliedmodders#1008)
* Explicit cast specification * Explicit cast specification * Suppress -Wno-tautological-compare in Clang 10 and above https://reviews.llvm.org/rG8b0d14a8f0cc085afa2a9c86c237da81c74517fc * Explicit cast specification * Add HAVE_STDINT_H compiler flag * Explicit casting mechanism type specification * typo
1 parent cac8058 commit c617351

File tree

11 files changed

+35
-5
lines changed

11 files changed

+35
-5
lines changed

AMBuildScript

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ class AMXXConfig(object):
231231
cxx.cflags += ['-Wno-address-of-packed-member']
232232
if have_clang:
233233
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
234+
if cxx.version >= '10.0':
235+
cxx.cxxflags += ['-Wno-tautological-compare']
234236
if cxx.version >= 'apple-clang-10.0':
235237
cxx.cxxflags += [
236238
'-Wno-inconsistent-missing-override',

amxmodx/amxmodx.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
14341434
pPlayer->vgui = false;
14351435

14361436
if (time == -1)
1437-
pPlayer->menuexpire = INFINITE;
1437+
pPlayer->menuexpire = static_cast<float>(INFINITE);
14381438
else
14391439
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
14401440

@@ -1452,7 +1452,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
14521452
pPlayer->vgui = false;
14531453

14541454
if (time == -1)
1455-
pPlayer->menuexpire = INFINITE;
1455+
pPlayer->menuexpire = static_cast<float>(INFINITE);
14561456
else
14571457
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
14581458

amxmodx/newmenus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
930930
time = params[4];
931931

932932
if (time < 0)
933-
pPlayer->menuexpire = INFINITE;
933+
pPlayer->menuexpire = static_cast<float>(INFINITE);
934934
else
935935
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
936936

modules/cstrike/csx/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'csx')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../../public/sdk/amxxmodule.cpp',
812
'CRank.cpp',

modules/dod/dodfun/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'dodfun')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../../public/sdk/amxxmodule.cpp',
812
'NBase.cpp',

modules/dod/dodx/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'dodx')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../../public/sdk/amxxmodule.cpp',
812
'CRank.cpp',

modules/fun/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'fun')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../public/sdk/amxxmodule.cpp',
812
'../../public/memtools/MemoryUtils.cpp',

modules/tfcx/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'tfcx')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../public/sdk/amxxmodule.cpp',
812
'CRank.cpp',

modules/ts/tsfun/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'tsfun')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../../public/sdk/amxxmodule.cpp',
812
]

modules/ts/tsx/AMBuilder

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import os.path
33

44
binary = AMXX.MetaModule(builder, 'tsx')
55

6+
binary.compiler.defines += [
7+
'HAVE_STDINT_H',
8+
]
9+
610
binary.sources = [
711
'../../../public/sdk/amxxmodule.cpp',
812
'CMisc.cpp',

third_party/sqlite/sqlite3.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110245,9 +110245,9 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
110245110245
** handle the rounding directly,
110246110246
** otherwise use printf.
110247110247
*/
110248-
if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
110248+
if( n==0 && r>=0 && r< (double)(LARGEST_INT64) -1 ){
110249110249
r = (double)((sqlite_int64)(r+0.5));
110250-
}else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
110250+
}else if( n==0 && r<0 && (-r)< (double)(LARGEST_INT64) -1 ){
110251110251
r = -(double)((sqlite_int64)((-r)+0.5));
110252110252
}else{
110253110253
zBuf = sqlite3_mprintf("%.*f",n,r);

0 commit comments

Comments
 (0)