Here is a new patch set that picks up the best pieces of the recent discussions: We use stdbool.h if available, use bool8 in the system catalogs, define GinTernaryValue to be the same size as bool, and rewrite the GinNullCategory code to work without casting.
-- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>From 1cc402987b4f296c2ce9138d0e5741a16cae3aca Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Wed, 16 Aug 2017 00:22:32 -0400 Subject: [PATCH v5 1/4] Add bool8 typedef for system catalog structs For system catalog structs, we require that the C bool type is 1 byte in size, the same as the SQL type. But if stdbool.h is used, then this is not guaranteed. To address that, define a separate type bool8 that is guaranteed to be 1 byte, and use that in the system catalog structs. Some tweaking in Catalog.pm ensures that bool is not accidentally used where bool8 should be used. --- src/backend/catalog/Catalog.pm | 2 ++ src/include/c.h | 9 +++++++++ src/include/catalog/pg_aggregate.h | 4 ++-- src/include/catalog/pg_attribute.h | 10 +++++----- src/include/catalog/pg_auth_members.h | 2 +- src/include/catalog/pg_authid.h | 14 +++++++------- src/include/catalog/pg_class.h | 22 +++++++++++----------- src/include/catalog/pg_constraint.h | 10 +++++----- src/include/catalog/pg_conversion.h | 2 +- src/include/catalog/pg_database.h | 4 ++-- src/include/catalog/pg_extension.h | 2 +- src/include/catalog/pg_index.h | 20 ++++++++++---------- src/include/catalog/pg_language.h | 4 ++-- src/include/catalog/pg_opclass.h | 2 +- src/include/catalog/pg_operator.h | 4 ++-- src/include/catalog/pg_pltemplate.h | 4 ++-- src/include/catalog/pg_policy.h | 2 +- src/include/catalog/pg_proc.h | 12 ++++++------ src/include/catalog/pg_publication.h | 8 ++++---- src/include/catalog/pg_rewrite.h | 2 +- src/include/catalog/pg_sequence.h | 2 +- src/include/catalog/pg_statistic.h | 2 +- src/include/catalog/pg_subscription.h | 2 +- src/include/catalog/pg_trigger.h | 6 +++--- src/include/catalog/pg_type.h | 8 ++++---- src/include/commands/sequence.h | 2 +- 26 files changed, 86 insertions(+), 75 deletions(-) diff --git a/src/backend/catalog/Catalog.pm b/src/backend/catalog/Catalog.pm index 80bd9771f1..2602c68867 100644 --- a/src/backend/catalog/Catalog.pm +++ b/src/backend/catalog/Catalog.pm @@ -26,6 +26,8 @@ sub Catalogs # There are a few types which are given one name in the C source, but a # different name at the SQL level. These are enumerated here. my %RENAME_ATTTYPE = ( + 'bool' => 'INVALID', # use bool8 instead + 'bool8' => 'bool', 'int16' => 'int2', 'int32' => 'int4', 'int64' => 'int8', diff --git a/src/include/c.h b/src/include/c.h index 22535a7deb..20c15a0d9d 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -267,6 +267,15 @@ typedef char bool; #endif /* not C++ */ +/* + * bool8 + * + * A bool type that is guaranteed to be 8 bits/1 byte, mainly for use in + * system catalog definitions. (stdbool.h's bool is not 1 byte on all + * platforms.) + */ +typedef char bool8; + /* ---------------------------------------------------------------- * Section 3: standard system types diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h index 13f1bce5af..a8894b9aad 100644 --- a/src/include/catalog/pg_aggregate.h +++ b/src/include/catalog/pg_aggregate.h @@ -65,8 +65,8 @@ CATALOG(pg_aggregate,2600) BKI_WITHOUT_OIDS regproc aggmtransfn; regproc aggminvtransfn; regproc aggmfinalfn; - bool aggfinalextra; - bool aggmfinalextra; + bool8 aggfinalextra; + bool8 aggmfinalextra; char aggfinalmodify; char aggmfinalmodify; Oid aggsortop; diff --git a/src/include/catalog/pg_attribute.h b/src/include/catalog/pg_attribute.h index bcf28e8f04..a2007560ae 100644 --- a/src/include/catalog/pg_attribute.h +++ b/src/include/catalog/pg_attribute.h @@ -104,7 +104,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK * attbyval is a copy of the typbyval field from pg_type for this * attribute. See atttypid comments above. */ - bool attbyval; + bool8 attbyval; /*---------- * attstorage tells for VARLENA attributes, what the heap access @@ -128,16 +128,16 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK char attalign; /* This flag represents the "NOT NULL" constraint */ - bool attnotnull; + bool8 attnotnull; /* Has DEFAULT value or not */ - bool atthasdef; + bool8 atthasdef; /* One of the ATTRIBUTE_IDENTITY_* constants below, or '\0' */ char attidentity; /* Is dropped (ie, logically invisible) or not */ - bool attisdropped; + bool8 attisdropped; /* * This flag specifies whether this column has ever had a local @@ -148,7 +148,7 @@ CATALOG(pg_attribute,1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BK * not dropped by a parent's DROP COLUMN even if this causes the column's * attinhcount to become zero. */ - bool attislocal; + bool8 attislocal; /* Number of times inherited from direct parent relation(s) */ int32 attinhcount; diff --git a/src/include/catalog/pg_auth_members.h b/src/include/catalog/pg_auth_members.h index 6a954fff97..43a8549659 100644 --- a/src/include/catalog/pg_auth_members.h +++ b/src/include/catalog/pg_auth_members.h @@ -34,7 +34,7 @@ CATALOG(pg_auth_members,1261) BKI_SHARED_RELATION BKI_WITHOUT_OIDS BKI_ROWTYPE_O Oid roleid; /* ID of a role */ Oid member; /* ID of a member of that role */ Oid grantor; /* who granted the membership */ - bool admin_option; /* granted with admin option? */ + bool8 admin_option; /* granted with admin option? */ } FormData_pg_auth_members; /* ---------------- diff --git a/src/include/catalog/pg_authid.h b/src/include/catalog/pg_authid.h index 9b6b52c9f9..b44328fe38 100644 --- a/src/include/catalog/pg_authid.h +++ b/src/include/catalog/pg_authid.h @@ -45,13 +45,13 @@ CATALOG(pg_authid,1260) BKI_SHARED_RELATION BKI_ROWTYPE_OID(2842) BKI_SCHEMA_MACRO { NameData rolname; /* name of role */ - bool rolsuper; /* read this field via superuser() only! */ - bool rolinherit; /* inherit privileges from other roles? */ - bool rolcreaterole; /* allowed to create more roles? */ - bool rolcreatedb; /* allowed to create databases? */ - bool rolcanlogin; /* allowed to log in as session user? */ - bool rolreplication; /* role used for streaming replication */ - bool rolbypassrls; /* bypasses row level security? */ + bool8 rolsuper; /* read this field via superuser() only! */ + bool8 rolinherit; /* inherit privileges from other roles? */ + bool8 rolcreaterole; /* allowed to create more roles? */ + bool8 rolcreatedb; /* allowed to create databases? */ + bool8 rolcanlogin; /* allowed to log in as session user? */ + bool8 rolreplication; /* role used for streaming replication */ + bool8 rolbypassrls; /* bypasses row level security? */ int32 rolconnlimit; /* max connections allowed (-1=no limit) */ /* remaining fields may be null; use heap_getattr to read them! */ diff --git a/src/include/catalog/pg_class.h b/src/include/catalog/pg_class.h index b256657bda..8e98c3174d 100644 --- a/src/include/catalog/pg_class.h +++ b/src/include/catalog/pg_class.h @@ -48,8 +48,8 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO int32 relallvisible; /* # of all-visible blocks (not always * up-to-date) */ Oid reltoastrelid; /* OID of toast table; 0 if none */ - bool relhasindex; /* T if has (or has had) any indexes */ - bool relisshared; /* T if shared across databases */ + bool8 relhasindex; /* T if has (or has had) any indexes */ + bool8 relisshared; /* T if shared across databases */ char relpersistence; /* see RELPERSISTENCE_xxx constants below */ char relkind; /* see RELKIND_xxx constants below */ int16 relnatts; /* number of user attributes */ @@ -60,17 +60,17 @@ CATALOG(pg_class,1259) BKI_BOOTSTRAP BKI_ROWTYPE_OID(83) BKI_SCHEMA_MACRO * contain entries with negative attnums for system attributes. */ int16 relchecks; /* # of CHECK constraints for class */ - bool relhasoids; /* T if we generate OIDs for rows of rel */ - bool relhaspkey; /* has (or has had) PRIMARY KEY index */ - bool relhasrules; /* has (or has had) any rules */ - bool relhastriggers; /* has (or has had) any TRIGGERs */ - bool relhassubclass; /* has (or has had) derived classes */ - bool relrowsecurity; /* row security is enabled or not */ - bool relforcerowsecurity; /* row security forced for owners or + bool8 relhasoids; /* T if we generate OIDs for rows of rel */ + bool8 relhaspkey; /* has (or has had) PRIMARY KEY index */ + bool8 relhasrules; /* has (or has had) any rules */ + bool8 relhastriggers; /* has (or has had) any TRIGGERs */ + bool8 relhassubclass; /* has (or has had) derived classes */ + bool8 relrowsecurity; /* row security is enabled or not */ + bool8 relforcerowsecurity; /* row security forced for owners or * not */ - bool relispopulated; /* matview currently holds query results */ + bool8 relispopulated; /* matview currently holds query results */ char relreplident; /* see REPLICA_IDENTITY_xxx constants */ - bool relispartition; /* is relation a partition? */ + bool8 relispartition; /* is relation a partition? */ TransactionId relfrozenxid; /* all Xids < this are frozen in this rel */ TransactionId relminmxid; /* all multixacts in this rel are >= this. * this is really a MultiXactId */ diff --git a/src/include/catalog/pg_constraint.h b/src/include/catalog/pg_constraint.h index ec035d8434..216344e254 100644 --- a/src/include/catalog/pg_constraint.h +++ b/src/include/catalog/pg_constraint.h @@ -42,9 +42,9 @@ CATALOG(pg_constraint,2606) NameData conname; /* name of this constraint */ Oid connamespace; /* OID of namespace containing constraint */ char contype; /* constraint type; see codes below */ - bool condeferrable; /* deferrable constraint? */ - bool condeferred; /* deferred by default? */ - bool convalidated; /* constraint has been validated? */ + bool8 condeferrable; /* deferrable constraint? */ + bool8 condeferred; /* deferred by default? */ + bool8 convalidated; /* constraint has been validated? */ /* * conrelid and conkey are only meaningful if the constraint applies to a @@ -82,13 +82,13 @@ CATALOG(pg_constraint,2606) char confmatchtype; /* foreign key's match type */ /* Has a local definition (hence, do not drop when coninhcount is 0) */ - bool conislocal; + bool8 conislocal; /* Number of times inherited from direct parent relation(s) */ int32 coninhcount; /* Has a local definition and cannot be inherited */ - bool connoinherit; + bool8 connoinherit; #ifdef CATALOG_VARLEN /* variable-length fields start here */ diff --git a/src/include/catalog/pg_conversion.h b/src/include/catalog/pg_conversion.h index 9344585e66..33c61e47cc 100644 --- a/src/include/catalog/pg_conversion.h +++ b/src/include/catalog/pg_conversion.h @@ -45,7 +45,7 @@ CATALOG(pg_conversion,2607) int32 conforencoding; int32 contoencoding; regproc conproc; - bool condefault; + bool8 condefault; } FormData_pg_conversion; /* ---------------- diff --git a/src/include/catalog/pg_database.h b/src/include/catalog/pg_database.h index e7cbca49cf..e470abf88a 100644 --- a/src/include/catalog/pg_database.h +++ b/src/include/catalog/pg_database.h @@ -36,8 +36,8 @@ CATALOG(pg_database,1262) BKI_SHARED_RELATION BKI_ROWTYPE_OID(1248) BKI_SCHEMA_M int32 encoding; /* character encoding */ NameData datcollate; /* LC_COLLATE setting */ NameData datctype; /* LC_CTYPE setting */ - bool datistemplate; /* allowed as CREATE DATABASE template? */ - bool datallowconn; /* new connections allowed? */ + bool8 datistemplate; /* allowed as CREATE DATABASE template? */ + bool8 datallowconn; /* new connections allowed? */ int32 datconnlimit; /* max connections allowed (-1=no limit) */ Oid datlastsysoid; /* highest OID to consider a system OID */ TransactionId datfrozenxid; /* all Xids < this are frozen in this DB */ diff --git a/src/include/catalog/pg_extension.h b/src/include/catalog/pg_extension.h index 2ce575d17e..21e6153d21 100644 --- a/src/include/catalog/pg_extension.h +++ b/src/include/catalog/pg_extension.h @@ -33,7 +33,7 @@ CATALOG(pg_extension,3079) NameData extname; /* extension name */ Oid extowner; /* extension owner */ Oid extnamespace; /* namespace of contained objects */ - bool extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ + bool8 extrelocatable; /* if true, allow ALTER EXTENSION SET SCHEMA */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ /* extversion may never be null, but the others can be. */ diff --git a/src/include/catalog/pg_index.h b/src/include/catalog/pg_index.h index 8505c3be5f..1d21e9800c 100644 --- a/src/include/catalog/pg_index.h +++ b/src/include/catalog/pg_index.h @@ -33,16 +33,16 @@ CATALOG(pg_index,2610) BKI_WITHOUT_OIDS BKI_SCHEMA_MACRO Oid indexrelid; /* OID of the index */ Oid indrelid; /* OID of the relation it indexes */ int16 indnatts; /* number of columns in index */ - bool indisunique; /* is this a unique index? */ - bool indisprimary; /* is this index for primary key? */ - bool indisexclusion; /* is this index for exclusion constraint? */ - bool indimmediate; /* is uniqueness enforced immediately? */ - bool indisclustered; /* is this the index last clustered by? */ - bool indisvalid; /* is this index valid for use by queries? */ - bool indcheckxmin; /* must we wait for xmin to be old? */ - bool indisready; /* is this index ready for inserts? */ - bool indislive; /* is this index alive at all? */ - bool indisreplident; /* is this index the identity for replication? */ + bool8 indisunique; /* is this a unique index? */ + bool8 indisprimary; /* is this index for primary key? */ + bool8 indisexclusion; /* is this index for exclusion constraint? */ + bool8 indimmediate; /* is uniqueness enforced immediately? */ + bool8 indisclustered; /* is this the index last clustered by? */ + bool8 indisvalid; /* is this index valid for use by queries? */ + bool8 indcheckxmin; /* must we wait for xmin to be old? */ + bool8 indisready; /* is this index ready for inserts? */ + bool8 indislive; /* is this index alive at all? */ + bool8 indisreplident; /* is this index the identity for replication? */ /* variable-length fields start here, but we allow direct access to indkey */ int2vector indkey; /* column numbers of indexed cols, or 0 */ diff --git a/src/include/catalog/pg_language.h b/src/include/catalog/pg_language.h index ad244e839b..4c20e66a6c 100644 --- a/src/include/catalog/pg_language.h +++ b/src/include/catalog/pg_language.h @@ -32,8 +32,8 @@ CATALOG(pg_language,2612) { NameData lanname; /* Language name */ Oid lanowner; /* Language's owner */ - bool lanispl; /* Is a procedural language */ - bool lanpltrusted; /* PL is trusted */ + bool8 lanispl; /* Is a procedural language */ + bool8 lanpltrusted; /* PL is trusted */ Oid lanplcallfoid; /* Call handler for PL */ Oid laninline; /* Optional anonymous-block handler function */ Oid lanvalidator; /* Optional validation function */ diff --git a/src/include/catalog/pg_opclass.h b/src/include/catalog/pg_opclass.h index 6aabc7279f..b35181ce74 100644 --- a/src/include/catalog/pg_opclass.h +++ b/src/include/catalog/pg_opclass.h @@ -56,7 +56,7 @@ CATALOG(pg_opclass,2616) Oid opcowner; /* opclass owner */ Oid opcfamily; /* containing operator family */ Oid opcintype; /* type of data indexed by opclass */ - bool opcdefault; /* T if opclass is default for opcintype */ + bool8 opcdefault; /* T if opclass is default for opcintype */ Oid opckeytype; /* type of data in index, or InvalidOid */ } FormData_pg_opclass; diff --git a/src/include/catalog/pg_operator.h b/src/include/catalog/pg_operator.h index ff9b47077b..24c1c72759 100644 --- a/src/include/catalog/pg_operator.h +++ b/src/include/catalog/pg_operator.h @@ -37,8 +37,8 @@ CATALOG(pg_operator,2617) Oid oprnamespace; /* OID of namespace containing this oper */ Oid oprowner; /* operator owner */ char oprkind; /* 'l', 'r', or 'b' */ - bool oprcanmerge; /* can be used in merge join? */ - bool oprcanhash; /* can be used in hash join? */ + bool8 oprcanmerge; /* can be used in merge join? */ + bool8 oprcanhash; /* can be used in hash join? */ Oid oprleft; /* left arg type, or 0 if 'l' oprkind */ Oid oprright; /* right arg type, or 0 if 'r' oprkind */ Oid oprresult; /* result datatype */ diff --git a/src/include/catalog/pg_pltemplate.h b/src/include/catalog/pg_pltemplate.h index fbe71bd0c3..c4d416c686 100644 --- a/src/include/catalog/pg_pltemplate.h +++ b/src/include/catalog/pg_pltemplate.h @@ -31,8 +31,8 @@ CATALOG(pg_pltemplate,1136) BKI_SHARED_RELATION BKI_WITHOUT_OIDS { NameData tmplname; /* name of PL */ - bool tmpltrusted; /* PL is trusted? */ - bool tmpldbacreate; /* PL is installable by db owner? */ + bool8 tmpltrusted; /* PL is trusted? */ + bool8 tmpldbacreate; /* PL is installable by db owner? */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ text tmplhandler BKI_FORCE_NOT_NULL; /* name of call handler diff --git a/src/include/catalog/pg_policy.h b/src/include/catalog/pg_policy.h index 86000737fa..8aa1f2a4d8 100644 --- a/src/include/catalog/pg_policy.h +++ b/src/include/catalog/pg_policy.h @@ -23,7 +23,7 @@ CATALOG(pg_policy,3256) NameData polname; /* Policy name. */ Oid polrelid; /* Oid of the relation with policy. */ char polcmd; /* One of ACL_*_CHR, or '*' for all */ - bool polpermissive; /* restrictive or permissive policy */ + bool8 polpermissive; /* restrictive or permissive policy */ #ifdef CATALOG_VARLEN Oid polroles[1]; /* Roles associated with policy, not-NULL */ diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 830bab37ea..538eea7211 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -43,12 +43,12 @@ CATALOG(pg_proc,1255) BKI_BOOTSTRAP BKI_ROWTYPE_OID(81) BKI_SCHEMA_MACRO float4 prorows; /* estimated # of rows out (if proretset) */ Oid provariadic; /* element type of variadic array, or 0 */ regproc protransform; /* transforms calls to it during planning */ - bool proisagg; /* is it an aggregate? */ - bool proiswindow; /* is it a window function? */ - bool prosecdef; /* security definer */ - bool proleakproof; /* is it a leak-proof function? */ - bool proisstrict; /* strict with respect to NULLs? */ - bool proretset; /* returns a set? */ + bool8 proisagg; /* is it an aggregate? */ + bool8 proiswindow; /* is it a window function? */ + bool8 prosecdef; /* security definer */ + bool8 proleakproof; /* is it a leak-proof function? */ + bool8 proisstrict; /* strict with respect to NULLs? */ + bool8 proretset; /* returns a set? */ char provolatile; /* see PROVOLATILE_ categories below */ char proparallel; /* see PROPARALLEL_ categories below */ int16 pronargs; /* number of arguments */ diff --git a/src/include/catalog/pg_publication.h b/src/include/catalog/pg_publication.h index aa148960cd..19283ecd2e 100644 --- a/src/include/catalog/pg_publication.h +++ b/src/include/catalog/pg_publication.h @@ -38,16 +38,16 @@ CATALOG(pg_publication,6104) * indicates that this is special publication which should encompass all * tables in the database (except for the unlogged and temp ones) */ - bool puballtables; + bool8 puballtables; /* true if inserts are published */ - bool pubinsert; + bool8 pubinsert; /* true if updates are published */ - bool pubupdate; + bool8 pubupdate; /* true if deletes are published */ - bool pubdelete; + bool8 pubdelete; } FormData_pg_publication; diff --git a/src/include/catalog/pg_rewrite.h b/src/include/catalog/pg_rewrite.h index 48b9333a9d..3c71e8e641 100644 --- a/src/include/catalog/pg_rewrite.h +++ b/src/include/catalog/pg_rewrite.h @@ -37,7 +37,7 @@ CATALOG(pg_rewrite,2618) Oid ev_class; char ev_type; char ev_enabled; - bool is_instead; + bool8 is_instead; #ifdef CATALOG_VARLEN /* variable-length fields start here */ pg_node_tree ev_qual; diff --git a/src/include/catalog/pg_sequence.h b/src/include/catalog/pg_sequence.h index 6de54bb665..9b84e16ed1 100644 --- a/src/include/catalog/pg_sequence.h +++ b/src/include/catalog/pg_sequence.h @@ -24,7 +24,7 @@ CATALOG(pg_sequence,2224) BKI_WITHOUT_OIDS int64 seqmax; int64 seqmin; int64 seqcache; - bool seqcycle; + bool8 seqcycle; } FormData_pg_sequence; typedef FormData_pg_sequence *Form_pg_sequence; diff --git a/src/include/catalog/pg_statistic.h b/src/include/catalog/pg_statistic.h index 43128f1928..1ed6387b03 100644 --- a/src/include/catalog/pg_statistic.h +++ b/src/include/catalog/pg_statistic.h @@ -33,7 +33,7 @@ CATALOG(pg_statistic,2619) BKI_WITHOUT_OIDS /* These fields form the unique key for the entry: */ Oid starelid; /* relation containing attribute */ int16 staattnum; /* attribute (column) stats are for */ - bool stainherit; /* true if inheritance children are included */ + bool8 stainherit; /* true if inheritance children are included */ /* the fraction of the column's entries that are NULL: */ float4 stanullfrac; diff --git a/src/include/catalog/pg_subscription.h b/src/include/catalog/pg_subscription.h index 274ff6bc42..032b02e4fb 100644 --- a/src/include/catalog/pg_subscription.h +++ b/src/include/catalog/pg_subscription.h @@ -37,7 +37,7 @@ CATALOG(pg_subscription,6100) BKI_SHARED_RELATION BKI_ROWTYPE_OID(6101) BKI_SCHE Oid subowner; /* Owner of the subscription */ - bool subenabled; /* True if the subscription is enabled (the + bool8 subenabled; /* True if the subscription is enabled (the * worker should be running) */ #ifdef CATALOG_VARLEN /* variable-length fields start here */ diff --git a/src/include/catalog/pg_trigger.h b/src/include/catalog/pg_trigger.h index f413caf34f..0faa1812ab 100644 --- a/src/include/catalog/pg_trigger.h +++ b/src/include/catalog/pg_trigger.h @@ -42,12 +42,12 @@ CATALOG(pg_trigger,2620) * ROW/STATEMENT; see below */ char tgenabled; /* trigger's firing configuration WRT * session_replication_role */ - bool tgisinternal; /* trigger is system-generated */ + bool8 tgisinternal; /* trigger is system-generated */ Oid tgconstrrelid; /* constraint's FROM table, if any */ Oid tgconstrindid; /* constraint's supporting index, if any */ Oid tgconstraint; /* associated pg_constraint entry, if any */ - bool tgdeferrable; /* constraint trigger is deferrable */ - bool tginitdeferred; /* constraint trigger is deferred initially */ + bool8 tgdeferrable; /* constraint trigger is deferrable */ + bool8 tginitdeferred; /* constraint trigger is deferred initially */ int16 tgnargs; /* # of extra arguments in tgargs */ /* diff --git a/src/include/catalog/pg_type.h b/src/include/catalog/pg_type.h index e3551440a0..a41e664449 100644 --- a/src/include/catalog/pg_type.h +++ b/src/include/catalog/pg_type.h @@ -57,7 +57,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO * typbyval can be false even if the length would allow pass-by-value; * this is currently true for type float4, for example. */ - bool typbyval; + bool8 typbyval; /* * typtype is 'b' for a base type, 'c' for a composite type (e.g., a @@ -76,13 +76,13 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO */ char typcategory; /* arbitrary type classification */ - bool typispreferred; /* is type "preferred" within its category? */ + bool8 typispreferred; /* is type "preferred" within its category? */ /* * If typisdefined is false, the entry is only a placeholder (forward * reference). We know the type name, but not yet anything else about it. */ - bool typisdefined; + bool8 typisdefined; char typdelim; /* delimiter for arrays of this type */ @@ -172,7 +172,7 @@ CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO * * Used primarily for domain types. */ - bool typnotnull; + bool8 typnotnull; /* * Domains use typbasetype to show the base (or domain) type that the diff --git a/src/include/commands/sequence.h b/src/include/commands/sequence.h index caab195130..09ad49e214 100644 --- a/src/include/commands/sequence.h +++ b/src/include/commands/sequence.h @@ -26,7 +26,7 @@ typedef struct FormData_pg_sequence_data { int64 last_value; int64 log_cnt; - bool is_called; + bool8 is_called; } FormData_pg_sequence_data; typedef FormData_pg_sequence_data *Form_pg_sequence_data; base-commit: f83040c62a78e784e6e33a6382a55925bfd66634 -- 2.15.1
>From 208ac78dd7eff5fd25b519b417027661ffdb1dda Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Tue, 26 Dec 2017 13:47:18 -0500 Subject: [PATCH v5 2/4] Don't cast between GinNullCategory and bool The original idea was that we could use a isNull-style bool array directly as a GinNullCategory array. However, the existing code already acknowledges that that doesn't really work, because of the possibility that bool as currently defined can have arbitrary bit patterns for true values. So it has to loop through the nullFlags array to set each bool value to an acceptable value. But if we are looping through the whole array anyway, we might as well build a proper GinNullCategory array instead and abandon the type casting. That makes the code much safer in case bool is ever changed to something else. --- src/backend/access/gin/ginscan.c | 19 ++++++++----------- src/backend/access/gin/ginutil.c | 18 ++++++++---------- src/include/access/ginblock.h | 7 +++++-- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/src/backend/access/gin/ginscan.c b/src/backend/access/gin/ginscan.c index 7ceea7a741..77c0c577b5 100644 --- a/src/backend/access/gin/ginscan.c +++ b/src/backend/access/gin/ginscan.c @@ -295,6 +295,7 @@ ginNewScanKey(IndexScanDesc scan) bool *partial_matches = NULL; Pointer *extra_data = NULL; bool *nullFlags = NULL; + GinNullCategory *categories; int32 searchMode = GIN_SEARCH_MODE_DEFAULT; /* @@ -346,15 +347,12 @@ ginNewScanKey(IndexScanDesc scan) } /* - * If the extractQueryFn didn't create a nullFlags array, create one, - * assuming that everything's non-null. Otherwise, run through the - * array and make sure each value is exactly 0 or 1; this ensures - * binary compatibility with the GinNullCategory representation. While - * at it, detect whether any null keys are present. + * Create GinNullCategory representation. If the extractQueryFn + * didn't create a nullFlags array, we assume everything is non-null. + * While at it, detect whether any null keys are present. */ - if (nullFlags == NULL) - nullFlags = (bool *) palloc0(nQueryValues * sizeof(bool)); - else + categories = (GinNullCategory *) palloc0(nQueryValues * sizeof(GinNullCategory)); + if (nullFlags) { int32 j; @@ -362,17 +360,16 @@ ginNewScanKey(IndexScanDesc scan) { if (nullFlags[j]) { - nullFlags[j] = true; /* not any other nonzero value */ + categories[j] = GIN_CAT_NULL_KEY; hasNullQuery = true; } } } - /* now we can use the nullFlags as category codes */ ginFillScanKey(so, skey->sk_attno, skey->sk_strategy, searchMode, skey->sk_argument, nQueryValues, - queryValues, (GinNullCategory *) nullFlags, + queryValues, categories, partial_matches, extra_data); } diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index d9c6483437..41d4b4fb6f 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -529,19 +529,10 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum, /* * If the extractValueFn didn't create a nullFlags array, create one, - * assuming that everything's non-null. Otherwise, run through the array - * and make sure each value is exactly 0 or 1; this ensures binary - * compatibility with the GinNullCategory representation. + * assuming that everything's non-null. */ if (nullFlags == NULL) nullFlags = (bool *) palloc0(*nentries * sizeof(bool)); - else - { - for (i = 0; i < *nentries; i++) - nullFlags[i] = (nullFlags[i] ? true : false); - } - /* now we can use the nullFlags as category codes */ - *categories = (GinNullCategory *) nullFlags; /* * If there's more than one key, sort and unique-ify. @@ -600,6 +591,13 @@ ginExtractEntries(GinState *ginstate, OffsetNumber attnum, pfree(keydata); } + /* + * Create GinNullCategory representation from nullFlags. + */ + *categories = (GinNullCategory *) palloc0(*nentries * sizeof(GinNullCategory)); + for (i = 0; i < *nentries; i++) + (*categories)[i] = (nullFlags[i] ? GIN_CAT_NULL_KEY : GIN_CAT_NORM_KEY); + return entries; } diff --git a/src/include/access/ginblock.h b/src/include/access/ginblock.h index 114370c7d7..c3af3f0380 100644 --- a/src/include/access/ginblock.h +++ b/src/include/access/ginblock.h @@ -188,8 +188,11 @@ typedef struct /* * Category codes to distinguish placeholder nulls from ordinary NULL keys. - * Note that the datatype size and the first two code values are chosen to be - * compatible with the usual usage of bool isNull flags. + * + * The first two code values were chosen to be compatible with the usual usage + * of bool isNull flags. However, casting between bool and GinNullCategory is + * risky because of the possibility of different bit patterns and type sizes, + * so it is no longer done. * * GIN_CAT_EMPTY_QUERY is never stored in the index; and notice that it is * chosen to sort before not after regular key values. -- 2.15.1
>From ba713e6c1d85f59b421630c4698e1558fe323ed2 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Wed, 16 Aug 2017 00:22:32 -0400 Subject: [PATCH v5 3/4] Make casting between bool and GinTernaryValue more robust These two types are both defined as char and are supposed to be castable to each other. But when stdbool.h is used, this is not guaranteed. So add provisions for different sizes of bool and define GinTernaryValue accordingly. --- src/backend/utils/adt/tsginidx.c | 2 +- src/include/access/gin.h | 8 +++++++- src/include/c.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/tsginidx.c b/src/backend/utils/adt/tsginidx.c index aba456ed88..fa792b84dc 100644 --- a/src/backend/utils/adt/tsginidx.c +++ b/src/backend/utils/adt/tsginidx.c @@ -309,7 +309,7 @@ gin_tsquery_consistent(PG_FUNCTION_ARGS) * query. */ gcv.first_item = GETQUERY(query); - gcv.check = check; + gcv.check = (GinTernaryValue *) check; gcv.map_item_operand = (int *) (extra_data[0]); gcv.need_recheck = recheck; diff --git a/src/include/access/gin.h b/src/include/access/gin.h index ec83058095..fd4880a7f7 100644 --- a/src/include/access/gin.h +++ b/src/include/access/gin.h @@ -51,10 +51,16 @@ typedef struct GinStatsData /* * A ternary value used by tri-consistent functions. * - * For convenience, this is compatible with booleans. A boolean can be + * For convenience, this is compatible with bools. A bool can be * safely cast to a GinTernaryValue. */ +#if SIZEOF_BOOL == 1 typedef char GinTernaryValue; +#elif SIZEOF_BOOL == 4 +typedef int GinTernaryValue; +#else +#error unsupported SIZEOF_BOOL +#endif #define GIN_FALSE 0 /* item is not present / does not match */ #define GIN_TRUE 1 /* item is present / matches */ diff --git a/src/include/c.h b/src/include/c.h index 20c15a0d9d..1d656e37d5 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -255,6 +255,7 @@ #ifndef bool typedef char bool; +#define SIZEOF_BOOL 1 #endif #ifndef true -- 2.15.1
>From c50289689280adc8e03ad6e963eed1840e1b7a94 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut <pete...@gmx.net> Date: Wed, 16 Aug 2017 00:22:32 -0400 Subject: [PATCH v5 4/4] Use stdbool.h if available While we could do without this, extension code and third-party headers are increasingly pulling this in, creating possible complications. One, bool defined in stdbool.h is not necessarily one byte in size. Two, it can only contain values 0 or 1 on output. So having multiple definitions of bool in play depending on include file order could create a mess. So we just get on board with this and use stdbool.h always if available. As a benefit, some recent compilers can give some better warnings if the official bool type is used. --- configure | 213 ++++++++++++++++++++++++++++++++++++--------- configure.in | 7 ++ src/include/c.h | 10 ++- src/include/pg_config.h.in | 9 ++ src/pl/plperl/plperl.h | 10 +-- 5 files changed, 202 insertions(+), 47 deletions(-) diff --git a/configure b/configure index d9b7b8d7ec..36f5550720 100755 --- a/configure +++ b/configure @@ -1996,116 +1996,116 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_func -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else + eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$5 +$4 int main () { -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; +if (sizeof ($2)) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$5 +$4 int main () { -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; +if (sizeof (($2))) + return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" + else - eval "$4=no" + eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$4 +eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_member +} # ac_fn_c_check_type -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else - eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 +$5 int main () { -if (sizeof ($2)) - return 0; +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -$4 +$5 int main () { -if (sizeof (($2))) - return 0; +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - + eval "$4=yes" else - eval "$3=yes" + eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -eval ac_res=\$$3 +eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_type +} # ac_fn_c_check_member # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- @@ -10683,6 +10683,100 @@ fi ## Header files ## +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; } +if ${ac_cv_header_stdbool_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include <stdbool.h> + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { _Bool s: 1; _Bool t; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(_Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (_Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + _Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html + */ + _Bool q = true; + _Bool *pq = &q; + +int +main () +{ + + bool e = &s; + *pq |= q; + *pq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdbool_h=yes +else + ac_cv_header_stdbool_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +$as_echo "$ac_cv_header_stdbool_h" >&6; } + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE__BOOL 1 +_ACEOF + + +fi + + +if test $ac_cv_header_stdbool_h = yes; then + +$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h + +fi + + for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -12861,6 +12955,43 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then as_fn_error $? "Large file support is not enabled. Segment size cannot be larger than 1GB." "$LINENO" 5 fi +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of bool" >&5 +$as_echo_n "checking size of bool... " >&6; } +if ${ac_cv_sizeof_bool+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (bool))" "ac_cv_sizeof_bool" "#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#endif +"; then : + +else + if test "$ac_cv_type_bool" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (bool) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_bool=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_bool" >&5 +$as_echo "$ac_cv_sizeof_bool" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_BOOL $ac_cv_sizeof_bool +_ACEOF + + + ## ## Functions, global variables diff --git a/configure.in b/configure.in index 5245899109..fd03711176 100644 --- a/configure.in +++ b/configure.in @@ -1149,6 +1149,8 @@ AC_SUBST(UUID_LIBS) ## Header files ## +AC_HEADER_STDBOOL + AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/ipc.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h]) # On BSD, test for net/if.h will fail unless sys/socket.h @@ -1407,6 +1409,11 @@ if test "$ac_cv_sizeof_off_t" -lt 8 -a "$segsize" != "1"; then AC_MSG_ERROR([Large file support is not enabled. Segment size cannot be larger than 1GB.]) fi +AC_CHECK_SIZEOF([bool], [], +[#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#endif]) + ## ## Functions, global variables diff --git a/src/include/c.h b/src/include/c.h index 1d656e37d5..e9cf1a7ee4 100644 --- a/src/include/c.h +++ b/src/include/c.h @@ -247,14 +247,20 @@ * bool * Boolean value, either true or false. * - * XXX for C++ compilers, we assume the compiler has a compatible + * Use stdbool.h if available, to ensure best compatibility with third-party + * libraries. For C++ compilers, we assume the compiler has a compatible * built-in definition of bool. */ #ifndef __cplusplus +#ifdef HAVE_STDBOOL_H +#include <stdbool.h> +#else + #ifndef bool typedef char bool; +#undef SIZEOF_BOOL #define SIZEOF_BOOL 1 #endif @@ -266,6 +272,8 @@ typedef char bool; #define false ((bool) 0) #endif +#endif /* not HAVE_STDBOOL_H */ + #endif /* not C++ */ /* diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 0aa6be4666..b7d00d4164 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -479,6 +479,9 @@ /* Define to 1 if you have the `SSL_get_current_compression' function. */ #undef HAVE_SSL_GET_CURRENT_COMPRESSION +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H @@ -678,6 +681,9 @@ /* Define to 1 if you have the <winldap.h> header file. */ #undef HAVE_WINLDAP_H +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + /* Define to 1 if your compiler understands __builtin_bswap16. */ #undef HAVE__BUILTIN_BSWAP16 @@ -787,6 +793,9 @@ RELSEG_SIZE requires an initdb. */ #undef RELSEG_SIZE +/* The size of `bool', as computed by sizeof. */ +#undef SIZEOF_BOOL + /* The size of `long', as computed by sizeof. */ #undef SIZEOF_LONG diff --git a/src/pl/plperl/plperl.h b/src/pl/plperl/plperl.h index aac95f8d2c..d8030398de 100644 --- a/src/pl/plperl/plperl.h +++ b/src/pl/plperl/plperl.h @@ -50,6 +50,11 @@ #define __inline__ inline #endif +/* + * Prevent perl from redefining "bool". + */ +#define HAS_BOOL 1 + /* * Get the basic Perl API. We use PERL_NO_GET_CONTEXT mode so that our code @@ -91,11 +96,6 @@ #define NEED_sv_2pv_flags #include "ppport.h" -/* perl may have a different width of "bool", don't buy it */ -#ifdef bool -#undef bool -#endif - /* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */ #ifndef HeUTF8 #define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \ -- 2.15.1