Bug 1471016 - cubeb_winmm.c should not define __MSVCRT_VERSION__ draft
authorJacek Caban <jacek@codeweavers.com>
Mon, 09 Jul 2018 19:06:17 +0200
changeset 815683 7bbc9f122f123b2a38ab7e7f05522ad0f62673fa
parent 810207 4ad4c31db9b1526aab8641be98fec8e0d63a4a7e
push id115607
push userbmo:jacek@codeweavers.com
push dateMon, 09 Jul 2018 17:32:45 +0000
bugs1471016
milestone60.1.0
Bug 1471016 - cubeb_winmm.c should not define __MSVCRT_VERSION__ MozReview-Commit-ID: FqEPnmxxkc5
media/libcubeb/mingw-ucrt.patch
media/libcubeb/src/cubeb_winmm.c
media/libcubeb/update.sh
new file mode 100644
--- /dev/null
+++ b/media/libcubeb/mingw-ucrt.patch
@@ -0,0 +1,24 @@
+commit bf2c28189fb0489043cda6f41f5ae9b8515452a0
+Author: Jacek Caban <jacek@codeweavers.com>
+Date:   Mon Jun 25 22:47:19 2018 +0200
+
+    cubeb_winmm.c: Don't define __MSVCRT_VERSION__.
+    
+    This define was added as part of commit d2c45250 and is mingw-specific (only mingw uses __MSVCRT_VERSION__). I don't know why it was added, it shouldn't be needed.
+    
+    Recently mingw-w64 added support for UCRT-based toolchains. In this case __MSVCRT_VERSION__ is set to 0x1400 and should not really be changed. UCRT-based builds support a lot of stdio.h function by inline wrappers. Those can't be disabled just for one file as they are not exported by ucrtbase.dll.
+    
+    I found the problem while working on porting Firefox to clang+mingw-w64 toolchain that uses UCRT by default.
+
+diff --git a/src/cubeb_winmm.c b/src/cubeb_winmm.c
+index 40c80b3..fd5abe2 100644
+--- a/src/cubeb_winmm.c
++++ b/src/cubeb_winmm.c
+@@ -4,7 +4,6 @@
+  * This program is made available under an ISC-style license.  See the
+  * accompanying file LICENSE for details.
+  */
+-#define __MSVCRT_VERSION__ 0x0700
+ #undef WINVER
+ #define WINVER 0x0501
+ #undef WIN32_LEAN_AND_MEAN
--- a/media/libcubeb/src/cubeb_winmm.c
+++ b/media/libcubeb/src/cubeb_winmm.c
@@ -1,15 +1,14 @@
 /*
  * Copyright © 2011 Mozilla Foundation
  *
  * This program is made available under an ISC-style license.  See the
  * accompanying file LICENSE for details.
  */
-#define __MSVCRT_VERSION__ 0x0700
 #undef WINVER
 #define WINVER 0x0501
 #undef WIN32_LEAN_AND_MEAN
 
 #include <malloc.h>
 #include <windows.h>
 #include <mmreg.h>
 #include <mmsystem.h>
--- a/media/libcubeb/update.sh
+++ b/media/libcubeb/update.sh
@@ -74,8 +74,12 @@ else
   echo "Remember to update README_MOZILLA with the version details."
 fi
 
 echo "Applying disable-assert.patch on top of $rev"
 patch -p3 < disable-assert.patch
 
 echo "Applying prefer-pulse-rust.patch on top of $rev"
 patch -p3 < prefer-pulse-rust.patch
+
+echo "Applying mingw-ucrt.patch on top of $rev"
+patch -p1 < mingw-ucrt.patch
+