mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Merge pull request #8483 from Robyt3/Building-Force-Signed-Char
Force default `char` to be `signed` on all architectures
This commit is contained in:
commit
eab49abce2
|
@ -291,11 +291,10 @@ if(NOT MSVC AND NOT HAIKU)
|
|||
add_cxx_compiler_flag_if_supported(OUR_FLAGS -ffloat-store)
|
||||
endif()
|
||||
|
||||
# This is needed to get the server to correctly display special characters
|
||||
# on ARM systems.
|
||||
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
|
||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS -fsigned-char)
|
||||
endif()
|
||||
# We assume that char is signed in various places in the code. In particular,
|
||||
# the Str.StrToInts test will fail when char is not signed and names containing
|
||||
# special characters will be displayed incorrectly on servers.
|
||||
add_cxx_compiler_flag_if_supported(OUR_FLAGS -fsigned-char)
|
||||
|
||||
# Don't insert timestamps into PEs to keep the build reproducible.
|
||||
if(TARGET_OS STREQUAL "windows")
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#include <base/system.h>
|
||||
#include <engine/shared/config.h>
|
||||
|
||||
#include <limits>
|
||||
|
||||
const char *CTuningParams::ms_apNames[] =
|
||||
{
|
||||
#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) #ScriptName,
|
||||
|
@ -63,6 +65,8 @@ float CTuningParams::GetWeaponFireDelay(int Weapon) const
|
|||
}
|
||||
}
|
||||
|
||||
static_assert(std::numeric_limits<char>::is_signed, "char must be signed for StrToInts to work correctly");
|
||||
|
||||
void StrToInts(int *pInts, size_t NumInts, const char *pStr)
|
||||
{
|
||||
dbg_assert(NumInts > 0, "StrToInts: NumInts invalid");
|
||||
|
|
Loading…
Reference in a new issue