]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
AC_C_CHAR_UNSIGNED: Remove check of $GCC.
authorZack Weinberg <zackw@panix.com>
Mon, 30 Nov 2020 15:49:35 +0000 (10:49 -0500)
committerZack Weinberg <zackw@panix.com>
Mon, 30 Nov 2020 16:45:25 +0000 (11:45 -0500)
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

index a31d2d33637e9513f17f281da98be1a3771abf0a..af1e1a7115f42588f5f02c70256903b589851cf1 100644 (file)
@@ -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