Repository: thrift
Updated Branches:
  refs/heads/master 4eb23472b -> 33df4eb77


THRIFT-4166: fix recent VC2010 build regression and prevent it in the future
Client: cpp

This closes #1237


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/33df4eb7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/33df4eb7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/33df4eb7

Branch: refs/heads/master
Commit: 33df4eb77a70a25a37060efd5e5aad049ed39062
Parents: 4eb2347
Author: James E. King, III <jk...@apache.org>
Authored: Thu Apr 6 08:45:17 2017 -0400
Committer: James E. King, III <jk...@apache.org>
Committed: Thu Apr 6 08:45:17 2017 -0400

----------------------------------------------------------------------
 appveyor.yml                             | 54 ++++++++++++++-------------
 build/appveyor/MSVC-appveyor-build.bat   |  1 +
 build/appveyor/MSVC-appveyor-install.bat | 12 ++++++
 build/appveyor/MSVC-appveyor-test.bat    |  6 +--
 build/appveyor/cl_setenv.bat             | 18 +++++++--
 lib/cpp/src/thrift/TToString.h           |  6 +--
 6 files changed, 60 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/33df4eb7/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index b25e7d2..42c2911 100755
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -31,44 +31,33 @@ cache:
   - C:\ProgramData\chocolatey\lib -> build\appveyor\MSVC-appveyor-install.bat
   - C:\msys64\var\cache\pacman    -> build\appveyor\MSYS-appveyor-install.bat
 
-configuration:
-# - Debug
-  - Release
-
-platform:
-# - x86
-  - x64
-
 environment:
   matrix:
+   - PROFILE: MSVC2010
+     PLATFORM: x86
+     CONFIGURATION: Debug
+     BOOST_VERSION: 1.54.0
+     LIBEVENT_VERSION: 2.0.22
+     QT_VERSION: 5.6
+     ZLIB_VERSION: 1.2.8
+     DISABLED_TESTS: StressTestNonBlocking|concurrency_test
+
    - PROFILE: MSVC2015
+     PLATFORM: x64
+     CONFIGURATION: Release
      BOOST_VERSION: 1.63.0
      LIBEVENT_VERSION: 2.0.22
      PYTHON_VERSION: 3.6
      QT_VERSION: 5.8
      ZLIB_VERSION: 1.2.11
+     DISABLED_TESTS: StressTestNonBlocking
 
    - PROFILE: MINGW
-
-#   - PROFILE: MSVC2010
-#     BOOST_VERSION: 1.59.0
-#     LIBEVENT_VERSION: 2.0.22
-#     PYTHON_VERSION: 3.3
-#     ZLIB_VERSION: 1.2.8
-
-#   - PROFILE: MSYS
+     PLATFORM: x64
+     CONFIGURATION: Release
 
 matrix:
-  allow_failures:
-    # MSVC2010 appears to be 32-bit only in appveyor
-    - platform: x64
-      PROFILE: MSVC2010
-
-    # Only have 64-bit MinGW working so far (inside MSYS2)
-    - platform: x86
-      PROFILE: MINGW
-    - platform: x86
-      PROFILE: MSYS
+  fast_finish: true
 
 install:
   - cd %APPVEYOR_BUILD_FOLDER%
@@ -83,6 +72,7 @@ test_script:
   - cd %APPVEYOR_BUILD_FOLDER%
   - call build\appveyor\%PROFILE:~0,4%-appveyor-test.bat
 
+
 # artifact capture disabled as it might increase service cost for little gain:
 #
 # artifacts:
@@ -93,3 +83,15 @@ test_script:
 #  - path: local-thrift-build\Testing
 #    name: ctest output
 #    type: zip
+
+# RDP support: use one or the other...
+#
+# enables RDP for each build job so you can inspect the environment at the 
beginning of the job:
+# init:
+#  - ps: iex ((new-object 
net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+#
+# enables RDP at the end of the build job so you can login and re-run
+# commands to see why something failed...
+# on_finish:
+#  - ps: $blockRdp = $true; iex ((new-object 
net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
+

