From 6f482cd3b9d69635543e6decf1c4841f6dfb1578 Mon Sep 17 00:00:00 2001
From: Maurice Kalinowski <maurice.kalinowski@digia.com>
Date: Tue, 12 Aug 2014 14:55:11 +0200
Subject: [PATCH] WinRT: Fix compiler crash (msvc2013 arm)

Visual Studio 2013 Update 3 ARM compiler has issues with the code path
trying to optimize it. Instead of disabling optimization in general,
use a pragma for the function. x86 compilation is fine though.

Change-Id: If099f7d1400cb78958d10c2fd35daef3bb75fc91
Reviewed-by: Andrew Knight <andrew.knight@digia.com>
---
 src/websockets/qwebsocketframe.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/websockets/qwebsocketframe.cpp b/src/websockets/qwebsocketframe.cpp
index e48308fe..8236498f 100644
--- a/src/websockets/qwebsocketframe.cpp
+++ b/src/websockets/qwebsocketframe.cpp
@@ -312,6 +312,13 @@ bool QWebSocketFrame::isValid() const
     return m_isValid;
 }
 
+// The arm compiler of Visual Studio 2013 Update 3 crashes when
+// trying to optimize QWebSocketFrame::readFrame. Hence turn
+// those off for this snippet
+#if defined(Q_OS_WINPHONE) && defined(__ARM__)
+#  pragma optimize("", off)
+#endif
+
 #define WAIT_FOR_MORE_DATA(dataSizeInBytes)  \
     { returnState = processingState; \
       processingState = PS_WAIT_FOR_MORE_DATA; dataWaitSize = dataSizeInBytes; }
@@ -520,6 +527,10 @@ QWebSocketFrame QWebSocketFrame::readFrame(QIODevice *pIoDevice)
     return frame;
 }
 
+#if defined(Q_OS_WINPHONE) && defined(__ARM__)
+#  pragma optimize("", on)
+#endif
+
 /*!
     \internal
  */
-- 
GitLab