Skip to content

Commit 6bd850b

Browse files
committed
Include stdbool.h without relying on autoconf check
As reported in <https://bugs.ruby-lang.org/issues/21340>, older autoconf have a AC_HEADER_STDBOOL that's incompatible with C23. Autoconf 2.72 fixed the macro, but also mentions that it's deprecated and all current compilers have this header. Since we require C99 [1] and VS 2015 [2], we might actually be able take this suggestion and include stdbool.h without a check. I want to try this on rubyci.org and will revert if this cause any issues. Not touching AC_HEADER_STDBOOL in configure.ac for now. [1]: https://bugs.ruby-lang.org/issues/15347 [2]: https://bugs.ruby-lang.org/issues/19982
1 parent bf082a3 commit 6bd850b

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

include/ruby/internal/stdbool.h

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,9 @@
3131
# define __bool_true_false_are_defined
3232
# endif
3333

34-
#elif defined(HAVE_STDBOOL_H)
35-
# /* Take stdbool.h definition. */
34+
#else
35+
# /* Take stdbool.h definition. It exists since GCC 3.0 and VS 2015. */
3636
# include <stdbool.h>
37-
38-
#elif !defined(HAVE__BOOL)
39-
typedef unsigned char _Bool;
40-
# /* See also http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2229.htm */
41-
# define bool _Bool
42-
# define true ((_Bool)+1)
43-
# define false ((_Bool)+0)
44-
# define __bool_true_false_are_defined
4537
#endif
4638

4739
#endif /* RBIMPL_STDBOOL_H */

0 commit comments

Comments
 (0)