http://git-wip-us.apache.org/repos/asf/thrift/blob/33df4eb7/build/appveyor/MSVC-appveyor-build.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSVC-appveyor-build.bat 
b/build/appveyor/MSVC-appveyor-build.bat
index ee022cb..054a8b4 100644
--- a/build/appveyor/MSVC-appveyor-build.bat
+++ b/build/appveyor/MSVC-appveyor-build.bat
@@ -35,6 +35,7 @@ CD "%BUILDDIR%"                             || EXIT /B
     -DZLIB_LIBRARY="%WIN3P%\zlib-inst\lib\zlib%ZLIB_LIB_SUFFIX%.lib" ^
     -DZLIB_ROOT="%WIN3P%\zlib-inst" ^
     -DWITH_PYTHON=%WITH_PYTHON% ^
+    -DWITH_%THREADMODEL%THREADS=ON ^
     -DWITH_SHARED_LIB=OFF ^
     -DWITH_STATIC_LIB=ON                    || EXIT /B
 @ECHO OFF

http://git-wip-us.apache.org/repos/asf/thrift/blob/33df4eb7/build/appveyor/MSVC-appveyor-install.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSVC-appveyor-install.bat 
b/build/appveyor/MSVC-appveyor-install.bat
index 5343d85..573700e 100644
--- a/build/appveyor/MSVC-appveyor-install.bat
+++ b/build/appveyor/MSVC-appveyor-install.bat
@@ -56,5 +56,17 @@ IF "%COMPILER%" == "vc100" (
   7z x "msinttypes-r26.zip"               || EXIT /B
 )
 
+:: appveyor build slaves do not have MSVC2010 Boost installed
+IF "%COMPILER%" == "vc100" (
+  SET BITS=64
+  IF "%PLATFORM%" == "x86" (
+    SET BITS=32
+  )
+  SET 
BOOSTEXEURL=https://downloads.sourceforge.net/project/boost/boost-binaries/%BOOST_VERSION%/boost_%BOOST_VERSION:.=_%-msvc-10.0-!BITS!.exe
+  SET 
BOOSTEXE=C:\projects\thrift\buildcache\boost_%BOOST_VERSION:.=_%-msvc-10.0-!BITS!.exe
+  appveyor DownloadFile "!BOOSTEXEURL!" -FileName "!BOOSTEXE!" || EXIT /B
+  "!BOOSTEXE!" /dir=C:\Libraries\boost_%BOOST_VERSION:.=_% /silent || EXIT /B
+)
+
 :: Haskell (GHC) and cabal
 cinst -c "%BUILDCACHE%" -y ghc            || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/33df4eb7/build/appveyor/MSVC-appveyor-test.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/MSVC-appveyor-test.bat 
b/build/appveyor/MSVC-appveyor-test.bat
index 1737085..16ee207 100644
--- a/build/appveyor/MSVC-appveyor-test.bat
+++ b/build/appveyor/MSVC-appveyor-test.bat
@@ -22,8 +22,4 @@ CD "%BUILDDIR%"                || EXIT /B
 :: Add directories to the path to find DLLs of third party libraries so tests 
run
 SET PATH=%BOOST_LIBRARYDIR%;%OPENSSL_ROOT%\bin;%WIN3P%\zlib-inst\bin;%PATH%
 
-:: The stress test is long running on appveyor (2+ minutes)
-:: and not terribly useful with one core, so we disable it
-SET DISABLED_TESTS=StressTestNonBlocking
-
-ctest -C %CONFIGURATION% --timeout 600 -VV -E "(%DISABLED_TESTS%)" || EXIT /B
+ctest -C %CONFIGURATION% --timeout 300 -VV -E "(%DISABLED_TESTS%)" || EXIT /B

