From 73fa311f67b21c9b897de0196d3b8227f27d828f Mon Sep 17 00:00:00 2001
From: Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
Date: Tue, 15 Jun 2010 14:44:17 +0200
Subject: qmake: Fix CONFIG += exceptions_off with the MSVC project generator.

cl.exe default exception handling (when not specified on the command
line) is to disable exceptions. In vcproj files however, if the
ExceptionHandling option is not specified, the default behavior is to
enable exceptions without SEH (/EHsh).

This patch makes sure that ExceptionHandling is disabled when /EHsc is
not fed to parseOption (which happens when the exceptions_off config
is encountered).

For VS2003 the values are a bit different where "false"==ehNone,
"true"==ehNoSEH and ehSEH is not available. The default is "true"
if not specified thus why we set it to "false" when exceptions_off
is given.

Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
---
 qmake/generators/win32/msbuild_objectmodel.cpp | 1 +
 qmake/generators/win32/msvc_objectmodel.cpp    | 7 +++++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp
index 75fc910..bf874b2 100644
--- a/qmake/generators/win32/msbuild_objectmodel.cpp
+++ b/qmake/generators/win32/msbuild_objectmodel.cpp
@@ -385,6 +385,7 @@ VCXCLCompilerTool::VCXCLCompilerTool()
         DisableLanguageExtensions(unset),
         EnableFiberSafeOptimizations(unset),
         EnablePREfast(unset),
+        ExceptionHandling("false"),
         ExpandAttributedSource(unset),
         FloatingPointExceptions(unset),
         ForceConformanceInForLoopScope(unset),
diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp
index 1e060a0..e23e119 100644
--- a/qmake/generators/win32/msvc_objectmodel.cpp
+++ b/qmake/generators/win32/msvc_objectmodel.cpp
@@ -360,8 +360,11 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP
 
 inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion)
 {
-    if (eh == ehDefault)
-        return noxml();
+    if (eh == ehDefault) {
+        if (compilerVersion >= NET2005)
+            return attrE(_ExceptionHandling, ehNone);
+        return attrS(_ExceptionHandling, "false");
+    }
 
     if (compilerVersion >= NET2005)
         return attrE(_ExceptionHandling, eh);
-- 
cgit v0.12