From 045cc8f75b5679fa148a77801a5a9a59e3f2bc0a Mon Sep 17 00:00:00 2001 From: Eleni Maria Stea Date: Wed, 21 Mar 2018 11:15:56 +0200 Subject: [PATCH] Fixes compile errors generated with -Wpedantic This patch fixes the compile errors generated when the options SPIRV_WARN_EVERYTHING and SPIRV_WERROR (that force -Wpedantic) are set to cmake. --- source/cfa.h | 2 +- source/opt/block_merge_pass.cpp | 2 +- source/opt/build_module.cpp | 4 ++-- source/opt/common_uniform_elim_pass.cpp | 2 +- source/opt/dead_branch_elim_pass.cpp | 2 +- source/opt/dead_insert_elim_pass.cpp | 2 +- source/opt/folding_rules.cpp | 2 +- source/opt/inline_exhaustive_pass.cpp | 4 +--- source/opt/inline_opaque_pass.cpp | 2 +- source/opt/inline_pass.cpp | 2 +- source/opt/insert_extract_elim.cpp | 2 +- source/opt/local_access_chain_convert_pass.cpp | 2 +- source/opt/local_single_block_elim_pass.cpp | 2 +- source/opt/local_single_store_elim_pass.cpp | 2 +- source/opt/local_ssa_elim_pass.cpp | 2 +- source/opt/module.cpp | 8 ++++---- source/opt/set_spec_constant_default_value_pass.cpp | 2 +- source/opt/types.h | 2 +- source/val/function.cpp | 2 +- tools/val/val.cpp | 2 +- 20 files changed, 24 insertions(+), 26 deletions(-) diff --git a/source/cfa.h b/source/cfa.h index 56f8f118e..1022e3f2d 100644 --- a/source/cfa.h +++ b/source/cfa.h @@ -331,7 +331,7 @@ void CFA::ComputeAugmentedCFG( augmented_succ.push_back(pseudo_exit_block); augmented_succ.insert(augmented_succ.end(), succ->begin(), succ->end()); } -}; +} } // namespace spvtools diff --git a/source/opt/block_merge_pass.cpp b/source/opt/block_merge_pass.cpp index 937916ff1..fb370d690 100644 --- a/source/opt/block_merge_pass.cpp +++ b/source/opt/block_merge_pass.cpp @@ -137,7 +137,7 @@ bool BlockMergePass::IsMerge(ir::BasicBlock* block) { return IsMerge(block->id()); } -void BlockMergePass::Initialize(ir::IRContext* c) { InitializeProcessing(c); }; +void BlockMergePass::Initialize(ir::IRContext* c) { InitializeProcessing(c); } Pass::Status BlockMergePass::ProcessImpl() { // Process all entry point functions. diff --git a/source/opt/build_module.cpp b/source/opt/build_module.cpp index f55876798..c441fcccd 100644 --- a/source/opt/build_module.cpp +++ b/source/opt/build_module.cpp @@ -31,7 +31,7 @@ spv_result_t SetSpvHeader(void* builder, spv_endianness_t, uint32_t magic, reinterpret_cast(builder)->SetModuleHeader( magic, version, generator, id_bound, reserved); return SPV_SUCCESS; -}; +} // Processes a parsed instruction for IrLoader. Meets the interface requirement // of spvBinaryParse(). @@ -40,7 +40,7 @@ spv_result_t SetSpvInst(void* builder, const spv_parsed_instruction_t* inst) { return SPV_SUCCESS; } return SPV_ERROR_INVALID_BINARY; -}; +} } // namespace diff --git a/source/opt/common_uniform_elim_pass.cpp b/source/opt/common_uniform_elim_pass.cpp index 3dc6d7a8b..d4f41c827 100644 --- a/source/opt/common_uniform_elim_pass.cpp +++ b/source/opt/common_uniform_elim_pass.cpp @@ -488,7 +488,7 @@ void CommonUniformElimPass::Initialize(ir::IRContext* c) { // Initialize extension whitelist InitExtensions(); -}; +} bool CommonUniformElimPass::AllExtensionsSupported() const { // If any extension not in whitelist, return false diff --git a/source/opt/dead_branch_elim_pass.cpp b/source/opt/dead_branch_elim_pass.cpp index 7f5159907..5dfe42e61 100644 --- a/source/opt/dead_branch_elim_pass.cpp +++ b/source/opt/dead_branch_elim_pass.cpp @@ -367,7 +367,7 @@ bool DeadBranchElimPass::EliminateDeadBranches(ir::Function* func) { void DeadBranchElimPass::Initialize(ir::IRContext* c) { InitializeProcessing(c); -}; +} Pass::Status DeadBranchElimPass::ProcessImpl() { // Do not process if module contains OpGroupDecorate. Additional diff --git a/source/opt/dead_insert_elim_pass.cpp b/source/opt/dead_insert_elim_pass.cpp index 705162861..55f4efe7b 100644 --- a/source/opt/dead_insert_elim_pass.cpp +++ b/source/opt/dead_insert_elim_pass.cpp @@ -257,7 +257,7 @@ bool DeadInsertElimPass::EliminateDeadInsertsOnePass(ir::Function* func) { void DeadInsertElimPass::Initialize(ir::IRContext* c) { InitializeProcessing(c); -}; +} Pass::Status DeadInsertElimPass::ProcessImpl() { // Process all entry point functions. diff --git a/source/opt/folding_rules.cpp b/source/opt/folding_rules.cpp index a0fca0fc2..8e6fba115 100644 --- a/source/opt/folding_rules.cpp +++ b/source/opt/folding_rules.cpp @@ -234,7 +234,7 @@ FoldingRule ReciprocalFDiv() { return false; }; -}; +} // Elides consecutive negate instructions. FoldingRule MergeNegateArithmetic() { diff --git a/source/opt/inline_exhaustive_pass.cpp b/source/opt/inline_exhaustive_pass.cpp index 77d7bd88a..a5bc9f358 100644 --- a/source/opt/inline_exhaustive_pass.cpp +++ b/source/opt/inline_exhaustive_pass.cpp @@ -59,9 +59,7 @@ bool InlineExhaustivePass::InlineExhaustive(ir::Function* func) { return modified; } -void InlineExhaustivePass::Initialize(ir::IRContext* c) { - InitializeInline(c); -}; +void InlineExhaustivePass::Initialize(ir::IRContext* c) { InitializeInline(c); } Pass::Status InlineExhaustivePass::ProcessImpl() { // Attempt exhaustive inlining on each entry point function in module diff --git a/source/opt/inline_opaque_pass.cpp b/source/opt/inline_opaque_pass.cpp index e3f9f2160..13880502e 100644 --- a/source/opt/inline_opaque_pass.cpp +++ b/source/opt/inline_opaque_pass.cpp @@ -92,7 +92,7 @@ bool InlineOpaquePass::InlineOpaque(ir::Function* func) { return modified; } -void InlineOpaquePass::Initialize(ir::IRContext* c) { InitializeInline(c); }; +void InlineOpaquePass::Initialize(ir::IRContext* c) { InitializeInline(c); } Pass::Status InlineOpaquePass::ProcessImpl() { // Do opaque inlining on each function in entry point call tree diff --git a/source/opt/inline_pass.cpp b/source/opt/inline_pass.cpp index d858fd258..61c734329 100644 --- a/source/opt/inline_pass.cpp +++ b/source/opt/inline_pass.cpp @@ -668,7 +668,7 @@ void InlinePass::InitializeInline(ir::IRContext* c) { // Compute inlinability if (IsInlinableFunction(&fn)) inlinable_.insert(fn.result_id()); } -}; +} InlinePass::InlinePass() {} diff --git a/source/opt/insert_extract_elim.cpp b/source/opt/insert_extract_elim.cpp index 1e70bb87c..2d0d8a24b 100644 --- a/source/opt/insert_extract_elim.cpp +++ b/source/opt/insert_extract_elim.cpp @@ -199,7 +199,7 @@ bool InsertExtractElimPass::EliminateInsertExtract(ir::Function* func) { void InsertExtractElimPass::Initialize(ir::IRContext* c) { InitializeProcessing(c); -}; +} Pass::Status InsertExtractElimPass::ProcessImpl() { // Process all entry point functions. diff --git a/source/opt/local_access_chain_convert_pass.cpp b/source/opt/local_access_chain_convert_pass.cpp index 8426e6e77..39ddc73a9 100644 --- a/source/opt/local_access_chain_convert_pass.cpp +++ b/source/opt/local_access_chain_convert_pass.cpp @@ -256,7 +256,7 @@ void LocalAccessChainConvertPass::Initialize(ir::IRContext* c) { // Initialize extension whitelist InitExtensions(); -}; +} bool LocalAccessChainConvertPass::AllExtensionsSupported() const { // If any extension not in whitelist, return false diff --git a/source/opt/local_single_block_elim_pass.cpp b/source/opt/local_single_block_elim_pass.cpp index 25b0ea296..2e9ab36b1 100644 --- a/source/opt/local_single_block_elim_pass.cpp +++ b/source/opt/local_single_block_elim_pass.cpp @@ -138,7 +138,7 @@ void LocalSingleBlockLoadStoreElimPass::Initialize(ir::IRContext* c) { // Initialize extensions whitelist InitExtensions(); -}; +} bool LocalSingleBlockLoadStoreElimPass::AllExtensionsSupported() const { // If any extension not in whitelist, return false diff --git a/source/opt/local_single_store_elim_pass.cpp b/source/opt/local_single_store_elim_pass.cpp index 4bc4c4707..8f4f0928d 100644 --- a/source/opt/local_single_store_elim_pass.cpp +++ b/source/opt/local_single_store_elim_pass.cpp @@ -242,7 +242,7 @@ void LocalSingleStoreElimPass::Initialize(ir::IRContext* irContext) { // Initialize extension whitelist InitExtensions(); -}; +} bool LocalSingleStoreElimPass::AllExtensionsSupported() const { // If any extension not in whitelist, return false diff --git a/source/opt/local_ssa_elim_pass.cpp b/source/opt/local_ssa_elim_pass.cpp index 8d3f4f601..efc270e4a 100644 --- a/source/opt/local_ssa_elim_pass.cpp +++ b/source/opt/local_ssa_elim_pass.cpp @@ -28,7 +28,7 @@ void LocalMultiStoreElimPass::Initialize(ir::IRContext* c) { // Initialize extension whitelist InitExtensions(); -}; +} bool LocalMultiStoreElimPass::AllExtensionsSupported() const { // If any extension not in whitelist, return false diff --git a/source/opt/module.cpp b/source/opt/module.cpp index fea49ef31..1e87c2c04 100644 --- a/source/opt/module.cpp +++ b/source/opt/module.cpp @@ -30,7 +30,7 @@ std::vector Module::GetTypes() { if (IsTypeInst(inst.opcode())) type_insts.push_back(&inst); } return type_insts; -}; +} std::vector Module::GetTypes() const { std::vector type_insts; @@ -38,7 +38,7 @@ std::vector Module::GetTypes() const { if (IsTypeInst(inst.opcode())) type_insts.push_back(&inst); } return type_insts; -}; +} std::vector Module::GetConstants() { std::vector const_insts; @@ -46,7 +46,7 @@ std::vector Module::GetConstants() { if (IsConstantInst(inst.opcode())) const_insts.push_back(&inst); } return const_insts; -}; +} std::vector Module::GetConstants() const { std::vector const_insts; @@ -54,7 +54,7 @@ std::vector Module::GetConstants() const { if (IsConstantInst(inst.opcode())) const_insts.push_back(&inst); } return const_insts; -}; +} uint32_t Module::GetGlobalValue(SpvOp opcode) const { for (auto& inst : types_values_) { diff --git a/source/opt/set_spec_constant_default_value_pass.cpp b/source/opt/set_spec_constant_default_value_pass.cpp index 3c6626016..bce78f9c6 100644 --- a/source/opt/set_spec_constant_default_value_pass.cpp +++ b/source/opt/set_spec_constant_default_value_pass.cpp @@ -188,7 +188,7 @@ ir::Instruction* GetSpecIdTargetFromDecorationGroup( } return target_inst; } -}; // namespace +} // namespace Pass::Status SetSpecConstantDefaultValuePass::Process( ir::IRContext* irContext) { diff --git a/source/opt/types.h b/source/opt/types.h index 34ee3ac0f..13ef78b40 100644 --- a/source/opt/types.h +++ b/source/opt/types.h @@ -516,7 +516,7 @@ class ForwardPointer : public Type { const type* As##type() const override { return this; } \ \ void GetExtraHashWords(std::vector*) const override {} \ - }; // namespace analysis + } DefineParameterlessType(Void, void); DefineParameterlessType(Bool, bool); DefineParameterlessType(Sampler, sampler); diff --git a/source/val/function.cpp b/source/val/function.cpp index 3a5c8e281..7f49ad0c2 100644 --- a/source/val/function.cpp +++ b/source/val/function.cpp @@ -279,7 +279,7 @@ void Function::ComputeAugmentedCFG() { ordered_blocks_, &pseudo_entry_block_, &pseudo_exit_block_, &augmented_successors_map_, &augmented_predecessors_map_, succ_func, pred_func); -}; +} Construct& Function::AddConstruct(const Construct& new_construct) { cfg_constructs_.push_back(new_construct); diff --git a/tools/val/val.cpp b/tools/val/val.cpp index fc1fb53a6..be10aaf27 100644 --- a/tools/val/val.cpp +++ b/tools/val/val.cpp @@ -71,7 +71,7 @@ int main(int argc, char** argv) { spv_validator_limit limit_type; if (spvParseUniversalLimitsOptions(cur_arg, &limit_type)) { uint32_t limit = 0; - if (sscanf(argv[++argi], "%d", &limit)) { + if (sscanf(argv[++argi], "%u", &limit)) { options.SetUniversalLimit(limit_type, limit); } else { fprintf(stderr, "error: missing argument to %s\n", cur_arg);