http://git-wip-us.apache.org/repos/asf/thrift/blob/33df4eb7/build/appveyor/cl_setenv.bat
----------------------------------------------------------------------
diff --git a/build/appveyor/cl_setenv.bat b/build/appveyor/cl_setenv.bat
index d907d5e..c1b956c 100644
--- a/build/appveyor/cl_setenv.bat
+++ b/build/appveyor/cl_setenv.bat
@@ -40,17 +40,29 @@ SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-build
 SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\local-thrift-inst
 SET SRCDIR=%APPVEYOR_BUILD_FOLDER%
 
+: PLATFORM is x64 or x86, but we want x86 to become "32" when we strip it down 
for paths:
+SET NORM_PLATFORM=%PLATFORM:~-2,2%
+IF "%NORM_PLATFORM%" == "86" (SET NORM_PLATFORM=32)
+
 SET BOOST_ROOT=C:\Libraries\boost_%BOOST_VERSION:.=_%
-SET BOOST_LIBRARYDIR=%BOOST_ROOT%\lib%PLATFORM:~-2,2%-msvc-%COMPILER:~-3,2%.0
-SET OPENSSL_ROOT=C:\OpenSSL-Win%PLATFORM:~-2,2%
+SET BOOST_LIBRARYDIR=%BOOST_ROOT%\lib%NORM_PLATFORM%-msvc-%COMPILER:~-3,2%.0
+SET OPENSSL_ROOT=C:\OpenSSL-Win%NORM_PLATFORM%
 SET WIN3P=%APPVEYOR_BUILD_FOLDER%\thirdparty
+
+:: MSVC2010 doesn't "do" std::thread
+IF "%COMPILER%" == "vc100" (
+  SET THREADMODEL=BOOST
+) ELSE (
+  SET THREADMODEL=STD
+)
+
 IF "%PYTHON_VERSION%" == "" (
   SET WITH_PYTHON=OFF
 ) ELSE (
   SET WITH_PYTHON=ON
   SET 
PATH=C:\Python%PYTHON_VERSION:.=%\scripts;C:\Python%PYTHON_VERSION:.=%;!PATH!
 )
-IF "%CONFIGURATION%" == "Debug" (SET ZLIB_STATIC_SUFFIX=d)
+IF "%CONFIGURATION%" == "Debug" (SET ZLIB_LIB_SUFFIX=d)
 
 IF NOT "%QT_VERSION%" == "" (
   IF /i "%PLATFORM%" == "x64" SET QTEXT=_64

http://git-wip-us.apache.org/repos/asf/thrift/blob/33df4eb7/lib/cpp/src/thrift/TToString.h
----------------------------------------------------------------------
diff --git a/lib/cpp/src/thrift/TToString.h b/lib/cpp/src/thrift/TToString.h
index fdf191e..25780f9 100644
--- a/lib/cpp/src/thrift/TToString.h
+++ b/lib/cpp/src/thrift/TToString.h
@@ -42,21 +42,21 @@ std::string to_string(const T& t) {
 // is enabled.
 inline std::string to_string(const float& t) {
   std::ostringstream o;
-  o.precision(std::ceil(std::numeric_limits<float>::digits * std::log10(2) + 
1));
+  
o.precision(static_cast<std::streamsize>(std::ceil(static_cast<double>(std::numeric_limits<float>::digits
 * std::log10(2.0f) + 1))));
   o << t;
   return o.str();
 }
 
 inline std::string to_string(const double& t) {
   std::ostringstream o;
-  o.precision(std::ceil(std::numeric_limits<double>::digits * std::log10(2) + 
1));
+  
o.precision(static_cast<std::streamsize>(std::ceil(static_cast<double>(std::numeric_limits<double>::digits
 * std::log10(2.0f) + 1))));
   o << t;
   return o.str();
 }
 
 inline std::string to_string(const long double& t) {
   std::ostringstream o;
-  o.precision(std::ceil(std::numeric_limits<long double>::digits * 
std::log10(2) + 1));
+  
o.precision(static_cast<std::streamsize>(std::ceil(static_cast<double>(std::numeric_limits<long
 double>::digits * std::log10(2.0f) + 1))));
   o << t;
   return o.str();
 }

Reply via email to