[Build] Fix latest MSVC and CLang compiler errors (#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
This commit is contained in:
Harsha Raghu 2021-10-08 05:41:49 +05:30 committed by GitHub
parent cac80584a0
commit c61735130d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 35 additions and 5 deletions

View File

@ -231,6 +231,8 @@ class AMXXConfig(object):
cxx.cflags += ['-Wno-address-of-packed-member'] cxx.cflags += ['-Wno-address-of-packed-member']
if have_clang: if have_clang:
cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch'] cxx.cxxflags += ['-Wno-implicit-exception-spec-mismatch']
if cxx.version >= '10.0':
cxx.cxxflags += ['-Wno-tautological-compare']
if cxx.version >= 'apple-clang-10.0': if cxx.version >= 'apple-clang-10.0':
cxx.cxxflags += [ cxx.cxxflags += [
'-Wno-inconsistent-missing-override', '-Wno-inconsistent-missing-override',

View File

@ -1434,7 +1434,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
pPlayer->vgui = false; pPlayer->vgui = false;
if (time == -1) if (time == -1)
pPlayer->menuexpire = INFINITE; pPlayer->menuexpire = static_cast<float>(INFINITE);
else else
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time); pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);
@ -1452,7 +1452,7 @@ static cell AMX_NATIVE_CALL show_menu(AMX *amx, cell *params) /* 3 param */
pPlayer->vgui = false; pPlayer->vgui = false;
if (time == -1) if (time == -1)
pPlayer->menuexpire = INFINITE; pPlayer->menuexpire = static_cast<float>(INFINITE);
else else
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time); pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);

View File

@ -930,7 +930,7 @@ static cell AMX_NATIVE_CALL menu_display(AMX *amx, cell *params)
time = params[4]; time = params[4];
if (time < 0) if (time < 0)
pPlayer->menuexpire = INFINITE; pPlayer->menuexpire = static_cast<float>(INFINITE);
else else
pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time); pPlayer->menuexpire = gpGlobals->time + static_cast<float>(time);

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'csx') binary = AMXX.MetaModule(builder, 'csx')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../../public/sdk/amxxmodule.cpp', '../../../public/sdk/amxxmodule.cpp',
'CRank.cpp', 'CRank.cpp',

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'dodfun') binary = AMXX.MetaModule(builder, 'dodfun')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../../public/sdk/amxxmodule.cpp', '../../../public/sdk/amxxmodule.cpp',
'NBase.cpp', 'NBase.cpp',

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'dodx') binary = AMXX.MetaModule(builder, 'dodx')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../../public/sdk/amxxmodule.cpp', '../../../public/sdk/amxxmodule.cpp',
'CRank.cpp', 'CRank.cpp',

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'fun') binary = AMXX.MetaModule(builder, 'fun')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../public/sdk/amxxmodule.cpp', '../../public/sdk/amxxmodule.cpp',
'../../public/memtools/MemoryUtils.cpp', '../../public/memtools/MemoryUtils.cpp',

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'tfcx') binary = AMXX.MetaModule(builder, 'tfcx')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../public/sdk/amxxmodule.cpp', '../../public/sdk/amxxmodule.cpp',
'CRank.cpp', 'CRank.cpp',

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'tsfun') binary = AMXX.MetaModule(builder, 'tsfun')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../../public/sdk/amxxmodule.cpp', '../../../public/sdk/amxxmodule.cpp',
] ]

View File

@ -3,6 +3,10 @@ import os.path
binary = AMXX.MetaModule(builder, 'tsx') binary = AMXX.MetaModule(builder, 'tsx')
binary.compiler.defines += [
'HAVE_STDINT_H',
]
binary.sources = [ binary.sources = [
'../../../public/sdk/amxxmodule.cpp', '../../../public/sdk/amxxmodule.cpp',
'CMisc.cpp', 'CMisc.cpp',

View File

@ -110245,9 +110245,9 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
** handle the rounding directly, ** handle the rounding directly,
** otherwise use printf. ** 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)); 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)); r = -(double)((sqlite_int64)((-r)+0.5));
}else{ }else{
zBuf = sqlite3_mprintf("%.*f",n,r); zBuf = sqlite3_mprintf("%.*f",n,r);