From eb53141fda9023afe81a43dd969e2a25d906ac32 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 2 May 2013 18:42:09 +0200 Subject: qmake/vcxproj: fix parsing of /RTC* options /RTCsu and /RTCus must be handled as full runtime check options. Task-number: QTBUG-30711 Change-Id: I783bf49f2ab1d4fd9636dca8e434bccb54844c8c Reviewed-by: Oswald Buddenhagen (cherry picked from commit 3c62f4d0c65f1a60bd8d4e6b985d79cb0aa8342b) --- qmake/generators/win32/msvc_objectmodel.cpp | 33 ++++++++++++++++++++--------- qmake/generators/win32/msvc_objectmodel.h | 11 ++++++---- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 6f47be7..a8c936b 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -777,16 +777,14 @@ bool VCCLCompilerTool::parseOption(const char* option) found = false; break; case 'R': if(second == 'T' && third == 'C') { - if(fourth == '1') - BasicRuntimeChecks = runtimeBasicCheckAll; - else if(fourth == 'c') - SmallerTypeCheck = _True; - else if(fourth == 's') - BasicRuntimeChecks = runtimeCheckStackFrame; - else if(fourth == 'u') - BasicRuntimeChecks = runtimeCheckUninitVariables; - else - found = false; break; + int rtc = BasicRuntimeChecks; + for (size_t i = 4; option[i]; ++i) { + if (!parseRuntimeCheckOption(option[i], &rtc)) { + found = false; + break; + } + } + BasicRuntimeChecks = static_cast(rtc); } break; case 'T': @@ -1130,6 +1128,21 @@ bool VCCLCompilerTool::parseOption(const char* option) return true; } +bool VCCLCompilerTool::parseRuntimeCheckOption(char c, int *rtc) +{ + if (c == '1') + *rtc = runtimeBasicCheckAll; + else if (c == 'c') + SmallerTypeCheck = _True; + else if (c == 's') + *rtc |= runtimeCheckStackFrame; + else if (c == 'u') + *rtc |= runtimeCheckUninitVariables; + else + return false; + return true; +} + // VCLinkerTool ----------------------------------------------------- VCLinkerTool::VCLinkerTool() : DataExecutionPrevention(unset), diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 1176862..a5a0ba5 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -103,10 +103,10 @@ enum asmListingOption { asmListingAsmSrc }; enum basicRuntimeCheckOption { - runtimeBasicCheckNone, - runtimeCheckStackFrame, - runtimeCheckUninitVariables, - runtimeBasicCheckAll + runtimeBasicCheckNone = 0, + runtimeCheckStackFrame = 1, + runtimeCheckUninitVariables = 2, + runtimeBasicCheckAll = runtimeCheckStackFrame | runtimeCheckUninitVariables }; enum browseInfoOption { brInfoNone, @@ -576,6 +576,9 @@ public: QString PreprocessOutputPath; VCConfiguration* config; + +private: + bool parseRuntimeCheckOption(char c, int *rtc); }; class VCLinkerTool : public VCToolBase -- cgit v0.12