1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-19 17:41:33 +00:00

Merge branch 'fix_warnings' into 'master'

Fix -Wreturn-local-addr warning

See merge request OpenMW/openmw!1194
This commit is contained in:
Petr Mikheev 2021-09-05 10:00:57 +00:00
commit c4dca196b9
5 changed files with 18 additions and 5 deletions

View file

@ -14,6 +14,12 @@ if [[ "${BUILD_TESTS_ONLY}" ]]; then
BUILD_BENCHMARKS=ON BUILD_BENCHMARKS=ON
fi fi
CXX_FLAGS='-Werror -Wno-error=deprecated-declarations -Wno-error=nonnull -Wno-error=deprecated-copy'
if [[ "${CXX}" == 'clang++' ]]; then
CXX_FLAGS="${CXX_FLAGS} -Wno-error=unused-lambda-capture -Wno-error=gnu-zero-variadic-macro-arguments"
fi
declare -a CMAKE_CONF_OPTS=( declare -a CMAKE_CONF_OPTS=(
-DCMAKE_C_COMPILER="${CC:-/usr/bin/cc}" -DCMAKE_C_COMPILER="${CC:-/usr/bin/cc}"
-DCMAKE_CXX_COMPILER="${CXX:-/usr/bin/c++}" -DCMAKE_CXX_COMPILER="${CXX:-/usr/bin/c++}"
@ -24,6 +30,8 @@ declare -a CMAKE_CONF_OPTS=(
-DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_LIBS=OFF
-DUSE_SYSTEM_TINYXML=ON -DUSE_SYSTEM_TINYXML=ON
-DCMAKE_INSTALL_PREFIX=install -DCMAKE_INSTALL_PREFIX=install
-DCMAKE_C_FLAGS='-Werror'
-DCMAKE_CXX_FLAGS="${CXX_FLAGS}"
) )
if [[ $CI_OPENMW_USE_STATIC_DEPS ]]; then if [[ $CI_OPENMW_USE_STATIC_DEPS ]]; then

View file

@ -512,7 +512,7 @@ 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(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wundef -Wno-unused-parameter -pedantic -Wno-long-long") set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wundef -Wno-unused-parameter -pedantic -Wno-long-long ${CMAKE_CXX_FLAGS}")
add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON ) add_definitions( -DBOOST_NO_CXX11_SCOPED_ENUMS=ON )
if (APPLE) if (APPLE)

View file

@ -9,6 +9,9 @@
#include "data.hpp" #include "data.hpp"
#include <string>
#include <string_view>
namespace CSMWorld namespace CSMWorld
{ {
const std::string& ActorAdapter::RaceData::getId() const const std::string& ActorAdapter::RaceData::getId() const
@ -121,7 +124,7 @@ namespace CSMWorld
return SceneUtil::getActorSkeleton(firstPerson, mFemale, beast, werewolf); return SceneUtil::getActorSkeleton(firstPerson, mFemale, beast, werewolf);
} }
const std::string& ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const std::string_view ActorAdapter::ActorData::getPart(ESM::PartReferenceType index) const
{ {
auto it = mParts.find(index); auto it = mParts.find(index);
if (it == mParts.end()) if (it == mParts.end())
@ -139,7 +142,7 @@ namespace CSMWorld
return mRaceData->getMalePart(index); return mRaceData->getMalePart(index);
} }
return ""; return {};
} }
const std::string& partName = it->second.first; const std::string& partName = it->second.first;

View file

@ -4,6 +4,8 @@
#include <array> #include <array>
#include <map> #include <map>
#include <unordered_set> #include <unordered_set>
#include <string>
#include <string_view>
#include <QObject> #include <QObject>
#include <QModelIndex> #include <QModelIndex>
@ -93,7 +95,7 @@ namespace CSMWorld
/// Returns the skeleton the actor should use for attaching parts to /// Returns the skeleton the actor should use for attaching parts to
std::string getSkeleton() const; std::string getSkeleton() const;
/// Retrieves the associated actor part /// Retrieves the associated actor part
const std::string& getPart(ESM::PartReferenceType index) const; std::string_view getPart(ESM::PartReferenceType index) const;
/// Checks if the actor has a data dependency /// Checks if the actor has a data dependency
bool hasDependency(const std::string& id) const; bool hasDependency(const std::string& id) const;

View file

@ -96,7 +96,7 @@ namespace CSVRender
for (int i = 0; i < ESM::PRT_Count; ++i) for (int i = 0; i < ESM::PRT_Count; ++i)
{ {
auto type = (ESM::PartReferenceType) i; auto type = (ESM::PartReferenceType) i;
std::string partId = mActorData->getPart(type); const std::string partId(mActorData->getPart(type));
attachBodyPart(type, getBodyPartMesh(partId)); attachBodyPart(type, getBodyPartMesh(partId));
} }
} }