Skip to content

Commit

Permalink
[Build] Fix latest MSVC and CLang compiler errors (alliedmodders#1008)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ShootingKing-AM committed Oct 8, 2021
1 parent cac8058 commit c617351
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 5 deletions.
2 changes: 2 additions & 0 deletions AMBuildScript
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ class AMXXConfig(object):
cxx.cflags += ['-Wno-address-of-packed-member']
if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= '10.0':
cxx.cxxflags += ['-Wno-tautological-compare']
if cxx.version >= 'apple-clang-10.0':
cxx.cxxflags += [
'-Wno-inconsistent-missing-override',
Expand Down
4 changes: 2 additions & 2 deletions amxmodx/amxmodx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
pPlayer->vgui = false;

if (time == -1)
pPlayer->menuexpire = INFINITE;
pPlayer->menuexpire = static_cast<float>(INFINITE);
else
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);

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

if (time == -1)
pPlayer->menuexpire = INFINITE;
pPlayer->menuexpire = static_cast<float>(INFINITE);
else
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);

Expand Down
2 changes: 1 addition & 1 deletion amxmodx/newmenus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
time = params[4];

if (time < 0)
pPlayer->menuexpire = INFINITE;
pPlayer->menuexpire = static_cast<float>(INFINITE);
else
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);

Expand Down
4 changes: 4 additions & 0 deletions modules/cstrike/csx/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../../public/sdk/amxxmodule.cpp',
'CRank.cpp',
Expand Down
4 changes: 4 additions & 0 deletions modules/dod/dodfun/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../../public/sdk/amxxmodule.cpp',
'NBase.cpp',
Expand Down
4 changes: 4 additions & 0 deletions modules/dod/dodx/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../../public/sdk/amxxmodule.cpp',
'CRank.cpp',
Expand Down
4 changes: 4 additions & 0 deletions modules/fun/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../public/sdk/amxxmodule.cpp',
'../../public/memtools/MemoryUtils.cpp',
Expand Down
4 changes: 4 additions & 0 deletions modules/tfcx/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../public/sdk/amxxmodule.cpp',
'CRank.cpp',
Expand Down
4 changes: 4 additions & 0 deletions modules/ts/tsfun/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../../public/sdk/amxxmodule.cpp',
]
Expand Down
4 changes: 4 additions & 0 deletions modules/ts/tsx/AMBuilder
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import os.path

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

binary.compiler.defines += [
'HAVE_STDINT_H',
]

binary.sources = [
'../../../public/sdk/amxxmodule.cpp',
'CMisc.cpp',
Expand Down
4 changes: 2 additions & 2 deletions third_party/sqlite/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -110245,9 +110245,9 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
** handle the rounding directly,
** otherwise use printf.
*/
if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
if( n==0 && r>=0 && r< (double)(LARGEST_INT64) -1 ){
r = (double)((sqlite_int64)(r+0.5));
}else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
}else if( n==0 && r<0 && (-r)< (double)(LARGEST_INT64) -1 ){
r = -(double)((sqlite_int64)((-r)+0.5));
}else{
zBuf = sqlite3_mprintf("%.*f",n,r);
Expand Down

0 comments on commit c617351

Please sign in to comment.