nanosleep nproc nstrftime
pathmax pipe2 pselect pthread_sigmask
qcopy-acl readlink readlinkat regex
- sig2str sigdescr_np socklen stat-time std-gnu11 stdalign stddef stdio
+ sig2str sigdescr_np socklen stat-time std-gnu11 stdalign stdbool stddef stdio
stpcpy strnlen strtoimax symlink sys_stat sys_time
tempname time time_r time_rz timegm timer-time timespec-add timespec-sub
update-copyright unlocked-io utimensat
btowc chmod close crypto/af_alg dup fchdir fstat langinfo lock
mbrtowc mbsinit memchr mkdir msvc-inval msvc-nothrow nl_langinfo
openat-die opendir pthread-h raise
- save-cwd select setenv sigprocmask stat stdarg stdbool
+ save-cwd select setenv sigprocmask stat stdarg
threadlib tzset unsetenv utime utime-h
wchar wcrtomb wctype-h
'
using @code{int}. Although it is also OK to use @code{int}, @code{0}
and @code{1}, this older style is gradually being phased out. When
using @code{bool}, respect the limitations of the replacement
-implementation of @code{bool}, as documented in the source file
-@file{lib/stdbool.in.h}. In particular, boolean bitfields should be of type
+implementation of @code{bool}. In particular,
+boolean bitfields should be of type
@code{bool_bf}, not @code{bool}, so that they work correctly even when
compiling Objective C with standard GCC.
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
-#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
# --avoid=sigprocmask \
# --avoid=stat \
# --avoid=stdarg \
-# --avoid=stdbool \
# --avoid=threadlib \
# --avoid=tzset \
# --avoid=unsetenv \
# stat-time \
# std-gnu11 \
# stdalign \
+# stdbool \
# stddef \
# stdio \
# stpcpy \
MODULES_OBJ = @MODULES_OBJ@
MODULES_SECONDARY_SUFFIX = @MODULES_SECONDARY_SUFFIX@
MODULES_SUFFIX = @MODULES_SUFFIX@
+NEXT_ASSERT_H = @NEXT_ASSERT_H@
+NEXT_AS_FIRST_DIRECTIVE_ASSERT_H = @NEXT_AS_FIRST_DIRECTIVE_ASSERT_H@
NEXT_AS_FIRST_DIRECTIVE_DIRENT_H = @NEXT_AS_FIRST_DIRECTIVE_DIRENT_H@
NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
--- /dev/null
+# Check for bool that conforms to C2023.
+
+dnl Copyright 2022 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_C_BOOL],
+[
+ AC_CACHE_CHECK([for bool, true, false], [gl_cv_c_bool],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_SOURCE([[
+ #if true == false
+ #error "true == false"
+ #endif
+ extern bool b;
+ bool b = true == false;]])],
+ [gl_cv_c_bool=yes],
+ [gl_cv_c_bool=no])])
+ if test "$gl_cv_c_bool" = yes; then
+ AC_DEFINE([HAVE_C_BOOL], [1],
+ [Define to 1 if bool, true and false work as per C2023.])
+ fi
+
+ AC_CHECK_HEADERS_ONCE([stdbool.h])
+
+ dnl The "zz" puts this toward config.h's end, to avoid potential
+ dnl collisions with other definitions.
+ dnl If 'bool', 'true' and 'false' do not work, arrange for them to work.
+ dnl In C, this means including <stdbool.h> if it is not already included.
+ dnl However, if the preprocessor mistakenly treats 'true' as 0,
+ dnl define it to a bool expression equal to 1; this is needed in
+ dnl Sun C++ 5.11 (Oracle Solaris Studio 12.2, 2010) and older.
+ AH_VERBATIM([zzbool],
+[#ifndef HAVE_C_BOOL
+# if !defined __cplusplus && !defined __bool_true_false_are_defined
+# if HAVE_STDBOOL_H
+# include <stdbool.h>
+# else
+# if defined __SUNPRO_C
+# error "<stdbool.h> is not usable with this configuration. To make it usable, add -D_STDC_C99= to $CC."
+# else
+# error "<stdbool.h> does not exist on this platform. Use gnulib module 'stdbool-c99' instead of gnulib module 'stdbool'."
+# endif
+# endif
+# endif
+# if !true
+# define true (!false)
+# endif
+#endif])
+])
# Code from module stat-time:
# Code from module std-gnu11:
# Code from module stdalign:
+ # Code from module stdbool:
# Code from module stdckdint:
# Code from module stddef:
# Code from module stdint:
gl_STDALIGN_H
gl_CONDITIONAL_HEADER([stdalign.h])
AC_PROG_MKDIR_P
+ gl_C_BOOL
gl_STDDEF_H
gl_STDDEF_H_REQUIRE_DEFAULTS
gl_CONDITIONAL_HEADER([stddef.h])
m4/assert_h.m4
m4/builtin-expect.m4
m4/byteswap.m4
+ m4/c-bool.m4
m4/canonicalize.m4
m4/clock_time.m4
m4/copy-file-range.m4
#endif
/* To help make dependencies clearer elsewhere, this file typically
- does not #include other files. The exceptions are stdbool.h
- because it is unlikely to interfere with configuration and bool is
- such a core part of the C language, and ms-w32.h (DOS_NT
+ does not #include other files. The exception is ms-w32.h (DOS_NT
only) because it historically was included here and changing that
would take some work. */
-#include <stdbool.h>
-
#if defined WINDOWSNT && !defined DEFER_MS_W32_H
# include <ms-w32.h>
#endif
#define DYNLIB_H
#include <attribute.h>
-#include <stdbool.h>
typedef void *dynlib_handle_ptr;
dynlib_handle_ptr dynlib_open (const char *path);
#include "emacs-module.h"
#include <stdarg.h>
-#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
-#ifndef __cplusplus
+#if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 202311 \
+ && !defined __bool_true_false_are_defined && !defined __cplusplus)
#include <stdbool.h>
#endif
#include <time.h>
#include <signal.h>
#include <unistd.h>
-#include <stdbool.h>
#include <c-ctype.h>
#include <c-strcase.h>
#ifndef SYSTHREAD_H
#define SYSTHREAD_H
-#include <stdbool.h>
-
#include <attribute.h>
#ifdef THREADS_ENABLED
#include <errno.h>
#include <limits.h>
-#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>