Re: define bool in pgtypeslib_extern.h
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Andrew Gierth <andrew@tao11.riddles.org.uk>
Date: 2019-10-26T03:21:14Z
Lists: pgsql-hackers
On Fri, Oct 25, 2019 at 9:55 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > I wrote: > > Amit Kapila <amit.kapila16@gmail.com> writes: > >> As suggested by Andrew Gierth [1], I think we can remove the define in > >> pgtypeslib_extern.h as it doesn't seem to be exposed. > > > Yeah, it's not good that that results in a header ordering dependency, > > and it doesn't seem like a good idea for pgtypeslib_extern.h to be > > messing with the issue at all. > > If you like, I can experiment with that locally on prairiedog's host > > before we make the buildfarm jump through hoops. > > I checked that that works and fixes the immediate problem, so I pushed > it. > Thank you. > However, we're not out of the woods, because lookee here in > ecpglib.h: > > #ifndef __cplusplus > #ifndef bool > #define bool char > #endif /* ndef bool */ > > #ifndef true > #define true ((bool) 1) > #endif /* ndef true */ > #ifndef false > #define false ((bool) 0) > #endif /* ndef false */ > #endif /* not C++ */ > > #ifndef TRUE > #define TRUE 1 > #endif /* TRUE */ > > #ifndef FALSE > #define FALSE 0 > #endif /* FALSE */ > > This stuff *is* exposed to client programs, so it's not clear how > painless it'd be to monkey around with it. And it is used, further > down in the same file, so we can't fix it just by deleting it. > Nor can we import c.h to get the "real" definition from that. > > I'm more than slightly surprised that we haven't already seen > problems due to this conflicting with d26a810eb. > I think it is because it never gets any imports from c.h. It instead uses postgres_ext.h. If we want to fix this, the simplest thing that comes to mind is to change the definition of bool in ecpglib.h and probes.d to match with c.h. These files contain exposed interfaces, so the change can impact clients, but not sure what else we can do here. I have also tried to think about moving bool definition to postgres_ext.h, but I think that won't be straightforward. OTOH, if you think that might be worth investigating, I can spend some more time to see if we can do that way. -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
Commits
-
Fix ecpglib.h to declare bool consistently with c.h.
- 7a0574b50ee9 13.0 landed
-
Move declaration of ecpg_gettext() to a saner place.
- c8cb98ec41f0 13.0 landed
- baa483984fde 9.6.16 landed
- b705d639146c 9.5.20 landed
- b20233aac743 9.4.25 landed
- 89f56fc223f9 11.6 landed
- 831ca9513c59 10.11 landed
- 101654987344 12.1 landed
-
Sync our DTrace infrastructure with c.h's definition of type bool.
- d4d0cd6ee23e 12.1 landed
- ff43b3e88ece 13.0 landed
-
Get rid of useless/dangerous redefinition of bool in ECPG.
- 4a61aa4a945f 12.1 landed
- 1408d5d86992 13.0 landed