diff options
Diffstat (limited to 'src/interfaces')
| -rw-r--r-- | src/interfaces/ecpg/include/ecpg_config.h.in | 3 | ||||
| -rw-r--r-- | src/interfaces/ecpg/include/ecpglib.h | 38 |
2 files changed, 27 insertions, 14 deletions
diff --git a/src/interfaces/ecpg/include/ecpg_config.h.in b/src/interfaces/ecpg/include/ecpg_config.h.in index c18556130ef..17e93c40dbb 100644 --- a/src/interfaces/ecpg/include/ecpg_config.h.in +++ b/src/interfaces/ecpg/include/ecpg_config.h.in @@ -10,6 +10,9 @@ /* Define to 1 if `long long int' works and is 64 bits. */ #undef HAVE_LONG_LONG_INT_64 +/* Define to 1 to use <stdbool.h> to define type bool. */ +#undef PG_USE_STDBOOL + /* Define to 1 to build client libraries as thread-safe code. * (--enable-thread-safety) */ #undef ENABLE_THREAD_SAFETY diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index de9c76aefc3..c65073f15ac 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -1,6 +1,6 @@ /* - * this is a small part of c.h since we don't want to leak all postgres - * definitions into ecpg programs + * Client-visible declarations for ecpglib + * * src/interfaces/ecpg/include/ecpglib.h */ @@ -8,30 +8,40 @@ #define _ECPGLIB_H #include "libpq-fe.h" +#include "ecpg_config.h" #include "ecpgtype.h" #include "sqlca.h" #include <string.h> +/* + * This is a small extract from c.h since we don't want to leak all postgres + * definitions into ecpg programs; but we need to know what bool is. + */ #ifndef __cplusplus -#ifndef bool -#define bool char -#endif /* ndef bool */ + +#ifdef PG_USE_STDBOOL +#include <stdbool.h> +#else + +/* + * We assume bool has been defined if true and false are. This avoids + * duplicate-typedef errors if this file is included after c.h. + */ +#if !(defined(true) && defined(false)) +typedef unsigned char bool; +#endif #ifndef true #define true ((bool) 1) -#endif /* ndef true */ +#endif + #ifndef false #define false ((bool) 0) -#endif /* ndef false */ -#endif /* not C++ */ +#endif -#ifndef TRUE -#define TRUE 1 -#endif /* TRUE */ +#endif /* not PG_USE_STDBOOL */ +#endif /* not C++ */ -#ifndef FALSE -#define FALSE 0 -#endif /* FALSE */ #ifdef __cplusplus extern "C" |
