Fix warnings on various GCC versions

* Primarily this change fixes -Wdeprecated-copy on GCC-9, but it also tidies
  warnings on other versions.
This commit is contained in:
baldurk
2019-06-27 11:47:45 +01:00
parent 9b70400eff
commit 0dcedbbbcf
8 changed files with 42 additions and 50 deletions
+5
View File
@@ -307,6 +307,11 @@ elseif(UNIX)
os/posix/posix_specific.h)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(3rdparty/tinyfiledialogs/tinyfiledialogs.c
PROPERTIES COMPILE_FLAGS "-Wno-format-overflow")
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR APPLE)
set_source_files_properties(3rdparty/tinyexr/tinyexr.cpp
PROPERTIES COMPILE_FLAGS "-Wno-extra -Wno-unused-function")
+1
View File
@@ -32,6 +32,7 @@ private:
public:
inline BitFlagIterator() : flags(0) {}
inline BitFlagIterator(FlagType mask) : flags(mask) {}
inline BitFlagIterator(const BitFlagIterator &o) : flags(o.flags) {}
static inline BitFlagIterator begin(FlagType mask) { return BitFlagIterator(mask); }
static inline BitFlagIterator end() { return BitFlagIterator(0); }
inline BitType operator*() const { return (BitType)(flags & (FlagType)(-(SignedType)flags)); }
@@ -101,6 +101,7 @@ void IntelGlCounters::addCounter(const IntelGlQuery &query, GLuint counterId)
uint32_t desc_hash = strhash(counter.desc.description.c_str());
counter.desc.uuid = Uuid(0x8086, query_hash, name_hash, desc_hash);
counter.desc.resultType = glToRdcCounterType(counter.dataType);
counter.desc.unit = CounterUnit::Absolute;
m_Counters.push_back(counter);
m_CounterNames[counter.desc.name] = counter;
+6 -33
View File
@@ -73,47 +73,20 @@ private:
struct IntelGlCounter
{
IntelGlCounter()
{
desc = CounterDescription();
queryId = offset = type = dataType = 0;
}
IntelGlCounter(const IntelGlCounter &other)
{
desc = other.desc;
queryId = other.queryId;
offset = other.offset;
type = other.type;
dataType = other.dataType;
}
CounterDescription desc;
GLuint queryId;
GLuint offset;
GLuint type;
GLuint dataType;
GLuint queryId = 0;
GLuint offset = 0;
GLuint type = 0;
GLuint dataType = 0;
};
std::vector<IntelGlCounter> m_Counters;
std::map<std::string, IntelGlCounter> m_CounterNames;
struct IntelGlQuery
{
IntelGlQuery()
{
queryId = 0;
name = "";
size = 0;
}
IntelGlQuery(const IntelGlQuery &other)
{
queryId = other.queryId;
name = other.name;
size = other.size;
}
GLuint queryId;
GLuint queryId = 0;
std::string name;
GLuint size;
GLuint size = 0;
};
std::map<GLuint, IntelGlQuery> m_Queries;
+19 -8
View File
@@ -104,22 +104,33 @@ set(sources
add_definitions(-DAMD_EXTENSIONS)
add_definitions(-DNV_EXTENSIONS)
set_source_files_properties(${glslang_sources}
PROPERTIES COMPILE_FLAGS "-Wno-ignored-qualifiers -Wno-strict-aliasing")
set_property(SOURCE ${glslang_sources}
PROPERTY COMPILE_FLAGS "-Wno-ignored-qualifiers -Wno-strict-aliasing")
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.0)
set_source_files_properties(
# GCC 7.0 and above needs -Wno-implicit-fallthrough on these files
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9)
set_property(SOURCE
${glslang_dir}/glslang/MachineIndependent/reflection.cpp
${glslang_dir}/glslang/MachineIndependent/Intermediate.cpp
PROPERTIES COMPILE_FLAGS "-Wno-implicit-fallthrough -Wno-ignored-qualifiers")
APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-implicit-fallthrough")
endif()
# GCC 9.0 and above needs -Wno-deprecated-copy on glslang files, but also on
# spirv_compile.cpp since one of the issues is in the non-public header that
# is used from GlslangToSpv.h
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.9)
set_property(SOURCE
${glslang_sources}
spirv_compile.cpp
APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-deprecated-copy")
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_property(SOURCE "${glslang_sources}"
APPEND PROPERTY COMPILE_FLAGS "-Wno-unknown-warning-option -Wno-inconsistent-missing-override")
APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unknown-warning-option -Wno-inconsistent-missing-override")
set_source_files_properties(${glslang_dir}/SPIRV/GlslangToSpv.cpp
PROPERTIES COMPILE_FLAGS "-Wno-tautological-constant-out-of-range-compare")
set_property(SOURCE ${glslang_dir}/SPIRV/GlslangToSpv.cpp
APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-tautological-constant-out-of-range-compare")
endif()
add_library(rdoc_spirv OBJECT ${sources})
-2
View File
@@ -3056,8 +3056,6 @@ void WrappedVulkan::ReplayLog(uint32_t startEventID, uint32_t endEventID, Replay
// it back again afterwards.
std::vector<VkImageMemoryBarrier> loadRPImgBarriers;
m_RenderState.rpBarriers.clear();
// we'll need our own command buffer if we're replaying just a subsection
// of events within a single command buffer record - always if it's only
// one drawcall, or if start event ID is > 0 we assume the outside code
+9 -5
View File
@@ -67,21 +67,25 @@ VulkanRenderState &VulkanRenderState::operator=(const VulkanRenderState &o)
maxdepth = o.maxdepth;
front = o.front;
back = o.back;
sampleLocations = o.sampleLocations;
discardRectangles = o.discardRectangles;
memcpy(pushconsts, o.pushconsts, sizeof(pushconsts));
pushConstSize = o.pushConstSize;
renderPass = o.renderPass;
subpass = o.subpass;
framebuffer = o.framebuffer;
renderArea = o.renderArea;
compute.pipeline = o.compute.pipeline;
compute.descSets = o.compute.descSets;
graphics.pipeline = o.graphics.pipeline;
graphics.descSets = o.graphics.descSets;
compute = o.compute;
graphics = o.graphics;
ibuffer = o.ibuffer;
vbuffers = o.vbuffers;
xfbbuffers = o.xfbbuffers;
firstxfbcounter = o.firstxfbcounter;
xfbcounters = o.xfbcounters;
conditionalRendering = o.conditionalRendering;
return *this;
+1 -2
View File
@@ -54,6 +54,7 @@ struct VulkanRenderState
};
VulkanRenderState(WrappedVulkan *driver, VulkanCreationInfo *createInfo);
VulkanRenderState(const VulkanRenderState &o) { *this = o; }
VulkanRenderState &operator=(const VulkanRenderState &o);
void BeginRenderPassAndApplyState(VkCommandBuffer cmd, PipelineBinding binding);
void EndRenderPass(VkCommandBuffer cmd);
@@ -148,6 +149,4 @@ struct VulkanRenderState
VulkanResourceManager *GetResourceManager();
VulkanCreationInfo *m_CreationInfo;
WrappedVulkan *m_pDriver;
std::vector<VkImageMemoryBarrier> rpBarriers;
};