aboutsummaryrefslogtreecommitdiffhomepage
path: root/m4/ax_ptrdiff_aliases_int.m4
blob: 32e1712aa0e1871d854f6fc807645bdf916886c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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 <stddef.h>
			@%:@include <assert.h>
		]], [[
			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*])
	])
])dnl