ICU bool problem - Mailing list pgsql-hackers

From Peter Eisentraut
Subject ICU bool problem
Date
Msg-id 28588e5a-c204-0361-01f1-a1ee1b590233@enterprisedb.com
Whole thread Raw
Responses Re: ICU bool problem
List pgsql-hackers
You might find that ICU 69 (pretty new, see 
http://site.icu-project.org/download/69) will cause compile failures 
with PG 10 (pretty old).  ICU 69 has switched to using stdbool.h, which 
conflicts with the home-made definitions that we used until PG10. 
Compile errors look like this:

pg_collation.c:47:1: error: conflicting types for 'CollationCreate'
    47 | CollationCreate(const char *collname, Oid collnamespace,
       | ^~~~~~~~~~~~~~~
In file included from pg_collation.c:25:
../../../src/include/catalog/pg_collation_fn.h:17:12: note: previous 
declaration of 'CollationCreate' was here
    17 | extern Oid CollationCreate(const char *collname, Oid collnamespace,
       |            ^~~~~~~~~~~~~~~
pg_collation.c: In function 'CollationCreate':
pg_collation.c:171:41: warning: passing argument 3 of 'heap_form_tuple' 
from incompatible pointer type [-Wincompatible-pointer-types]
   171 |  tup = heap_form_tuple(tupDesc, values, nulls);
       |                                         ^~~~~
       |                                         |
       |                                         _Bool *
In file included from pg_collation.c:19:
../../../src/include/access/htup_details.h:802:26: note: expected 'bool 
*' {aka 'char *'} but argument is of type '_Bool *'
   802 |     Datum *values, bool *isnull);
       |                    ~~~~~~^~~~~~

The fix is like what we used to use for plperl back then:

diff --git a/src/include/utils/pg_locale.h b/src/include/utils/pg_locale.h
index f3e04d4d8c..499ada2b69 100644
--- a/src/include/utils/pg_locale.h
+++ b/src/include/utils/pg_locale.h
@@ -17,6 +17,9 @@
  #endif
  #ifdef USE_ICU
  #include <unicode/ucol.h>
+#ifdef bool
+#undef bool
+#endif
  #endif

  #include "utils/guc.h"

I'll prepare a full patch in a bit.



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Move pg_attribute.attcompression to earlier in struct for reduced size?
Next
From: Bruce Momjian
Date:
Subject: Re: ICU bool problem