From 9e8bc1bffcd8a1de54b05b24717113263a45f0c5 Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Mon, 30 Nov 2020 10:49:35 -0500 Subject: AC_C_CHAR_UNSIGNED: Remove check of $GCC. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On systems where plain ‘char’ is unsigned (e.g. AIX) we would define __CHAR_UNSIGNED__ only when $GCC was not true at configure time. If AC_LANG([C++]) has been in effect since the beginning of the script (so AC_PROG_CC was never invoked), $GCC will be false regardless; this causes an inconsistency between the C and C++ behaviors, even when both compilers are GNU. The point of checking $GCC here is that GCC has command line options to override the signedness of plain ‘char’, and it predefines __CHAR_UNSIGNED__ to indicate what the signedness actually is. We don’t want config.h to override that. However, there is already a special autoheader template for __CHAR_UNSIGNED__ that prevents it being redefined if it’s defined already, so checking $GCC at configure time is redundant and can safely be removed. * lib/autoconf/c.m4 (AC_C_CHAR_UNSIGNED): Do not make result depend on value of $GCC. Adjust commentary. --- lib/autoconf/c.m4 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index a31d2d33..af1e1a71 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -1536,7 +1536,8 @@ AU_DEFUN([AC_C_CROSS], []) # ------------------ AC_DEFUN([AC_C_CHAR_UNSIGNED], [AH_VERBATIM([__CHAR_UNSIGNED__], -[/* Define to 1 if type `char' is unsigned and you are not using gcc. */ +[/* Define to 1 if type `char' is unsigned and your compiler does not + predefine this macro. */ #ifndef __CHAR_UNSIGNED__ # undef __CHAR_UNSIGNED__ #endif])dnl @@ -1544,7 +1545,7 @@ AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, [AC_COMPILE_IFELSE([AC_LANG_BOOL_COMPILE_TRY([AC_INCLUDES_DEFAULT([])], [((char) -1) < 0])], ac_cv_c_char_unsigned=no, ac_cv_c_char_unsigned=yes)]) -if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then +if test $ac_cv_c_char_unsigned = yes; then AC_DEFINE(__CHAR_UNSIGNED__) fi ])# AC_C_CHAR_UNSIGNED -- cgit v1.2.1