From 5ce7e516e5353fd82891a4468bd3a2b8c96bdb8e Mon Sep 17 00:00:00 2001 From: Julien Fischer Date: Sun, 1 Feb 2026 13:22:59 +1100 Subject: [PATCH] Fix namespace cleanliness checks with GCC on Windows. On Windows, object files created by GCC contain reference pointer symbols beginning with ".refptr.". Ignore these symbols when doing namespace cleanliness checks. They are an implementation detail. If there is an issue with namespace cleanliness, then we can detect and report it for the original symbol for which the reference point was generated. configure.ac: Detect whether this platform is one that generates reference pointers in object code. Mmake.common.in: On platforms that have reference pointers, ignore all symbols beginning with ".refptr." when doing namespace cleanliness checks. --- Mmake.common.in | 12 +++++++++++- configure.ac | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/Mmake.common.in b/Mmake.common.in index 7523a7ea1..9f3e0a2f9 100644 --- a/Mmake.common.in +++ b/Mmake.common.in @@ -479,6 +479,15 @@ else MSVC_OBJ_PREFIX_EXPRS = endif +# Ignore reference pointer symbols created by GCC on Windows. +# (See definition of HAVE_REFPTR_SYMS in configure.ac for details.) +ifeq ("@HAVE_REFPTR_SYMS@","yes") +GCC_WIN_OBJ_PREFIX_EXPRS = \ + -e '^\.refptr\.' +else +GCC_WIN_OBJ_PREFIX_EXPRS = +endif + MACRO_PREFIX_EXPRS = \ $(GEN_MACRO_PREFIX_EXPRS) \ $(LIB_MACRO_PREFIX_EXPRS) \ @@ -491,7 +500,8 @@ OBJ_PREFIX_EXPRS = \ $(BROWSER_OBJ_PREFIX_EXPRS) \ $(MDBCOMP_OBJ_PREFIX_EXPRS) \ $(SSDB_OBJ_PREFIX_EXPRS) \ - $(MSVC_OBJ_PREFIX_EXPRS) + $(MSVC_OBJ_PREFIX_EXPRS) \ + $(GCC_WIN_OBJ_PREFIX_EXPRS) HEADER_CLEAN_FILTER = \ grep -v $(MACRO_PREFIX_EXPRS) | \ diff --git a/configure.ac b/configure.ac index daa479a8f..b7dfcb818 100644 --- a/configure.ac +++ b/configure.ac @@ -3236,6 +3236,27 @@ AC_SUBST([SYMPREFIX]) #-----------------------------------------------------------------------------# +# On Windows, GCC generates reference pointers in the object code that it +# creates. These are intended to workaround limitations in the PE/COFF format. +# Reference pointer symbol names begin with the prefix ".refptr.". +# We ignore such symbols when doing namespace cleanliness checks since they +# are an implementation detail and if there is a cleanliness issue we will +# report it for the original symbol anyway. + +HAVE_REFPTR_SYMS= + +case "$host" in + *mingw*|*cygwin*) + case "$C_COMPILER_TYPE)" in + gcc*) HAVE_REFPTR_SYMS=yes ;; + esac + ;; +esac + +AC_SUBST([HAVE_REFPTR_SYMS]) + +#-----------------------------------------------------------------------------# + # # Figure out which is the best grade to use for various different purposes. # In particular, choose the default grade for compiling applications.