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.
This commit is contained in:
Julien Fischer
2026-02-01 13:22:59 +11:00
parent 12e12ac3e3
commit 5ce7e516e5
2 changed files with 32 additions and 1 deletions

View File

@@ -479,6 +479,15 @@ else
MSVC_OBJ_PREFIX_EXPRS = MSVC_OBJ_PREFIX_EXPRS =
endif 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 = \ MACRO_PREFIX_EXPRS = \
$(GEN_MACRO_PREFIX_EXPRS) \ $(GEN_MACRO_PREFIX_EXPRS) \
$(LIB_MACRO_PREFIX_EXPRS) \ $(LIB_MACRO_PREFIX_EXPRS) \
@@ -491,7 +500,8 @@ OBJ_PREFIX_EXPRS = \
$(BROWSER_OBJ_PREFIX_EXPRS) \ $(BROWSER_OBJ_PREFIX_EXPRS) \
$(MDBCOMP_OBJ_PREFIX_EXPRS) \ $(MDBCOMP_OBJ_PREFIX_EXPRS) \
$(SSDB_OBJ_PREFIX_EXPRS) \ $(SSDB_OBJ_PREFIX_EXPRS) \
$(MSVC_OBJ_PREFIX_EXPRS) $(MSVC_OBJ_PREFIX_EXPRS) \
$(GCC_WIN_OBJ_PREFIX_EXPRS)
HEADER_CLEAN_FILTER = \ HEADER_CLEAN_FILTER = \
grep -v $(MACRO_PREFIX_EXPRS) | \ grep -v $(MACRO_PREFIX_EXPRS) | \

View File

@@ -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. # Figure out which is the best grade to use for various different purposes.
# In particular, choose the default grade for compiling applications. # In particular, choose the default grade for compiling applications.