From 3ab89b5916579ef08b6b0ee59a2208dc8a1d0c84 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sun, 26 Oct 2025 14:46:51 +0100 Subject: AX_PTRDIFF_ALIASES_INT: the check should be more reliable now * It was failing on OpenSUSE Tumbleweed i586 on OBS, resulting in duplicate symbols and build errors. This was not reproducible with 32-bit builds on OpenSUSE Tumbleweed x86_64. * Instead of hoping for a compiler warning to be treated as an error, we now use a static assertion with a _Generic expression. * The scintilla submodule has also been updated since Neil was asking to update the documentation as well. --- m4/ax_ptrdiff_aliases_int.m4 | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'm4') diff --git a/m4/ax_ptrdiff_aliases_int.m4 b/m4/ax_ptrdiff_aliases_int.m4 index d28e864..32e1712 100644 --- a/m4/ax_ptrdiff_aliases_int.m4 +++ b/m4/ax_ptrdiff_aliases_int.m4 @@ -1,21 +1,18 @@ AC_DEFUN([AX_PTRDIFF_ALIASES_INT], [ - ax_saved_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -Werror" - - AC_CACHE_CHECK([whether ptrdiff_t aliases int], [ax_cv_ptrdiff_aliases_int], [ + AC_CACHE_CHECK([whether ptrdiff_t* aliases int*], [ax_cv_ptrdiff_aliases_int], [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ @%:@include + @%:@include ]], [[ - int a = 23; - ptrdiff_t *b = &a; + ptrdiff_t x = 23; + _Static_assert(_Generic(&x, int* : 1, default : 0), + "ptrdiff_t* does not alias int*"); ]])], [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]) + AC_DEFINE([PTRDIFF_ALIASES_INT], [1], [Whether ptrdiff_t* aliases int*]) ]) - - CFLAGS="$ax_saved_CFLAGS" ])dnl -- cgit v1.2.3