From 7f3a8675754bb0691e9234658c1d2d49ae77b8cb Mon Sep 17 00:00:00 2001 From: NepDisk Date: Fri, 24 Oct 2025 00:34:46 -0400 Subject: [PATCH] Add C23 and CXX23 Compile flag since this works now --- src/CMakeLists.txt | 17 ++++++++++++++--- src/doomtype.h | 3 ++- src/r_bsp.cpp | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb297a369..15c4d4f5b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -18,9 +18,20 @@ if(("${CMAKE_COMPILER_IS_GNUCC}" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND endif() endif() -target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17) -set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 11) -set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 17) +set(SRB2_CONFIG_STD23 OFF CACHE BOOL + "Compiles the game under c23 and cxx23 instead c11 and cxx17.") + +if(SRB2_CONFIG_STD23) + message("-- Compiling game with C23 and CXX23.") + target_compile_features(SRB2SDL2 PRIVATE c_std_23 cxx_std_23) + set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 23) + set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 23) +else() + message("-- Compiling game with C11 and CXX17.") + target_compile_features(SRB2SDL2 PRIVATE c_std_11 cxx_std_17) + set_property(TARGET SRB2SDL2 PROPERTY C_STANDARD 11) + set_property(TARGET SRB2SDL2 PROPERTY CXX_STANDARD 17) +endif() # Core sources target_sourcefile(c) diff --git a/src/doomtype.h b/src/doomtype.h index 6ffda2b23..da37bacbe 100644 --- a/src/doomtype.h +++ b/src/doomtype.h @@ -115,7 +115,8 @@ typedef int32_t boolean; #ifndef __cplusplus #ifndef _WIN32 -enum {false = 0, true = 1}; +#define false 0 +#define true 1 #else #define false FALSE #define true TRUE diff --git a/src/r_bsp.cpp b/src/r_bsp.cpp index efb34d870..b45d56119 100644 --- a/src/r_bsp.cpp +++ b/src/r_bsp.cpp @@ -1192,7 +1192,7 @@ static void R_Subsector(size_t num) polyobj_t *po = sub->polyList; sector_t *polysec; - auto poly_damage = [&](auto& f) { return polysec->flags & POF_SOLID ? f(polysec) : sector_damage(polysec); }; + auto poly_damage = [&](auto& f) { return polysec->flags & (sectorflags_t)POF_SOLID ? f(polysec) : sector_damage(polysec); }; auto poly_top_damage = [&] { return poly_damage(floor_damage); }; auto poly_bottom_damage = [&] { return poly_damage(ceiling_damage); };