When available, use <stdbool.h> for boolean types
This commit is contained in:
parent
7d853cc3b1
commit
3775dca27c
@ -20,6 +20,9 @@ set(ALL_SRC_FILES ${ALL_SRC_FILES})
|
|||||||
# Have <stdint.h> ?
|
# Have <stdint.h> ?
|
||||||
check_include_files(stdint.h GMIO_HAVE_STDINT_H)
|
check_include_files(stdint.h GMIO_HAVE_STDINT_H)
|
||||||
|
|
||||||
|
# Have <stdbool.h> ?
|
||||||
|
check_include_files(stdbool.h GMIO_HAVE_STDBOOL_H)
|
||||||
|
|
||||||
# Have strtof() ?
|
# Have strtof() ?
|
||||||
if(NOT BUILD_STRICT_C90)
|
if(NOT BUILD_STRICT_C90)
|
||||||
check_function_exists(strtof GMIO_HAVE_STRTOF_FUNC)
|
check_function_exists(strtof GMIO_HAVE_STRTOF_FUNC)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#define GMIO_CONFIG_H_CMAKE
|
#define GMIO_CONFIG_H_CMAKE
|
||||||
|
|
||||||
#cmakedefine GMIO_HAVE_STDINT_H
|
#cmakedefine GMIO_HAVE_STDINT_H
|
||||||
|
#cmakedefine GMIO_HAVE_STDBOOL_H
|
||||||
#cmakedefine GMIO_HAVE_STRTOF_FUNC
|
#cmakedefine GMIO_HAVE_STRTOF_FUNC
|
||||||
|
|
||||||
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC
|
#cmakedefine GMIO_HAVE_GCC_BUILTIN_BSWAP16_FUNC
|
||||||
|
@ -47,6 +47,16 @@ typedef unsigned long long uint64_t;
|
|||||||
|
|
||||||
#endif /* GMIO_USE_STDINT_H */
|
#endif /* GMIO_USE_STDINT_H */
|
||||||
|
|
||||||
|
#ifdef GMIO_HAVE_STDBOOL_H
|
||||||
|
# include <stdbool.h>
|
||||||
|
|
||||||
|
/*! Typedef for boolean type */
|
||||||
|
typedef bool gmio_bool_t;
|
||||||
|
|
||||||
|
#define GMIO_FALSE false
|
||||||
|
#define GMIO_TRUE true
|
||||||
|
|
||||||
|
#else
|
||||||
/*! Typedef for boolean type */
|
/*! Typedef for boolean type */
|
||||||
typedef int gmio_bool_t;
|
typedef int gmio_bool_t;
|
||||||
|
|
||||||
@ -57,6 +67,8 @@ enum gmio_bool_value
|
|||||||
GMIO_TRUE = 1
|
GMIO_TRUE = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif /* GMIO_HAVE_STDBOOL_H */
|
||||||
|
|
||||||
/*! Typedef for 32bit real type (float) */
|
/*! Typedef for 32bit real type (float) */
|
||||||
typedef float gmio_real32_t;
|
typedef float gmio_real32_t;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user