mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-21 20:11:34 +00:00
Merge branch 'fix_warnings' into 'master'
Fix warnings See merge request OpenMW/openmw!4651
This commit is contained in:
commit
36e34426bb
5 changed files with 18 additions and 4 deletions
|
@ -56,6 +56,7 @@ Ubuntu_GCC_preprocess:
|
||||||
stage: build
|
stage: build
|
||||||
variables:
|
variables:
|
||||||
CMAKE_EXE_LINKER_FLAGS: -fuse-ld=mold
|
CMAKE_EXE_LINKER_FLAGS: -fuse-ld=mold
|
||||||
|
OPENMW_CXX_FLAGS: "-Werror -Werror=implicit-fallthrough"
|
||||||
script:
|
script:
|
||||||
- df -h
|
- df -h
|
||||||
- export CCACHE_BASEDIR="`pwd`"
|
- 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_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
|
CMAKE_EXE_LINKER_FLAGS: -fsanitize=address -fsanitize=pointer-subtract -fsanitize=leak -fuse-ld=mold
|
||||||
BUILD_OPENMW_ONLY: 1
|
BUILD_OPENMW_ONLY: 1
|
||||||
|
# Disable -Werror due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105562
|
||||||
|
OPENMW_CXX_FLAGS: ""
|
||||||
|
|
||||||
Clang_Format:
|
Clang_Format:
|
||||||
extends: .Ubuntu_Image
|
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_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
|
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
|
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:
|
artifacts:
|
||||||
paths: []
|
paths: []
|
||||||
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
|
name: ${CI_JOB_NAME}-${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
|
||||||
|
|
|
@ -17,7 +17,7 @@ declare -a CMAKE_CONF_OPTS=(
|
||||||
-DBUILD_SHARED_LIBS="${BUILD_SHARED_LIBS:-OFF}"
|
-DBUILD_SHARED_LIBS="${BUILD_SHARED_LIBS:-OFF}"
|
||||||
-DUSE_SYSTEM_TINYXML=ON
|
-DUSE_SYSTEM_TINYXML=ON
|
||||||
-DOPENMW_USE_SYSTEM_RECASTNAVIGATION=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
|
if [[ "${CMAKE_EXE_LINKER_FLAGS}" ]]; then
|
||||||
|
|
|
@ -594,6 +594,11 @@ endif()
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
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}")
|
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)
|
if (APPLE)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
|
||||||
|
|
|
@ -74,19 +74,20 @@ namespace
|
||||||
|
|
||||||
TEST(EsmFixedString, empty_strings)
|
TEST(EsmFixedString, empty_strings)
|
||||||
{
|
{
|
||||||
|
constexpr std::string_view someStr = "some string";
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("4 bytes");
|
SCOPED_TRACE("4 bytes");
|
||||||
ESM::NAME empty = ESM::NAME();
|
ESM::NAME empty = ESM::NAME();
|
||||||
EXPECT_TRUE(empty == "");
|
EXPECT_TRUE(empty == "");
|
||||||
EXPECT_TRUE(empty == static_cast<uint32_t>(0));
|
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));
|
EXPECT_TRUE(empty != static_cast<uint32_t>(42));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
SCOPED_TRACE("32 bytes");
|
SCOPED_TRACE("32 bytes");
|
||||||
ESM::NAME32 empty = ESM::NAME32();
|
ESM::NAME32 empty = ESM::NAME32();
|
||||||
EXPECT_TRUE(empty == "");
|
EXPECT_TRUE(empty == "");
|
||||||
EXPECT_TRUE(empty != "some string");
|
EXPECT_TRUE(empty != someStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,10 @@ namespace ESM
|
||||||
|
|
||||||
static RefId esm3ExteriorCell(int32_t x, int32_t y) { return RefId(ESM3ExteriorCellRefId(x, y)); }
|
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
|
constexpr RefId(EmptyRefId value) noexcept
|
||||||
: mValue(value)
|
: mValue(value)
|
||||||
|
|
Loading…
Reference in a new issue