forked from github/server
use bool type where it's available
when using gcc, compile as C99
This commit is contained in:
parent
413edd9be6
commit
7359eea184
|
@ -3,6 +3,7 @@ project (eressea C)
|
|||
|
||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCC)
|
||||
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
||||
|
|
|
@ -246,21 +246,8 @@ extern char *strdup(const char *s);
|
|||
# define unused(a) (a)
|
||||
#endif /* ghs || __GNUC__ || ..... */
|
||||
|
||||
/**** ****
|
||||
** The Eressea boolean type **
|
||||
**** ****/
|
||||
#if defined(BOOLEAN)
|
||||
# define boolean BOOLEAN
|
||||
#else
|
||||
typedef int boolean; /* not bool! wrong size. */
|
||||
#endif
|
||||
#ifndef __cplusplus
|
||||
# define false ((boolean)0)
|
||||
# define true ((boolean)!false)
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#include "util/bool.h"
|
||||
typedef bool boolean;
|
||||
|
||||
#ifndef INLINE_FUNCTION
|
||||
# define INLINE_FUNCTION
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
#if HAVE_STDBOOL_H
|
||||
# include <stdbool.h>
|
||||
#else
|
||||
# if ! HAVE__BOOL
|
||||
# ifdef __cplusplus
|
||||
typedef bool _Bool;
|
||||
# else
|
||||
typedef unsigned char _Bool;
|
||||
# endif
|
||||
# endif
|
||||
# define bool _Bool
|
||||
# define false 0
|
||||
# define true 1
|
||||
# define __bool_true_false_are_defined 1
|
||||
#endif
|
Loading…
Reference in New Issue