From 7917e6bed3b53b61069397f65f8bb7577bfb68a3 Mon Sep 17 00:00:00 2001 From: wuggy Date: Sun, 19 Apr 2026 19:28:17 -0700 Subject: [PATCH] finally fix gcc building fully --- .vscode/settings.json | 3 +- dom/canvas/WebGLContext.cpp | 6 ++-- dom/canvas/WebGLContext_mingw_compat.cpp | 30 ++++++++++++++++++++ dom/canvas/moz.build | 7 ++++- extensions/spellcheck/hunspell/src/moz.build | 2 ++ gfx/ots/src/moz.build | 2 ++ js/src/old-configure.in | 6 ++-- media/libjxl/moz.build | 2 ++ memory/mozalloc/mozalloc_abort.h | 6 +--- modules/woff2/moz.build | 2 ++ mozglue/build/mozglue.def.in | 1 + old-configure.in | 6 ++-- 12 files changed, 60 insertions(+), 13 deletions(-) create mode 100644 dom/canvas/WebGLContext_mingw_compat.cpp diff --git a/.vscode/settings.json b/.vscode/settings.json index 5874e58613..ae5ed92dd7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,7 +6,8 @@ "Test-Path": true, "mkdir": true, "cp": true, - "hdiutil": true + "hdiutil": true, + "&": true }, "files.associations": { "limits.h": "c" diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index afb280b737..aa936d9446 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -843,9 +843,11 @@ WebGLContext::ThrowEvent_WebGLContextCreationError(const nsACString& text) } NS_IMETHODIMP -WebGLContext::InitializeWithDrawTarget(nsIDocShell*, - NotNull) +WebGLContext::InitializeWithDrawTarget(nsIDocShell* aDocShell, + NotNull aTarget) { + (void)aDocShell; + (void)aTarget; return NS_ERROR_NOT_IMPLEMENTED; } diff --git a/dom/canvas/WebGLContext_mingw_compat.cpp b/dom/canvas/WebGLContext_mingw_compat.cpp new file mode 100644 index 0000000000..db3a904802 --- /dev/null +++ b/dom/canvas/WebGLContext_mingw_compat.cpp @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#if defined(__MINGW32__) && defined(__i386__) + +#include "WebGLContext.h" + +namespace mozilla { + +extern "C" nsresult __attribute__((stdcall)) +WebGLContext_InitializeWithDrawTarget_stdcall( + WebGLContext* self, + nsIDocShell* aDocShell, + NotNull aDrawTarget) + __asm__("__ZN7mozilla12WebGLContext24InitializeWithDrawTargetEP11nsIDocShellNS_7NotNullIPNS_3gfx10DrawTargetEEE@12"); + +extern "C" nsresult __attribute__((stdcall)) +WebGLContext_InitializeWithDrawTarget_stdcall( + WebGLContext* self, + nsIDocShell* aDocShell, + NotNull aDrawTarget) +{ + return self->WebGLContext::InitializeWithDrawTarget(aDocShell, aDrawTarget); +} + +} // namespace mozilla + +#endif \ No newline at end of file diff --git a/dom/canvas/moz.build b/dom/canvas/moz.build index df60bdc1ec..4bd013ed7b 100644 --- a/dom/canvas/moz.build +++ b/dom/canvas/moz.build @@ -57,6 +57,11 @@ SOURCES += [ 'ImageUtils.cpp', ] +if CONFIG['GNU_CC'] and CONFIG['CPU_ARCH'] == 'x86' and CONFIG['OS_ARCH'] == 'WINNT': + SOURCES += [ + 'WebGLContext_mingw_compat.cpp', + ] + # WebGL Sources UNIFIED_SOURCES += [ 'TexUnpackBlob.cpp', @@ -79,7 +84,6 @@ UNIFIED_SOURCES += [ 'WebGL2ContextVertices.cpp', 'WebGLActiveInfo.cpp', 'WebGLBuffer.cpp', - 'WebGLContext.cpp', 'WebGLContextBuffers.cpp', 'WebGLContextDraw.cpp', 'WebGLContextExtensions.cpp', @@ -151,6 +155,7 @@ UNIFIED_SOURCES += [ SOURCES += [ 'MurmurHash3.cpp', + 'WebGLContext.cpp', ] # Suppress warnings from third-party code. diff --git a/extensions/spellcheck/hunspell/src/moz.build b/extensions/spellcheck/hunspell/src/moz.build index 01f49ddd03..dc550c4eac 100644 --- a/extensions/spellcheck/hunspell/src/moz.build +++ b/extensions/spellcheck/hunspell/src/moz.build @@ -17,6 +17,8 @@ SOURCES += [ 'utf_info.cxx', ] +DISABLE_STL_WRAPPING = True + DEFINES['BUILDING_LIBHUNSPELL'] = True # Hunspell must be built into libxul on SunOS. See UXP Issue #2290. diff --git a/gfx/ots/src/moz.build b/gfx/ots/src/moz.build index b5c7ceca9e..4eaba9fd27 100644 --- a/gfx/ots/src/moz.build +++ b/gfx/ots/src/moz.build @@ -62,6 +62,8 @@ if CONFIG['GKMEDIAS_SHARED_LIBRARY']: # We allow warnings for third-party code that can be updated from upstream. ALLOW_COMPILER_WARNINGS = True +DISABLE_STL_WRAPPING = True + FINAL_LIBRARY = 'gkmedias' DEFINES['PACKAGE_VERSION'] = '"moz"' diff --git a/js/src/old-configure.in b/js/src/old-configure.in index 0b3cab9542..e1739af4de 100644 --- a/js/src/old-configure.in +++ b/js/src/old-configure.in @@ -1034,8 +1034,10 @@ case "${OS_TARGET}" in WINNT|Darwin|Android) ;; *) - STL_FLAGS="-I${DIST}/stl_wrappers" - WRAP_STL_INCLUDES=1 + if test -z "$GNU_CC"; then + STL_FLAGS="-I${DIST}/stl_wrappers" + WRAP_STL_INCLUDES=1 + fi ;; esac diff --git a/media/libjxl/moz.build b/media/libjxl/moz.build index 26a69c0c92..e8f10dd473 100644 --- a/media/libjxl/moz.build +++ b/media/libjxl/moz.build @@ -114,6 +114,8 @@ EXPORTS.jxl += [ DEFINES["JPEGXL_ENABLE_BOXES"] = "0" DEFINES["JPEGXL_ENABLE_TRANSCODE_JPEG"] = "0" +DISABLE_STL_WRAPPING = True + FINAL_LIBRARY = "gkmedias" # We allow warnings for third-party code that can be updated from upstream. diff --git a/memory/mozalloc/mozalloc_abort.h b/memory/mozalloc/mozalloc_abort.h index b7224c5424..1f12a43f34 100644 --- a/memory/mozalloc/mozalloc_abort.h +++ b/memory/mozalloc/mozalloc_abort.h @@ -16,11 +16,7 @@ * Note: MOZ_NORETURN seems to break crash stacks on ARM, so we don't * use that annotation there. */ -#if defined(__MINGW32__) -# define MOZALLOC_ABORT_API -#else -# define MOZALLOC_ABORT_API MFBT_API -#endif +#define MOZALLOC_ABORT_API MFBT_API MOZALLOC_ABORT_API #if !defined(__arm__) diff --git a/modules/woff2/moz.build b/modules/woff2/moz.build index b21c89e171..cdebd80edf 100644 --- a/modules/woff2/moz.build +++ b/modules/woff2/moz.build @@ -27,4 +27,6 @@ LOCAL_INCLUDES += [ # We allow warnings for third-party code that can be updated from upstream. ALLOW_COMPILER_WARNINGS = True +DISABLE_STL_WRAPPING = True + Library('woff2') diff --git a/mozglue/build/mozglue.def.in b/mozglue/build/mozglue.def.in index 62eb3caed4..a3fc16da9a 100644 --- a/mozglue/build/mozglue.def.in +++ b/mozglue/build/mozglue.def.in @@ -34,6 +34,7 @@ EXPORTS _wcsdup=wrap_wcsdup jemalloc_stats jemalloc_free_dirty_pages + _Z14mozalloc_abortPKc ; A hack to work around the CRT (see giant comment in Makefile.in) frex=dumb_free_thunk #endif diff --git a/old-configure.in b/old-configure.in index ef233e433f..1c1d212f9a 100644 --- a/old-configure.in +++ b/old-configure.in @@ -1230,8 +1230,10 @@ case "${OS_TARGET}" in Darwin) ;; *) - STL_FLAGS="-I${DIST}/stl_wrappers" - WRAP_STL_INCLUDES=1 + if test -z "$GNU_CC"; then + STL_FLAGS="-I${DIST}/stl_wrappers" + WRAP_STL_INCLUDES=1 + fi ;; esac