From b9ad418c955d77af6ef835742496ba40b93229c0 Mon Sep 17 00:00:00 2001 From: Umar Arshad Date: Thu, 10 Dec 2015 11:56:34 -0500 Subject: [PATCH] Fix warnings with Apple clang++ * Unused private member * Overflow error when subtracting num_fraction_bits for HF16 and HF --- include/util/hex_float.h | 9 +++++---- source/disassemble.cpp | 10 +++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/include/util/hex_float.h b/include/util/hex_float.h index 6f4b7c0..419d908 100644 --- a/include/util/hex_float.h +++ b/include/util/hex_float.h @@ -483,7 +483,7 @@ class HexFloat { // rounding rules. switch (dir) { case round_direction::kToZero: - break; + break; case round_direction::kToPositiveInfinity: round_away_from_zero = !isNegative(); break; @@ -493,7 +493,7 @@ class HexFloat { case round_direction::kToNearestEven: // Have to round down, round bit is 0 if ((first_rounded_bit & significand) == 0) { - break; + break; } if (((significand & throwaway_mask) & ~first_rounded_bit) != 0) { // If any subsequent bit of the rounded portion is non-0 then we round @@ -573,8 +573,9 @@ class HexFloat { if (is_nan) { typename other_T::uint_type shifted_significand; shifted_significand = static_cast( - negatable_left_shift::val(significand)); + negatable_left_shift(other_T::num_fraction_bits) - + static_cast( + num_fraction_bits)>::val(significand)); // We are some sort of Nan. We try to keep the bit-pattern of the Nan // as close as possible. If we had to shift off bits so we are 0, then we diff --git a/source/disassemble.cpp b/source/disassemble.cpp index 1a7c939..292caa0 100644 --- a/source/disassemble.cpp +++ b/source/disassemble.cpp @@ -48,10 +48,9 @@ namespace { // representation. class Disassembler { public: - Disassembler(const libspirv::AssemblyGrammar& grammar, uint32_t const* words, + Disassembler(const libspirv::AssemblyGrammar& grammar, uint32_t options) - : words_(words), - grammar_(grammar), + : grammar_(grammar), print_(spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_PRINT, options)), color_(print_ && spvIsInBitfield(SPV_BINARY_TO_TEXT_OPTION_COLOR, options)), @@ -113,9 +112,6 @@ class Disassembler { if (color_) out_.get() << libspirv::clr::green(); } - // The SPIR-V binary. The endianness is not necessarily converted - // to native endianness. - const uint32_t* const words_; const libspirv::AssemblyGrammar& grammar_; const bool print_; // Should we also print to the standard output stream? const bool color_; // Should we print in colour? @@ -394,7 +390,7 @@ spv_result_t spvBinaryToText(const spv_const_context context, const libspirv::AssemblyGrammar grammar(context); if (!grammar.isValid()) return SPV_ERROR_INVALID_TABLE; - Disassembler disassembler(grammar, code, options); + Disassembler disassembler(grammar, options); if (auto error = spvBinaryParse(context, &disassembler, code, wordCount, DisassembleHeader, DisassembleInstruction, pDiagnostic)) { -- 2.7.4