diff options
| author | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-10-26 14:46:51 +0100 |
|---|---|---|
| committer | Robin Haberkorn <rhaberkorn@fmsbw.de> | 2025-10-26 14:46:51 +0100 |
| commit | 3ab89b5916579ef08b6b0ee59a2208dc8a1d0c84 (patch) | |
| tree | 1754601c949cb44433301a9c38a9cefd4d7c2388 | |
| parent | db7f8031e7c2992de9290877fc49a81dc1ac1dfd (diff) | |
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.
| m--------- | contrib/scintilla | 0 | ||||
| -rw-r--r-- | m4/ax_ptrdiff_aliases_int.m4 | 15 |
2 files changed, 6 insertions, 9 deletions
diff --git a/contrib/scintilla b/contrib/scintilla -Subproject 333dd3153850d05a219731dee0b899155442b19 +Subproject db63b6316586873ae1fd13318787dca58602664 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 <stddef.h> + @%:@include <assert.h> ]], [[ - 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 |
