define bool in pgtypeslib_extern.h - Mailing list pgsql-hackers

From Amit Kapila
Subject define bool in pgtypeslib_extern.h
Date
Msg-id CAA4eK1LmaKO7Du9M9Lo=kxGU8sB6aL8fa3sF6z6d5yYYVe3BuQ@mail.gmail.com
Whole thread Raw
Responses Re: define bool in pgtypeslib_extern.h
List pgsql-hackers
Today, I committed a patch (dddf4cdc) to reorder some of the file
header inclusions and buildfarm members prairiedog and locust failed
as a result of that.  The reason turns out to be that we have defined
a bool in pgtypeslib_extern.h and that definition is different from
what we define in c.h.

c.h defines it as:
#ifndef bool
typedef unsigned char bool;
#endif

pgtypeslib_extern.h defines it as:
#ifndef bool
#define bool char
#endif

Prior to dddf4cdc,  pgtypeslib_extern.h was included as a first header
before any usage of bool, but commit moves it after dt.h in file
dt_common.c.  Now, it seems like dt.h was using a version of bool as
defined in c.h and dt_common.c uses as defined by pgtypeslib_extern.h
which leads to some compilation errors as below:

dt_common.c:672: error: conflicting types for 'EncodeDateOnly'
dt.h:321: error: previous declaration of 'EncodeDateOnly' was here
dt_common.c:756: error: conflicting types for 'EncodeDateTime'
dt.h:316: error: previous declaration of 'EncodeDateTime' was here
dt_common.c:1783: error: conflicting types for 'DecodeDateTime'
dt.h:324: error: previous declaration of 'DecodeDateTime' was here
make[4]: *** [dt_common.o] Error 1

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.

Thoughts?

Note - For the time being, I have changed the order of file inclusions
(c114229ca2) in dt_common.c as it was before so that the buildfarm
becomes green again.

[1] - https://www.postgresql.org/message-id/87h83xmg4m.fsf%40news-spur.riddles.org.uk

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Victor Spirin
Date:
Subject: Re: psql tab-complete
Next
From: Surafel Temesgen
Date:
Subject: Re: WIP: System Versioned Temporal Table