From d13b7d0d458d30162c2fe03f67b977e581d4c4a1 Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Tue, 5 Jun 2012 19:44:20 -0700 Subject: [PATCH] Added treat warnings as errors switch to shaderc. --- tools/shaderc.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tools/shaderc.cpp b/tools/shaderc.cpp index a8feaac9..9b65488b 100644 --- a/tools/shaderc.cpp +++ b/tools/shaderc.cpp @@ -231,14 +231,7 @@ private: void skipLine() { const char* str = &m_str[m_pos]; - const char* eol = strstr(str, "\r\n"); - if (NULL != eol) - { - m_pos += eol-str+2; - return; - } - - eol = strstr(str, "\n\r"); + const char* eol = strstr(str, "\n\r"); if (NULL != eol) { m_pos += eol-str+2; @@ -343,6 +336,8 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch flags |= _cmdLine.hasArg('\0', "partial-precision") ? D3DXSHADER_PARTIALPRECISION : 0; flags |= _cmdLine.hasArg('\0', "prefer-flow-control") ? D3DXSHADER_PREFER_FLOW_CONTROL : 0; flags |= _cmdLine.hasArg('\0', "backwards-compatibility") ? D3DXSHADER_ENABLE_BACKWARDS_COMPATIBILITY : 0; + + bool werror = _cmdLine.hasArg('\0', "Werror"); uint32_t optimization = 3; if (_cmdLine.hasArg(optimization, 'O') ) @@ -374,7 +369,8 @@ bool compileHLSLShader(CommandLine& _cmdLine, const std::string& _code, const ch , &errorMsg , &constantTable ); - if (FAILED(hr) ) + if (FAILED(hr) + || werror && NULL != errorMsg) { printCode(_code.c_str() ); fprintf(stderr, "Error: 0x%08x %s\n", hr, errorMsg->GetBufferPointer() );