From 42883bf8230a40caf82afd5613449fa59e61165a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 4 Jan 2020 15:53:35 +0100 Subject: [PATCH 1/4] uchar: Decide about _GL_LARGE_CHAR32_T at configure time. * m4/uchar.m4 (gl_UCHAR_H): Set SMALL_WCHAR_T. * modules/uchar (Files): Add stdint.m4. (Makefile.am): Substitute SMALL_WCHAR_T. * lib/uchar.in.h (_GL_LARGE_CHAR32_T): Rely on SMALL_WCHAR_T. --- ChangeLog | 8 ++++++++ lib/uchar.in.h | 2 +- m4/uchar.m4 | 12 +++++++++++- modules/uchar | 2 ++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a1cfa2..f35de0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2020-01-04 Bruno Haible + uchar: Decide about _GL_LARGE_CHAR32_T at configure time. + * m4/uchar.m4 (gl_UCHAR_H): Set SMALL_WCHAR_T. + * modules/uchar (Files): Add stdint.m4. + (Makefile.am): Substitute SMALL_WCHAR_T. + * lib/uchar.in.h (_GL_LARGE_CHAR32_T): Rely on SMALL_WCHAR_T. + +2020-01-04 Bruno Haible + Fix AC_CHECK_DECL so that it deactivates clang's built-in declarations. Reported by Martin Storsjö in . diff --git a/lib/uchar.in.h b/lib/uchar.in.h index f377cb4..5241b2e 100644 --- a/lib/uchar.in.h +++ b/lib/uchar.in.h @@ -55,7 +55,7 @@ typedef uint_least32_t char32_t; #endif /* Define if a 'char32_t' can hold more characters than a 'wchar_t'. */ -#if (defined _AIX && !defined __64BIT__) || defined _WIN32 || defined __CYGWIN__ +#if @SMALL_WCHAR_T@ /* 32-bit AIX, Cygwin, native Windows */ # define _GL_LARGE_CHAR32_T 1 #endif diff --git a/m4/uchar.m4 b/m4/uchar.m4 index 2fbe45f..4aebf5c 100644 --- a/m4/uchar.m4 +++ b/m4/uchar.m4 @@ -1,4 +1,4 @@ -# uchar.m4 serial 4 +# uchar.m4 serial 5 dnl Copyright (C) 2019-2020 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,6 +19,16 @@ AC_DEFUN_ONCE([gl_UCHAR_H], fi AC_SUBST([HAVE_UCHAR_H]) + dnl Test whether a 'char32_t' can hold more characters than a 'wchar_t'. + gl_STDINT_BITSIZEOF([wchar_t], [gl_STDINT_INCLUDES]) + if test $BITSIZEOF_WCHAR_T -lt 32; then + SMALL_WCHAR_T=1 + else + SMALL_WCHAR_T=0 + fi + dnl SMALL_WCHAR_T is expected to be 1 on 32-bit AIX, Cygwin, native Windows. + AC_SUBST([SMALL_WCHAR_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, and which is not dnl guaranteed by C11. diff --git a/modules/uchar b/modules/uchar index f3f83ae..bd1b4e0 100644 --- a/modules/uchar +++ b/modules/uchar @@ -4,6 +4,7 @@ A GNU-like . Files: lib/uchar.in.h m4/uchar.m4 +m4/stdint.m4 Depends-on: include_next @@ -26,6 +27,7 @@ uchar.h: uchar.in.h $(top_builddir)/config.status $(CXXDEFS_H) -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ -e 's|@''NEXT_UCHAR_H''@|$(NEXT_UCHAR_H)|g' \ + -e 's|@''SMALL_WCHAR_T''@|$(SMALL_WCHAR_T)|g' \ -e 's/@''GNULIB_BTOC32''@/$(GNULIB_BTOC32)/g' \ -e 's/@''GNULIB_C32TOB''@/$(GNULIB_C32TOB)/g' \ -e 's/@''GNULIB_MBRTOC32''@/$(GNULIB_MBRTOC32)/g' \ -- 2.7.4