diff --git a/application/basilisk/components/migration/nsIEHistoryEnumerator.cpp b/application/basilisk/components/migration/nsIEHistoryEnumerator.cpp index 0b377d27e9..630fc666be 100644 --- a/application/basilisk/components/migration/nsIEHistoryEnumerator.cpp +++ b/application/basilisk/components/migration/nsIEHistoryEnumerator.cpp @@ -1,7 +1,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ - +#include #include "nsIEHistoryEnumerator.h" #include diff --git a/application/basilisk/components/migration/nsIEHistoryEnumerator.h b/application/basilisk/components/migration/nsIEHistoryEnumerator.h index 1572a8dd5b..d02e8bf55d 100644 --- a/application/basilisk/components/migration/nsIEHistoryEnumerator.h +++ b/application/basilisk/components/migration/nsIEHistoryEnumerator.h @@ -4,7 +4,7 @@ #ifndef iehistoryenumerator___h___ #define iehistoryenumerator___h___ - +#include #include #include "mozilla/Attributes.h" diff --git a/db/sqlite3/src/moz.build b/db/sqlite3/src/moz.build index 1ffc326f8a..12fd010bc9 100644 --- a/db/sqlite3/src/moz.build +++ b/db/sqlite3/src/moz.build @@ -70,7 +70,8 @@ if CONFIG['MOZ_DEBUG']: if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']: DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True DEFINES['SQLITE_WITHOUT_MSIZE'] = True - CFLAGS += ['-wd4013'] + if CONFIG['CC_TYPE'] in ('msvc', 'clang-cl'): + CFLAGS += ['-wd4013'] # Omit unused functions to save some library footprint. DEFINES['SQLITE_OMIT_DEPRECATED'] = True diff --git a/dom/plugins/base/PluginPRLibrary.cpp b/dom/plugins/base/PluginPRLibrary.cpp index b4acff8849..71ddb1ceff 100644 --- a/dom/plugins/base/PluginPRLibrary.cpp +++ b/dom/plugins/base/PluginPRLibrary.cpp @@ -3,6 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include "mozilla/PluginPRLibrary.h" #include "nsNPAPIPluginInstance.h" diff --git a/dom/plugins/base/nsPluginDirServiceProvider.cpp b/dom/plugins/base/nsPluginDirServiceProvider.cpp index 92348c1829..2f0c4fc877 100644 --- a/dom/plugins/base/nsPluginDirServiceProvider.cpp +++ b/dom/plugins/base/nsPluginDirServiceProvider.cpp @@ -121,8 +121,8 @@ TranslateVersionStr(const WCHAR* szVersion, verBlock *vbVersion) // wcstok that is generally not thread-safe. For our purposes here, it works // fine, though. auto wcstok = [](wchar_t* strToken, const wchar_t* strDelimit, - wchar_t** /*ctx*/) { - return ::std::wcstok(strToken, strDelimit); + wchar_t** ctx) { + return ::wcstok(strToken, strDelimit, ctx); }; #endif diff --git a/dom/system/OSFileConstants.cpp b/dom/system/OSFileConstants.cpp index abe613a350..04c10217da 100644 --- a/dom/system/OSFileConstants.cpp +++ b/dom/system/OSFileConstants.cpp @@ -34,6 +34,7 @@ #endif // defined(XP_MACOSX) #if defined(XP_WIN) +#include #include #include diff --git a/gfx/2d/ExtendInputEffectD2D1.h b/gfx/2d/ExtendInputEffectD2D1.h index 724c6a71e3..a480262423 100644 --- a/gfx/2d/ExtendInputEffectD2D1.h +++ b/gfx/2d/ExtendInputEffectD2D1.h @@ -6,6 +6,7 @@ #ifndef MOZILLA_GFX_EXTENDINPUTEFFECTD2D1_H_ #define MOZILLA_GFX_EXTENDINPUTEFFECTD2D1_H_ +#include #include #include #include diff --git a/gfx/2d/NativeFontResourceDWrite.h b/gfx/2d/NativeFontResourceDWrite.h index ff1aafa1ec..d7a330c625 100644 --- a/gfx/2d/NativeFontResourceDWrite.h +++ b/gfx/2d/NativeFontResourceDWrite.h @@ -5,7 +5,7 @@ #ifndef mozilla_gfx_NativeFontResourceDWrite_h #define mozilla_gfx_NativeFontResourceDWrite_h - +#include #include #include "2D.h" diff --git a/gfx/2d/NativeFontResourceGDI.h b/gfx/2d/NativeFontResourceGDI.h index 48932a2af8..e984fe3a99 100644 --- a/gfx/2d/NativeFontResourceGDI.h +++ b/gfx/2d/NativeFontResourceGDI.h @@ -5,7 +5,7 @@ #ifndef mozilla_gfx_NativeFontResourceGDI_h #define mozilla_gfx_NativeFontResourceGDI_h - +#include #include #include "2D.h" diff --git a/gfx/2d/PathD2D.cpp b/gfx/2d/PathD2D.cpp index b10e456e1a..54c980d6ee 100644 --- a/gfx/2d/PathD2D.cpp +++ b/gfx/2d/PathD2D.cpp @@ -2,7 +2,7 @@ * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - +#include #include "PathD2D.h" #include "HelpersD2D.h" #include diff --git a/gfx/2d/PathD2D.h b/gfx/2d/PathD2D.h index 0fb550b4a5..22a784875a 100644 --- a/gfx/2d/PathD2D.h +++ b/gfx/2d/PathD2D.h @@ -5,7 +5,7 @@ #ifndef MOZILLA_GFX_PATHD2D_H_ #define MOZILLA_GFX_PATHD2D_H_ - +#include #include #include "2D.h" diff --git a/gfx/2d/RadialGradientEffectD2D1.h b/gfx/2d/RadialGradientEffectD2D1.h index baa02aafb7..77e6c8dcc7 100644 --- a/gfx/2d/RadialGradientEffectD2D1.h +++ b/gfx/2d/RadialGradientEffectD2D1.h @@ -5,7 +5,7 @@ #ifndef MOZILLA_GFX_RADIALGRADIENTEFFECTD2D1_H_ #define MOZILLA_GFX_RADIALGRADIENTEFFECTD2D1_H_ - +#include #include #include #include diff --git a/gfx/2d/SourceSurfaceD2D1.h b/gfx/2d/SourceSurfaceD2D1.h index 5b7cedf4cc..7eb2f58fd7 100644 --- a/gfx/2d/SourceSurfaceD2D1.h +++ b/gfx/2d/SourceSurfaceD2D1.h @@ -5,7 +5,7 @@ #ifndef MOZILLA_GFX_SOURCESURFACED2D1_H_ #define MOZILLA_GFX_SOURCESURFACED2D1_H_ - +#include #include "2D.h" #include "HelpersD2D.h" #include diff --git a/gfx/2d/SourceSurfaceSkia.h b/gfx/2d/SourceSurfaceSkia.h index ffb8e47bf6..7e1d75d522 100644 --- a/gfx/2d/SourceSurfaceSkia.h +++ b/gfx/2d/SourceSurfaceSkia.h @@ -5,7 +5,7 @@ #ifndef MOZILLA_GFX_SOURCESURFACESKIA_H_ #define MOZILLA_GFX_SOURCESURFACESKIA_H_ - +#include #include "2D.h" #include #include "skia/include/core/SkCanvas.h" diff --git a/gfx/angle/moz.build b/gfx/angle/moz.build index ebdbba425b..2f6a209f1b 100644 --- a/gfx/angle/moz.build +++ b/gfx/angle/moz.build @@ -8,6 +8,8 @@ # # WARNING WARNING WARNING # +DISABLE_STL_WRAPPING = True + UNIFIED_SOURCES += [ 'src/common/angleutils.cpp', 'src/common/debug.cpp', diff --git a/gfx/angle/src/libANGLE/moz.build b/gfx/angle/src/libANGLE/moz.build index 7d12a1ca68..00443ba018 100644 --- a/gfx/angle/src/libANGLE/moz.build +++ b/gfx/angle/src/libANGLE/moz.build @@ -8,6 +8,8 @@ # # WARNING WARNING WARNING # +DISABLE_STL_WRAPPING = True + UNIFIED_SOURCES += [ '../common/angleutils.cpp', '../common/debug.cpp', diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build index 1d40b3b679..7a45efffcb 100644 --- a/gfx/angle/src/libGLESv2/moz.build +++ b/gfx/angle/src/libGLESv2/moz.build @@ -8,6 +8,8 @@ # # WARNING WARNING WARNING # +DISABLE_STL_WRAPPING = True + UNIFIED_SOURCES += [ 'entry_points_egl.cpp', 'entry_points_egl_ext.cpp', diff --git a/gfx/skia/skia/src/core/SkCpu.cpp b/gfx/skia/skia/src/core/SkCpu.cpp index 9c827f3ef9..a2be515cd2 100644 --- a/gfx/skia/skia/src/core/SkCpu.cpp +++ b/gfx/skia/skia/src/core/SkCpu.cpp @@ -13,7 +13,15 @@ #include static void cpuid (uint32_t abcd[4]) { __cpuid ((int*)abcd, 1); } static void cpuid7(uint32_t abcd[4]) { __cpuidex((int*)abcd, 7, 0); } - static uint64_t xgetbv(uint32_t xcr) { return _xgetbv(xcr); } + static uint64_t xgetbv(uint32_t xcr) { + #if defined(__MINGW32__) + uint32_t eax, edx; + __asm__ __volatile__ ("xgetbv" : "=a"(eax), "=d"(edx) : "c"(xcr)); + return (uint64_t)(edx) << 32 | eax; + #else + return _xgetbv(xcr); + #endif + } #else #include #if !defined(__cpuid_count) // Old Mac Clang doesn't have this defined. diff --git a/gfx/thebes/gfxWindowsNativeDrawing.cpp b/gfx/thebes/gfxWindowsNativeDrawing.cpp index bd2f78d210..590c697dc0 100644 --- a/gfx/thebes/gfxWindowsNativeDrawing.cpp +++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp @@ -3,6 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include #include #include "nsMathUtils.h" diff --git a/gfx/thebes/gfxWindowsPlatform.h b/gfx/thebes/gfxWindowsPlatform.h index 4735e9cc8e..7f188d341f 100644 --- a/gfx/thebes/gfxWindowsPlatform.h +++ b/gfx/thebes/gfxWindowsPlatform.h @@ -11,6 +11,7 @@ * XXX to get CAIRO_HAS_D2D_SURFACE, CAIRO_HAS_DWRITE_FONT * and cairo_win32_scaled_font_select_font */ +#include #include "cairo-win32.h" #include "gfxFontUtils.h" diff --git a/media/ffvpx/libavcodec/avcodec.symbols b/media/ffvpx/libavcodec/avcodec.symbols index bfa56e7b83..25a0cf182f 100644 --- a/media/ffvpx/libavcodec/avcodec.symbols +++ b/media/ffvpx/libavcodec/avcodec.symbols @@ -41,7 +41,6 @@ av_fft_calc av_fft_end av_fft_init av_fft_permute -av_fopen_utf8 av_free_packet av_get_audio_frame_duration av_get_audio_frame_duration2 diff --git a/media/libcubeb/src/cubeb_wasapi.cpp b/media/libcubeb/src/cubeb_wasapi.cpp index e88d6becd8..efb0ed35df 100644 --- a/media/libcubeb/src/cubeb_wasapi.cpp +++ b/media/libcubeb/src/cubeb_wasapi.cpp @@ -5,7 +5,7 @@ * accompanying file LICENSE for details. */ #define NOMINMAX - +#include #include #include #include diff --git a/media/libcubeb/src/cubeb_winmm.c b/media/libcubeb/src/cubeb_winmm.c index f4b81617e7..8eecd75b3f 100644 --- a/media/libcubeb/src/cubeb_winmm.c +++ b/media/libcubeb/src/cubeb_winmm.c @@ -20,6 +20,10 @@ #include "cubeb/cubeb.h" #include "cubeb-internal.h" +#if defined(__MINGW32__) +#define _snprintf_s(dest, size, count, ...) snprintf(dest, size, __VA_ARGS__) +#endif + /* This is missing from the MinGW headers. Use a safe fallback. */ #if !defined(MEMORY_ALLOCATION_ALIGNMENT) #define MEMORY_ALLOCATION_ALIGNMENT 16 diff --git a/memory/build/jemalloc_config.cpp b/memory/build/jemalloc_config.cpp index 0b734d804f..03f53e0de8 100644 --- a/memory/build/jemalloc_config.cpp +++ b/memory/build/jemalloc_config.cpp @@ -3,8 +3,9 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ #include +#include /* Provide an abort function for use in jemalloc code */ extern "C" void moz_abort() { - MOZ_CRASH(); + abort(); } diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c index 7b42753b63..467c5a520c 100644 --- a/memory/mozjemalloc/jemalloc.c +++ b/memory/mozjemalloc/jemalloc.c @@ -193,6 +193,10 @@ #include #include +#ifndef min +#define min(a, b) (((a) < (b)) ? (a) : (b)) +#endif + #pragma warning( disable: 4267 4996 4146 ) #define bool BOOL diff --git a/toolkit/components/downloads/nsDownloadScanner.h b/toolkit/components/downloads/nsDownloadScanner.h index 625ee6498f..5169ac40c1 100644 --- a/toolkit/components/downloads/nsDownloadScanner.h +++ b/toolkit/components/downloads/nsDownloadScanner.h @@ -5,7 +5,7 @@ #ifndef nsDownloadScanner_h_ #define nsDownloadScanner_h_ - +#include #ifdef WIN32_LEAN_AND_MEAN #undef WIN32_LEAN_AND_MEAN #endif diff --git a/toolkit/profile/ProfileUnlockerWin.h b/toolkit/profile/ProfileUnlockerWin.h index 0a7dff527b..6e78c3031d 100644 --- a/toolkit/profile/ProfileUnlockerWin.h +++ b/toolkit/profile/ProfileUnlockerWin.h @@ -6,6 +6,7 @@ #ifndef ProfileUnlockerWin_h #define ProfileUnlockerWin_h +#include #include #include diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index a4beb48278..bcebe4a2c5 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -2,7 +2,7 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - +#include #include "nspr.h" #include "mozilla/BasicEvents.h" #include "mozilla/EventDispatcher.h" diff --git a/uriloader/base/nsDocLoader.h b/uriloader/base/nsDocLoader.h index b469b8e079..6e8b65457e 100644 --- a/uriloader/base/nsDocLoader.h +++ b/uriloader/base/nsDocLoader.h @@ -8,7 +8,7 @@ #ifndef nsDocLoader_h__ #define nsDocLoader_h__ - +#include #include "nsIDocumentLoader.h" #include "nsIWebProgress.h" #include "nsIWebProgressListener.h" diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index d3f70ce191..c2eb36efd5 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -3,6 +3,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + #include #include "nsURILoader.h" #include "nsAutoPtr.h" #include "nsIURIContentListener.h" diff --git a/uriloader/base/nsURILoader.h b/uriloader/base/nsURILoader.h index 2c5648dbae..cc6e88b592 100644 --- a/uriloader/base/nsURILoader.h +++ b/uriloader/base/nsURILoader.h @@ -6,6 +6,7 @@ #ifndef nsURILoader_h__ #define nsURILoader_h__ +#include #include "nsCURILoader.h" #include "nsISupportsUtils.h" #include "nsCOMArray.h" diff --git a/xpcom/threads/StateMirroring.h b/xpcom/threads/StateMirroring.h index 197a8cc499..4484be1d98 100644 --- a/xpcom/threads/StateMirroring.h +++ b/xpcom/threads/StateMirroring.h @@ -61,7 +61,34 @@ template class AbstractCanonical { public: +#if defined(__MINGW32__) + MOZ_NEVER_INLINE MozExternalRefCountType AddRef(void) + { + MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(AbstractCanonical) + MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); + nsrefcnt count = ++mRefCnt; + NS_LOG_ADDREF(this, count, "AbstractCanonical", sizeof(*this)); + return (nsrefcnt) count; + } + + MOZ_NEVER_INLINE MozExternalRefCountType Release(void) + { + MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); + nsrefcnt count = --mRefCnt; + NS_LOG_RELEASE(this, count, "AbstractCanonical"); + if (count == 0) { + delete (this); + return 0; + } + return count; + } + typedef mozilla::TrueType HasThreadSafeRefCnt; +protected: + ::mozilla::ThreadSafeAutoRefCnt mRefCnt; +public: +#else NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AbstractCanonical) +#endif AbstractCanonical(AbstractThread* aThread) : mOwnerThread(aThread) {} virtual void AddMirror(AbstractMirror* aMirror) = 0; virtual void RemoveMirror(AbstractMirror* aMirror) = 0; @@ -82,7 +109,34 @@ template class AbstractMirror { public: +#if defined(__MINGW32__) + MOZ_NEVER_INLINE MozExternalRefCountType AddRef(void) + { + MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(AbstractMirror) + MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt"); + nsrefcnt count = ++mRefCnt; + NS_LOG_ADDREF(this, count, "AbstractMirror", sizeof(*this)); + return (nsrefcnt) count; + } + + MOZ_NEVER_INLINE MozExternalRefCountType Release(void) + { + MOZ_ASSERT(int32_t(mRefCnt) > 0, "dup release"); + nsrefcnt count = --mRefCnt; + NS_LOG_RELEASE(this, count, "AbstractMirror"); + if (count == 0) { + delete (this); + return 0; + } + return count; + } + typedef mozilla::TrueType HasThreadSafeRefCnt; +protected: + ::mozilla::ThreadSafeAutoRefCnt mRefCnt; +public: +#else NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AbstractMirror) +#endif AbstractMirror(AbstractThread* aThread) : mOwnerThread(aThread) {} virtual void UpdateValue(const T& aNewValue) = 0; virtual void NotifyDisconnected() = 0;