This is an automated email from the ASF dual-hosted git repository.

leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit e94d98e3929e4048dda6f3dae47ccdf173a1e5f1
Author: Peter Kovacs <[email protected]>
AuthorDate: Wed Jul 22 00:55:44 2026 +0200

    build/win64: BOOST_MEM_FN_ENABLE_CDECL is x86-only (boost::bind on x64) [P4]
    
    On x86, MSVC member functions default to __thiscall (!= SAL_CALL __cdecl), 
so
    boost needs the explicit __cdecl mem_fn overload 
(BOOST_MEM_FN_ENABLE_CDECL) or
    boost::bind fails (C2825).  On x64 there is a single calling convention 
(__cdecl),
    so that overload duplicates the default mf1 and boost::bind becomes 
ambiguous
    (C2668, first seen in basegfx/debugplotter.cxx).  Make the define x86-only 
in both
    places that set it:
    
    - boost.legacy overlay BUILD.bazel: defines = select() on a local ":x64"
      config_setting (@platforms//cpu:x86_64); add platforms as a bazel_dep in 
the
      overlay AND registry MODULE.bazel so the constraint resolves; re-pin the 
overlay
      BUILD/MODULE sha256 in source.json (hash-pinned bzlmod registry).
    - toolkit/inc/pch/boost_bind_msvc_fix.hpp (force-included): #ifdef _MSC_VER 
->
      #if defined(_MSC_VER) && !defined(_WIN64).
    
    Covers every boost::bind/mem_fn consumer on x64.
    
    Co-Authored-By: Claude Opus 4.8 <[email protected]>
    (cherry picked from commit 7734afe7d03306c987890afaab1f521c72d5b8c4)
---
 .../modules/boost.legacy/1.55.0/MODULE.bazel       |  3 ++-
 .../boost.legacy/1.55.0/overlay/BUILD.bazel        | 23 ++++++++++++++++++----
 .../boost.legacy/1.55.0/overlay/MODULE.bazel       |  3 ++-
 .../modules/boost.legacy/1.55.0/source.json        |  6 +++---
 main/toolkit/inc/pch/boost_bind_msvc_fix.hpp       |  6 +++++-
 5 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel 
b/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel
index 9c40dc4f16..006d6cd316 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel
+++ b/ext_libraries/modules/boost.legacy/1.55.0/MODULE.bazel
@@ -3,4 +3,5 @@ module(
     version = "1.55.0",
 )
 
-bazel_dep(name = "rules_cc",         version = "0.2.17")
\ No newline at end of file
+bazel_dep(name = "rules_cc",         version = "0.2.17")
+bazel_dep(name = "platforms",        version = "1.0.0")  # for the x64 
config_setting in BUILD.bazel
\ No newline at end of file
diff --git a/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel 
b/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel
index 964da0e594..86ef7b4507 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel
+++ b/ext_libraries/modules/boost.legacy/1.55.0/overlay/BUILD.bazel
@@ -2,13 +2,28 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
 
 package(default_visibility = ["//visibility:public"])
 
+# x64 detection (local config_setting so this overlay stays self-contained and
+# doesn't reference main-repo labels).
+config_setting(
+    name = "x64",
+    constraint_values = ["@platforms//cpu:x86_64"],
+)
+
 # Boost is header-only for the parts used in AOO (bind, unordered, etc.)
-# BOOST_MEM_FN_ENABLE_CDECL: MSVC 9.0 (VS2008) encodes SAL_CALL (__cdecl) into
-# member-function-pointer types for template argument deduction. Without this
-# define, boost::bind falls through to the generic path and fails with C2825.
+# BOOST_MEM_FN_ENABLE_CDECL (x86 ONLY): on x86, MSVC 9.0 (VS2008) member 
functions
+# default to __thiscall, which differs from SAL_CALL (__cdecl), so boost needs 
the
+# explicit __cdecl mem_fn overload for template argument deduction of SAL_CALL
+# member-function pointers — without it boost::bind fails C2825.
+# On x64 there is a SINGLE calling convention (__cdecl), so __thiscall == 
__cdecl and
+# the explicit-cdecl overload becomes identical to the default one → 
boost::bind is
+# AMBIGUOUS (C2668).  So the define must NOT be set on x64 (matches 
wntmscx.mk, which
+# comments it out).
 cc_library(
     name = "boost.legacy",
     hdrs = glob(["boost/**/*.hpp"]),
     includes = ["."],
-    defines = ["BOOST_MEM_FN_ENABLE_CDECL"],
+    defines = select({
+        ":x64": [],
+        "//conditions:default": ["BOOST_MEM_FN_ENABLE_CDECL"],
+    }),
 )
diff --git a/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel 
b/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel
index 9c40dc4f16..006d6cd316 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel
+++ b/ext_libraries/modules/boost.legacy/1.55.0/overlay/MODULE.bazel
@@ -3,4 +3,5 @@ module(
     version = "1.55.0",
 )
 
-bazel_dep(name = "rules_cc",         version = "0.2.17")
\ No newline at end of file
+bazel_dep(name = "rules_cc",         version = "0.2.17")
+bazel_dep(name = "platforms",        version = "1.0.0")  # for the x64 
config_setting in BUILD.bazel
\ No newline at end of file
diff --git a/ext_libraries/modules/boost.legacy/1.55.0/source.json 
b/ext_libraries/modules/boost.legacy/1.55.0/source.json
index 248aed0eed..8cf2e31f65 100644
--- a/ext_libraries/modules/boost.legacy/1.55.0/source.json
+++ b/ext_libraries/modules/boost.legacy/1.55.0/source.json
@@ -3,7 +3,7 @@
     "integrity": "sha256-//AAI915SG1ETI4pki9AcuHUUfxaTStgdYUurX8re1I=",
     "strip_prefix": "boost_1_55_0",
     "overlay": {
-        "MODULE.bazel": "sha256-xQ5HsLuRop43OYB2ybc1Lf3bID6S3HI+wsJCWH1WiMA=",
-        "BUILD.bazel": "sha256-jFaYs5fFUumAbmCsk7FOqSfLy4WYJD5dBSt3S/7od9I="
+        "MODULE.bazel": "sha256-pjDVPh7DbLMZVVyThgArsqKgd9FVDNdQ+FOOzgRRjzY=",
+        "BUILD.bazel": "sha256-gAADCK4EYMecaizbqPQrU4tnZEYLmJzO4zAOTcNjcYE="
     }
-}
\ No newline at end of file
+}
diff --git a/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp 
b/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp
index 8d6801639b..6a79df4aa5 100644
--- a/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp
+++ b/main/toolkit/inc/pch/boost_bind_msvc_fix.hpp
@@ -16,7 +16,11 @@
 // The original AOO build used MinGW/GCC which ignores both calling convention
 // and exception specs in template type matching, so no fix was needed there.
 
-#ifdef _MSC_VER
+// x86 ONLY: on x64 there is a single calling convention (__cdecl), so the 
default
+// boost mf1 overload already matches SAL_CALL member pointers; defining
+// BOOST_MEM_FN_ENABLE_CDECL there makes mf1_cdecl duplicate mf1 → boost::bind
+// C2668 ambiguous.  Matches the x86-only handling in the boost.legacy overlay.
+#if defined(_MSC_VER) && !defined(_WIN64)
 #  define BOOST_MEM_FN_ENABLE_CDECL
 #endif
 

Reply via email to