set(CMAKE_BUILD_TYPE "Debug")
endif()
+option(SPIRV_WERROR "Enable error on warning" ON)
if(UNIX)
set(SPIRV_WARNINGS -Wall -Wextra -Wno-missing-field-initializers)
-Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded)
endif()
- option(SPIRV_WERROR "Enable error on warning" OFF)
if(${SPIRV_WERROR})
set(SPIRV_WARNINGS ${SPIRV_WARNINGS} -Werror)
endif()
elseif(WIN32)
set(SPIRV_WARNINGS -D_CRT_SECURE_NO_WARNINGS /wd4800)
+
+ if(${SPIRV_WERROR})
+ set(SPIRV_WARNINGS ${SPIRV_WARNINGS} /WX)
+ endif()
endif()
option(SPIRV_COLOR_TERMINAL "Enable color terminal output" ON)
This should only be used with a debug build. Disabled by default.
* `SPIRV_WARN_EVERYTHING=OFF` - On UNIX platforms enable the `-Weverything`
compiler front end option, disabled by default.
-* `SPIRV_WERROR=OFF` - On UNIX platforms enable the `-Werror` compiler front end
- option, disabled by default.
+* `SPIRV_WERROR=ON` - Forces a compilation error on any warnings encountered by
+ enabling the compiler-specific compiler front-end option, enabled by default.
## Library
opcode_desc->operandTypes + opcode_desc->numTypes);
while (_.word_index < inst.offset + inst_word_count) {
- const uint16_t inst_word_index = _.word_index - inst.offset;
+ const uint16_t inst_word_index = uint16_t(_.word_index - inst.offset);
if (expected_operands.empty()) {
return diagnostic() << "Invalid instruction Op" << opcode_desc->name
<< " starting at word " << inst.offset
// Must wait until here to set the inst.operands pointer because the vector
// might be resized while we accumulate itse elements.
inst.operands = operands.data();
- inst.num_operands = operands.size();
+ inst.num_operands = uint16_t(operands.size());
// Issue the callback. The callee should know that all the storage in inst
// is transient, and will disappear immediately afterward.
spv_operand_pattern_t* expected_operands) {
// We'll fill in this result as we go along.
spv_parsed_operand_t parsed_operand;
- parsed_operand.offset = _.word_index - inst->offset;
+ parsed_operand.offset = uint16_t(_.word_index - inst->offset);
// Most operands occupy one word. This might be be adjusted later.
parsed_operand.num_words = 1;
// The type argument is the one used by the grammar to parse the instruction.
<< std::numeric_limits<uint16_t>::max()
<< " words: " << string_num_words << " words long";
}
- parsed_operand.num_words = string_num_words;
+ parsed_operand.num_words = uint16_t(string_num_words);
parsed_operand.type = SPV_OPERAND_TYPE_LITERAL_STRING;
if (SpvOpExtInstImport == inst->opcode) {
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-#ifdef _MSC_VER
-// We define this so that we can use sscanf in the tests without
-// MSVC warning us all the time.
-#define _CRT_SECURE_NO_WARNINGS
-#endif
-
#include <cmath>
#include <cstdio>
#include <sstream>