From 47d85b81a7f3a0ec109b2af1077b93dcf473f87d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 14 Mar 2019 17:34:28 -0400 Subject: [PATCH] CMakeLists: Apply compilation flags to the sirit target Previously this wasn't utilizing any of the compiler flags, meaning it wasn't applying any of the specified warnings. Since applying the warnings to the target, this uncovered a few warning cases, such as shadowing class variables on MSVC, etc, which have been fixed. --- include/sirit/sirit.h | 2 +- src/CMakeLists.txt | 3 +++ src/op.cpp | 4 ++-- src/op.h | 2 +- src/operand.cpp | 4 ++-- src/sirit.cpp | 6 +++--- 6 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/sirit/sirit.h b/include/sirit/sirit.h index 0a1af97..eee5cff 100644 --- a/include/sirit/sirit.h +++ b/include/sirit/sirit.h @@ -46,7 +46,7 @@ public: void AddCapability(spv::Capability capability); /// Sets module memory model. - void SetMemoryModel(spv::AddressingModel addressing_model, spv::MemoryModel memory_model); + void SetMemoryModel(spv::AddressingModel addressing_model_, spv::MemoryModel memory_model_); /// Adds an entry point. void AddEntryPoint(spv::ExecutionModel execution_model, Id entry_point, std::string name, diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7a37aa2..53a409e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,6 +27,9 @@ add_library(sirit instructions/extension.cpp instructions/image.cpp ) + +target_compile_options(sirit PRIVATE ${SIRIT_CXX_FLAGS}) + target_include_directories(sirit PUBLIC ../include PRIVATE . ${SPIRV-Headers_SOURCE_DIR}/include diff --git a/src/op.cpp b/src/op.cpp index df6cd10..097a67d 100644 --- a/src/op.cpp +++ b/src/op.cpp @@ -67,8 +67,8 @@ void Op::Sink(Operand* operand) { operand_store.push_back(std::unique_ptr(operand)); } -void Op::Sink(const std::vector& operands) { - for (auto* operand : operands) { +void Op::Sink(const std::vector& operands_) { + for (auto* operand : operands_) { Sink(operand); } } diff --git a/src/op.h b/src/op.h index 9fec365..4b63d66 100644 --- a/src/op.h +++ b/src/op.h @@ -28,7 +28,7 @@ public: void Sink(Operand* operand); - void Sink(const std::vector& operands); + void Sink(const std::vector& operands_); void Add(const Literal& literal); diff --git a/src/operand.cpp b/src/operand.cpp index 821b533..954a45d 100644 --- a/src/operand.cpp +++ b/src/operand.cpp @@ -13,7 +13,7 @@ Operand::Operand() = default; Operand::~Operand() = default; -void Operand::Fetch(Stream& stream) const { +void Operand::Fetch([[maybe_unused]] Stream& stream) const { assert(!"Fetching unimplemented operand"); } @@ -22,7 +22,7 @@ u16 Operand::GetWordCount() const { return 0; } -bool Operand::operator==(const Operand& other) const { +bool Operand::operator==([[maybe_unused]] const Operand& other) const { return false; } diff --git a/src/sirit.cpp b/src/sirit.cpp index 390d771..dcdfe23 100644 --- a/src/sirit.cpp +++ b/src/sirit.cpp @@ -74,9 +74,9 @@ void Module::AddCapability(spv::Capability capability) { capabilities.insert(capability); } -void Module::SetMemoryModel(spv::AddressingModel addressing_model, spv::MemoryModel memory_model) { - this->addressing_model = addressing_model; - this->memory_model = memory_model; +void Module::SetMemoryModel(spv::AddressingModel addressing_model_, spv::MemoryModel memory_model_) { + this->addressing_model = addressing_model_; + this->memory_model = memory_model_; } void Module::AddEntryPoint(spv::ExecutionModel execution_model, Id entry_point,