From 243a3be9185412a5a29ba189c77569fa96c85e89 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Mon, 20 Oct 2025 00:02:34 +0200 Subject: scintilla: use AX_PTRDIFF_ALIASES_INT to check whether ptrdiff_t aliases int * Scintilla had build problems if ptrdiff_t doesn't alias int if it has the same storage size (e.g. on NetBSD 10 (armv6)). * Unfortunately, Neil Hodgson refused to merge my previous Scintilla patches that would have fixed the issue at the core. See https://groups.google.com/g/scintilla-interest/c/STAv6LgLyCo * He only agreed to introducing a separate flag to work around the issue (`-DPTRDIFF_DOESNT_ALIAS_INT`). * In order to continue to support all standard C/C++ conforming platforms we therefore need a compile-time check to check for the aliasability of ptrdiff_t and int. --- m4/ax_ptrdiff_aliases_int.m4 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 m4/ax_ptrdiff_aliases_int.m4 (limited to 'm4') diff --git a/m4/ax_ptrdiff_aliases_int.m4 b/m4/ax_ptrdiff_aliases_int.m4 new file mode 100644 index 0000000..f7175cd --- /dev/null +++ b/m4/ax_ptrdiff_aliases_int.m4 @@ -0,0 +1,16 @@ + +AC_DEFUN([AX_PTRDIFF_ALIASES_INT], [ + AC_CACHE_CHECK([whether ptrdiff_t aliases int], [ax_cv_ptrdiff_aliases_int], [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + @%:@include + ]], [[ + int a = 23; + ptrdiff_t *b = &a; + ]])], + [ax_cv_ptrdiff_aliases_int=yes], + [ax_cv_ptrdiff_aliases_int=no]) + ]) + AS_IF([test "x$ax_cv_ptrdiff_aliases_int" = "xyes"], [ + AC_DEFINE([PTRDIFF_ALIASES_INT], [1], [Whether ptrdiff_t aliases int]) + ]) +])dnl -- cgit v1.2.3