diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7b6bb7d92e..d55e554905 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -56,6 +56,7 @@ Ubuntu_GCC_preprocess: stage: build variables: CMAKE_EXE_LINKER_FLAGS: -fuse-ld=mold + OPENMW_CXX_FLAGS: "-Werror -Werror=implicit-fallthrough" script: - df -h - export CCACHE_BASEDIR="`pwd`" @@ -156,6 +157,8 @@ Ubuntu_GCC_asan: CMAKE_CXX_FLAGS_DEBUG: -g -O1 -fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak CMAKE_EXE_LINKER_FLAGS: -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak -fuse-ld=mold BUILD_OPENMW_ONLY: 1 + # Disable -Werror due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562 + OPENMW_CXX_FLAGS: "" Clang_Format: extends: .Ubuntu_Image @@ -257,6 +260,8 @@ Ubuntu_GCC_tests_asan: CMAKE_CXX_FLAGS_DEBUG: -g -O1 -fno-omit-frame-pointer -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak CMAKE_EXE_LINKER_FLAGS: -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak -fuse-ld=mold ASAN_OPTIONS: halt_on_error=1:strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1 + # Disable -Werror due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562 + OPENMW_CXX_FLAGS: "" artifacts: paths: [] name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA} diff --git a/CI/before_script.linux.sh b/CI/before_script.linux.sh index c6fd306e25..c5704b900c 100755 --- a/CI/before_script.linux.sh +++ b/CI/before_script.linux.sh @@ -17,7 +17,7 @@ declare -a CMAKE_CONF_OPTS=( -DBUILD_SHARED_LIBS="${BUILD_SHARED_LIBS:-OFF}" -DUSE_SYSTEM_TINYXML=ON -DOPENMW_USE_SYSTEM_RECASTNAVIGATION=ON - -DOPENMW_CXX_FLAGS="-Werror -Werror=implicit-fallthrough" # flags specific to OpenMW project + -DOPENMW_CXX_FLAGS="${OPENMW_CXX_FLAGS}" # flags specific to OpenMW project ) if [[ "${CMAKE_EXE_LINKER_FLAGS}" ]]; then diff --git a/CMakeLists.txt b/CMakeLists.txt index 94b52e0156..bd66eb2c48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -594,6 +594,11 @@ endif() if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang) set(OPENMW_CXX_FLAGS "-Wall -Wextra -Wundef -Wextra-semi -Wno-unused-parameter -pedantic -Wno-long-long -Wnon-virtual-dtor -Wunused ${OPENMW_CXX_FLAGS}") + if (CMAKE_CXX_COMPILER_ID STREQUAL GNU) + # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105438 + set(OPENMW_CXX_FLAGS "-Wno-array-bounds ${OPENMW_CXX_FLAGS}") + endif() + if (APPLE) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++") diff --git a/apps/components_tests/esm/test_fixed_string.cpp b/apps/components_tests/esm/test_fixed_string.cpp index 76ed346daa..2241bb042f 100644 --- a/apps/components_tests/esm/test_fixed_string.cpp +++ b/apps/components_tests/esm/test_fixed_string.cpp @@ -74,19 +74,20 @@ namespace TEST(EsmFixedString, empty_strings) { + constexpr std::string_view someStr = "some string"; { SCOPED_TRACE("4 bytes"); ESM::NAME empty = ESM::NAME(); EXPECT_TRUE(empty == ""); EXPECT_TRUE(empty == static_cast(0)); - EXPECT_TRUE(empty != "some string"); + EXPECT_TRUE(empty != someStr); EXPECT_TRUE(empty != static_cast(42)); } { SCOPED_TRACE("32 bytes"); ESM::NAME32 empty = ESM::NAME32(); EXPECT_TRUE(empty == ""); - EXPECT_TRUE(empty != "some string"); + EXPECT_TRUE(empty != someStr); } } diff --git a/components/esm/refid.hpp b/components/esm/refid.hpp index 174652419a..919ff59223 100644 --- a/components/esm/refid.hpp +++ b/components/esm/refid.hpp @@ -70,7 +70,10 @@ namespace ESM static RefId esm3ExteriorCell(int32_t x, int32_t y) { return RefId(ESM3ExteriorCellRefId(x, y)); } - constexpr RefId() = default; + constexpr RefId() noexcept + : mValue(EmptyRefId{}) + { + } constexpr RefId(EmptyRefId value) noexcept : mValue(value)