Support C23 projects

Don't define true/false/bool when r3 is used by C23 projects
since C23 already has a bool type and predefined constants.
This commit is contained in:
Björn Svensson 2023-10-02 09:48:47 +02:00
parent 58d8b0c028
commit 9168f7e4d4
3 changed files with 4 additions and 1 deletions

View file

@ -12,6 +12,7 @@
#include <string.h> #include <string.h>
#include <pcre.h> #include <pcre.h>
#if __STDC_VERSION__ <= 201710L
#ifdef HAVE_STDBOOL_H #ifdef HAVE_STDBOOL_H
# include <stdbool.h> # include <stdbool.h>
#elif !defined(bool) && !defined(__cplusplus) #elif !defined(bool) && !defined(__cplusplus)
@ -20,6 +21,7 @@ typedef unsigned char bool;
# define false 0 # define false 0
# define true 1 # define true 1
#endif #endif
#endif
#include "str_array.h" #include "str_array.h"
#include "r3_slug.h" #include "r3_slug.h"

View file

@ -10,6 +10,7 @@
#include "memory.h" #include "memory.h"
#if __STDC_VERSION__ <= 201710L
#ifdef HAVE_STDBOOL_H #ifdef HAVE_STDBOOL_H
# include <stdbool.h> # include <stdbool.h>
#elif !defined(bool) && !defined(__cplusplus) #elif !defined(bool) && !defined(__cplusplus)
@ -18,6 +19,7 @@ typedef unsigned char bool;
# define false 0 # define false 0
# define true 1 # define true 1
#endif #endif
#endif
typedef struct _str_array { typedef struct _str_array {
R3_VECTOR(r3_iovec_t) slugs; R3_VECTOR(r3_iovec_t) slugs;

View file

@ -10,7 +10,6 @@
#include <string.h> #include <string.h>
#include <pcre.h> #include <pcre.h>
#include <assert.h> #include <assert.h>
#include <stdbool.h>
#include "r3.h" #include "r3.h"