[m-rev.] for review: fix namespace cleanliness checks with GCC on Windows
Julien Fischer
jfischer at opturion.com
Sat Jan 31 20:36:20 AEDT 2026
For review by anyone.
-----------------------------
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.
Julien.
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 e1e9ac2dd..5160e0768 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/reviews/attachments/20260131/e1ffbfa6/attachment.html>
More information about the reviews
mailing list