Skip to content

Commit

Permalink
Merge pull request #605 from ruby/fix-compiler-error-c23
Browse files Browse the repository at this point in the history
Fix compilation error with C23
  • Loading branch information
hsbt authored Oct 8, 2024
2 parents d9c6fdc + df35321 commit dbc2d64
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions ext/json/ext/generator/generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@

#include "ruby.h"

#ifdef HAVE_STDBOOL_H
#include <stdbool.h>
#else
/* This is the fallback definition from Ruby 3.0.5. */
typedef unsigned char _Bool
#define bool _Bool
/* This is the fallback definition from Ruby 3.4 */
#ifndef RBIMPL_STDBOOL_H
#if defined(__cplusplus)
# if defined(HAVE_STDBOOL_H) && (__cplusplus >= 201103L)
# include <cstdbool>
# endif
#elif defined(HAVE_STDBOOL_H)
# include <stdbool.h>
#elif !defined(HAVE__BOOL)
typedef unsigned char _Bool;
# define bool _Bool
# define true ((_Bool)+1)
# define false ((_Bool)+0)
# define __bool_true_false_are_defined
#endif
#endif

#ifdef HAVE_RUBY_RE_H
Expand Down

0 comments on commit dbc2d64

Please sign in to comment.