Commit 1408d5d8 authored by Tom Lane's avatar Tom Lane

Get rid of useless/dangerous redefinition of bool in ECPG.

pgtypeslib_extern.h contained fallback definitions of "bool", "FALSE",
and "TRUE".  The latter two are just plain unused, and have been for
awhile.  The former came into play only if there wasn't a macro
definition of "bool", which is true only if we aren't using <stdbool.h>.
However, it then defined bool as "char"; since commit d26a810e that
conflicts with c.h's desire to use "unsigned char".  We'd missed seeing
any bad effects of that due to accidental header inclusion order choices,
but dddf4cdc exposed that it was problematic.

To fix, let's just get rid of these definitions.  They should not be
needed because everyplace in Postgres should be relying on c.h to
provide a definition for type bool.  (Note that despite its name,
pgtypeslib_extern.h isn't exposed to any outside code; we don't
install it.)

This doesn't fully resolve the issue, because ecpglib.h is doing
similar things, but that seems to require more thought to fix.

Back-patch to v12 where d26a810e came in, to forestall any unpleasant
surprises from future back-patched bug fixes.

Discussion: https://postgr.es/m/CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com
parent 22f6f2c1
...@@ -38,16 +38,4 @@ int pgtypes_fmt_replace(union un_fmt_comb, int, char **, int *); ...@@ -38,16 +38,4 @@ int pgtypes_fmt_replace(union un_fmt_comb, int, char **, int *);
char *pgtypes_alloc(long); char *pgtypes_alloc(long);
char *pgtypes_strdup(const char *); char *pgtypes_strdup(const char *);
#ifndef bool
#define bool char
#endif /* ndef bool */
#ifndef FALSE
#define FALSE 0
#endif /* FALSE */
#ifndef TRUE
#define TRUE 1
#endif /* TRUE */
#endif /* _ECPG_PGTYPESLIB_EXTERN_H */ #endif /* _ECPG_PGTYPESLIB_EXTERN_H */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment