1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-21 22:41:35 +00:00

Merge branch 'fix_warnings' into 'master'

Fix warnings

See merge request OpenMW/openmw!4651
This commit is contained in:
Evil Eye 2025-04-30 18:43:14 +00:00
commit 36e34426bb
5 changed files with 18 additions and 4 deletions

View file

@ -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}

View file

@ -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

View file

@ -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++")

View file

@ -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<uint32_t>(0));
EXPECT_TRUE(empty != "some string");
EXPECT_TRUE(empty != someStr);
EXPECT_TRUE(empty != static_cast<uint32_t>(42));
}
{
SCOPED_TRACE("32 bytes");
ESM::NAME32 empty = ESM::NAME32();
EXPECT_TRUE(empty == "");
EXPECT_TRUE(empty != "some string");
EXPECT_TRUE(empty != someStr);
}
}

View file

@ -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)