From 21f7512bb37068e6a8f72d87d4cf31602ce78d9a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 5 Dec 2020 11:45:04 +0100 Subject: [PATCH] Change definitions of bitmap flags to bit-shifting style Change definitions like #define FOO 0x01 #define BAR 0x02 to #define FOO (1 << 0) #define BAR (1 << 1) etc. Both styles are currently in use, but the latter style seems more readable and easier to update. This change only addresses bitmaps used in memory (e.g., for parsing or specific function APIs), where the actual bits don't really matter. Bits that might go on disk weren't touched. There, defining the bits in a more concrete way seems better. --- src/backend/commands/tablecmds.c | 14 +++--- src/backend/optimizer/plan/createplan.c | 8 ++-- src/backend/optimizer/util/clauses.c | 2 +- src/backend/parser/gram.y | 12 ++--- src/backend/postmaster/postmaster.c | 10 ++--- src/backend/regex/regc_pg_locale.c | 16 +++---- src/backend/storage/buffer/bufmgr.c | 4 +- src/backend/utils/adt/formatting.c | 16 +++---- src/backend/utils/adt/jsonfuncs.c | 10 ++--- src/backend/utils/adt/ruleutils.c | 6 +-- src/backend/utils/adt/tsvector_op.c | 6 +-- src/backend/utils/adt/varlena.c | 2 +- src/backend/utils/cache/typcache.c | 42 +++++++++--------- src/bin/pg_dump/pg_backup_archiver.h | 6 +-- src/include/access/nbtree.h | 4 +- src/include/access/skey.h | 18 ++++---- src/include/access/toast_helper.h | 12 ++--- src/include/catalog/dependency.h | 14 +++--- src/include/catalog/heap.h | 6 +-- src/include/catalog/index.h | 10 ++--- src/include/commands/event_trigger.h | 6 +-- src/include/common/fe_memutils.h | 8 ++-- src/include/executor/executor.h | 12 ++--- src/include/foreign/foreign.h | 4 +- src/include/miscadmin.h | 6 +-- src/include/nodes/extensible.h | 4 +- src/include/nodes/nodeFuncs.h | 22 ++++----- src/include/nodes/nodes.h | 8 ++-- src/include/nodes/params.h | 2 +- src/include/nodes/parsenodes.h | 54 +++++++++++------------ src/include/nodes/pathnodes.h | 6 +-- src/include/optimizer/optimizer.h | 16 +++---- src/include/replication/reorderbuffer.h | 14 +++--- src/include/storage/dsm.h | 2 +- src/include/storage/predicate_internals.h | 24 +++++----- src/include/storage/proc.h | 16 +++---- src/include/storage/reinit.h | 4 +- src/include/tcop/utility.h | 6 +-- src/include/tsearch/ts_public.h | 6 +-- src/include/utils/builtins.h | 8 ++-- src/include/utils/dsa.h | 6 +-- src/include/utils/expandedrecord.h | 16 +++---- src/include/utils/guc_tables.h | 6 +-- src/include/utils/hsearch.h | 26 +++++------ src/include/utils/lsyscache.h | 4 +- src/include/utils/palloc.h | 6 +-- src/include/utils/regproc.h | 4 +- src/include/utils/sharedtuplestore.h | 2 +- src/include/utils/typcache.h | 32 +++++++------- src/test/isolation/isolationtester.c | 4 +- 50 files changed, 276 insertions(+), 276 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 46f1637e77..89fd3bf776 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -289,13 +289,13 @@ struct DropRelationCallbackState }; /* Alter table target-type flags for ATSimplePermissions */ -#define ATT_TABLE 0x0001 -#define ATT_VIEW 0x0002 -#define ATT_MATVIEW 0x0004 -#define ATT_INDEX 0x0008 -#define ATT_COMPOSITE_TYPE 0x0010 -#define ATT_FOREIGN_TABLE 0x0020 -#define ATT_PARTITIONED_INDEX 0x0040 +#define ATT_TABLE (1 << 0) +#define ATT_VIEW (1 << 1) +#define ATT_MATVIEW (1 << 2) +#define ATT_INDEX (1 << 3) +#define ATT_COMPOSITE_TYPE (1 << 4) +#define ATT_FOREIGN_TABLE (1 << 5) +#define ATT_PARTITIONED_INDEX (1 << 6) /* * Partition tables are expected to be dropped when the parent partitioned diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index 40abe6f9f6..396f3baac9 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -65,10 +65,10 @@ * CP_IGNORE_TLIST specifies that the caller plans to replace the targetlist, * and therefore it doesn't matter a bit what target list gets generated. */ -#define CP_EXACT_TLIST 0x0001 /* Plan must return specified tlist */ -#define CP_SMALL_TLIST 0x0002 /* Prefer narrower tlists */ -#define CP_LABEL_TLIST 0x0004 /* tlist must contain sortgrouprefs */ -#define CP_IGNORE_TLIST 0x0008 /* caller will replace tlist */ +#define CP_EXACT_TLIST (1 << 0) /* Plan must return specified tlist */ +#define CP_SMALL_TLIST (1 << 1) /* Prefer narrower tlists */ +#define CP_LABEL_TLIST (1 << 2) /* tlist must contain sortgrouprefs */ +#define CP_IGNORE_TLIST (1 << 3) /* caller will replace tlist */ static Plan *create_plan_recurse(PlannerInfo *root, Path *best_path, diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 587d494c34..8f4665ca9a 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -993,7 +993,7 @@ contain_context_dependent_node(Node *clause) return contain_context_dependent_node_walker(clause, &flags); } -#define CCDN_CASETESTEXPR_OK 0x0001 /* CaseTestExpr okay here? */ +#define CCDN_CASETESTEXPR_OK (1 << 0) /* CaseTestExpr okay here? */ static bool contain_context_dependent_node_walker(Node *node, int *flags) diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index ecff4cd2ac..9a350c7fcf 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -136,12 +136,12 @@ typedef struct SelectLimit } SelectLimit; /* ConstraintAttributeSpec yields an integer bitmask of these flags: */ -#define CAS_NOT_DEFERRABLE 0x01 -#define CAS_DEFERRABLE 0x02 -#define CAS_INITIALLY_IMMEDIATE 0x04 -#define CAS_INITIALLY_DEFERRED 0x08 -#define CAS_NOT_VALID 0x10 -#define CAS_NO_INHERIT 0x20 +#define CAS_NOT_DEFERRABLE (1 << 0) +#define CAS_DEFERRABLE (1 << 1) +#define CAS_INITIALLY_IMMEDIATE (1 << 2) +#define CAS_INITIALLY_DEFERRED (1 << 3) +#define CAS_NOT_VALID (1 << 4) +#define CAS_NO_INHERIT (1 << 5) #define parser_yyerror(msg) scanner_yyerror(msg, yyscanner) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index 5d09822c81..fa19d6f48d 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -142,11 +142,11 @@ * struct bkend, these are OR-able request flag bits for SignalSomeChildren() * and CountChildren(). */ -#define BACKEND_TYPE_NORMAL 0x0001 /* normal backend */ -#define BACKEND_TYPE_AUTOVAC 0x0002 /* autovacuum worker process */ -#define BACKEND_TYPE_WALSND 0x0004 /* walsender process */ -#define BACKEND_TYPE_BGWORKER 0x0008 /* bgworker process */ -#define BACKEND_TYPE_ALL 0x000F /* OR of all the above */ +#define BACKEND_TYPE_NORMAL (1 << 0) /* normal backend */ +#define BACKEND_TYPE_AUTOVAC (1 << 1) /* autovacuum worker process */ +#define BACKEND_TYPE_WALSND (1 << 2) /* walsender process */ +#define BACKEND_TYPE_BGWORKER (1 << 3) /* bgworker process */ +#define BACKEND_TYPE_ALL (BACKEND_TYPE_NORMAL | BACKEND_TYPE_AUTOVAC | BACKEND_TYPE_WALSND | BACKEND_TYPE_BGWORKER) /* * List of active backends (or child processes anyway; we don't actually diff --git a/src/backend/regex/regc_pg_locale.c b/src/backend/regex/regc_pg_locale.c index 3cc2d4d362..e2a8a3599c 100644 --- a/src/backend/regex/regc_pg_locale.c +++ b/src/backend/regex/regc_pg_locale.c @@ -79,15 +79,15 @@ static Oid pg_regex_collation; /* * Hard-wired character properties for C locale */ -#define PG_ISDIGIT 0x01 -#define PG_ISALPHA 0x02 +#define PG_ISDIGIT (1 << 0) +#define PG_ISALPHA (1 << 1) #define PG_ISALNUM (PG_ISDIGIT | PG_ISALPHA) -#define PG_ISUPPER 0x04 -#define PG_ISLOWER 0x08 -#define PG_ISGRAPH 0x10 -#define PG_ISPRINT 0x20 -#define PG_ISPUNCT 0x40 -#define PG_ISSPACE 0x80 +#define PG_ISUPPER (1 << 2) +#define PG_ISLOWER (1 << 3) +#define PG_ISGRAPH (1 << 4) +#define PG_ISPRINT (1 << 5) +#define PG_ISPUNCT (1 << 6) +#define PG_ISSPACE (1 << 7) static const unsigned char pg_char_properties[128] = { /* NUL */ 0, diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index ad0d1a9abc..65baa835c7 100644 --- a/src/backend/storage/buffer/bufmgr.c +++ b/src/backend/storage/buffer/bufmgr.c @@ -65,8 +65,8 @@ LocalBufferBlockPointers[-((bufHdr)->buf_id + 2)] /* Bits in SyncOneBuffer's return value */ -#define BUF_WRITTEN 0x01 -#define BUF_REUSABLE 0x02 +#define BUF_WRITTEN (1 << 0) +#define BUF_REUSABLE (1 << 1) #define RELS_BSEARCH_THRESHOLD 20 diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 3bb01cdb65..1280a79331 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -541,11 +541,11 @@ do { \ * Suffixes (FormatNode.suffix is an OR of these codes) * ---------- */ -#define DCH_S_FM 0x01 -#define DCH_S_TH 0x02 -#define DCH_S_th 0x04 -#define DCH_S_SP 0x08 -#define DCH_S_TM 0x10 +#define DCH_S_FM (1 << 0) +#define DCH_S_TH (1 << 1) +#define DCH_S_th (1 << 2) +#define DCH_S_SP (1 << 3) +#define DCH_S_TM (1 << 4) /* ---------- * Suffix tests @@ -1019,9 +1019,9 @@ typedef struct NUMProc } NUMProc; /* Return flags for DCH_from_char() */ -#define DCH_DATED 0x01 -#define DCH_TIMED 0x02 -#define DCH_ZONED 0x04 +#define DCH_DATED (1 << 0) +#define DCH_TIMED (1 << 1) +#define DCH_ZONED (1 << 2) /* ---------- * Functions diff --git a/src/backend/utils/adt/jsonfuncs.c b/src/backend/utils/adt/jsonfuncs.c index d370348a1c..0b6b025eb6 100644 --- a/src/backend/utils/adt/jsonfuncs.c +++ b/src/backend/utils/adt/jsonfuncs.c @@ -36,11 +36,11 @@ #include "utils/typcache.h" /* Operations available for setPath */ -#define JB_PATH_CREATE 0x0001 -#define JB_PATH_DELETE 0x0002 -#define JB_PATH_REPLACE 0x0004 -#define JB_PATH_INSERT_BEFORE 0x0008 -#define JB_PATH_INSERT_AFTER 0x0010 +#define JB_PATH_CREATE (1 << 0) +#define JB_PATH_DELETE (1 << 1) +#define JB_PATH_REPLACE (1 << 2) +#define JB_PATH_INSERT_BEFORE (1 << 3) +#define JB_PATH_INSERT_AFTER (1 << 4) #define JB_PATH_CREATE_OR_INSERT \ (JB_PATH_INSERT_BEFORE | JB_PATH_INSERT_AFTER | JB_PATH_CREATE) diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index c2c6df2a4f..9a01c9d0a6 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -87,9 +87,9 @@ #define PRETTYINDENT_LIMIT 40 /* wrap limit */ /* Pretty flags */ -#define PRETTYFLAG_PAREN 0x0001 -#define PRETTYFLAG_INDENT 0x0002 -#define PRETTYFLAG_SCHEMA 0x0004 +#define PRETTYFLAG_PAREN (1 << 0) +#define PRETTYFLAG_INDENT (1 << 1) +#define PRETTYFLAG_SCHEMA (1 << 2) /* Default line length for pretty-print wrapping: 0 means wrap always */ #define WRAP_COLUMN_DEFAULT 0 diff --git a/src/backend/utils/adt/tsvector_op.c b/src/backend/utils/adt/tsvector_op.c index 756a48a167..dc2166b0f2 100644 --- a/src/backend/utils/adt/tsvector_op.c +++ b/src/backend/utils/adt/tsvector_op.c @@ -1455,9 +1455,9 @@ checkcondition_str(void *checkval, QueryOperand *val, ExecPhraseData *data) * Returns TS_YES if any positions were emitted to *data; or if data is NULL, * returns TS_YES if any positions would have been emitted. */ -#define TSPO_L_ONLY 0x01 /* emit positions appearing only in L */ -#define TSPO_R_ONLY 0x02 /* emit positions appearing only in R */ -#define TSPO_BOTH 0x04 /* emit positions appearing in both L&R */ +#define TSPO_L_ONLY (1 << 0) /* emit positions appearing only in L */ +#define TSPO_R_ONLY (1 << 1) /* emit positions appearing only in R */ +#define TSPO_BOTH (1 << 2) /* emit positions appearing in both L&R */ static TSTernaryValue TS_phrase_output(ExecPhraseData *data, diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index ff9bf238f3..14e6770cd4 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -5597,7 +5597,7 @@ text_reverse(PG_FUNCTION_ARGS) /* * Support macros for text_format() */ -#define TEXT_FORMAT_FLAG_MINUS 0x0001 /* is minus flag present? */ +#define TEXT_FORMAT_FLAG_MINUS (1 << 0) /* is minus flag present? */ #define ADVANCE_PARSE_POINTER(ptr,end_ptr) \ do { \ diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c index dca1d48e89..373922ee7d 100644 --- a/src/backend/utils/cache/typcache.c +++ b/src/backend/utils/cache/typcache.c @@ -80,27 +80,27 @@ static HTAB *TypeCacheHash = NULL; static TypeCacheEntry *firstDomainTypeEntry = NULL; /* Private flag bits in the TypeCacheEntry.flags field */ -#define TCFLAGS_HAVE_PG_TYPE_DATA 0x000001 -#define TCFLAGS_CHECKED_BTREE_OPCLASS 0x000002 -#define TCFLAGS_CHECKED_HASH_OPCLASS 0x000004 -#define TCFLAGS_CHECKED_EQ_OPR 0x000008 -#define TCFLAGS_CHECKED_LT_OPR 0x000010 -#define TCFLAGS_CHECKED_GT_OPR 0x000020 -#define TCFLAGS_CHECKED_CMP_PROC 0x000040 -#define TCFLAGS_CHECKED_HASH_PROC 0x000080 -#define TCFLAGS_CHECKED_HASH_EXTENDED_PROC 0x000100 -#define TCFLAGS_CHECKED_ELEM_PROPERTIES 0x000200 -#define TCFLAGS_HAVE_ELEM_EQUALITY 0x000400 -#define TCFLAGS_HAVE_ELEM_COMPARE 0x000800 -#define TCFLAGS_HAVE_ELEM_HASHING 0x001000 -#define TCFLAGS_HAVE_ELEM_EXTENDED_HASHING 0x002000 -#define TCFLAGS_CHECKED_FIELD_PROPERTIES 0x004000 -#define TCFLAGS_HAVE_FIELD_EQUALITY 0x008000 -#define TCFLAGS_HAVE_FIELD_COMPARE 0x010000 -#define TCFLAGS_HAVE_FIELD_HASHING 0x020000 -#define TCFLAGS_HAVE_FIELD_EXTENDED_HASHING 0x040000 -#define TCFLAGS_CHECKED_DOMAIN_CONSTRAINTS 0x080000 -#define TCFLAGS_DOMAIN_BASE_IS_COMPOSITE 0x100000 +#define TCFLAGS_HAVE_PG_TYPE_DATA (1 << 0) +#define TCFLAGS_CHECKED_BTREE_OPCLASS (1 << 1) +#define TCFLAGS_CHECKED_HASH_OPCLASS (1 << 2) +#define TCFLAGS_CHECKED_EQ_OPR (1 << 3) +#define TCFLAGS_CHECKED_LT_OPR (1 << 4) +#define TCFLAGS_CHECKED_GT_OPR (1 << 5) +#define TCFLAGS_CHECKED_CMP_PROC (1 << 6) +#define TCFLAGS_CHECKED_HASH_PROC (1 << 7) +#define TCFLAGS_CHECKED_HASH_EXTENDED_PROC (1 << 8) +#define TCFLAGS_CHECKED_ELEM_PROPERTIES (1 << 9) +#define TCFLAGS_HAVE_ELEM_EQUALITY (1 << 10) +#define TCFLAGS_HAVE_ELEM_COMPARE (1 << 11) +#define TCFLAGS_HAVE_ELEM_HASHING (1 << 12) +#define TCFLAGS_HAVE_ELEM_EXTENDED_HASHING (1 << 13) +#define TCFLAGS_CHECKED_FIELD_PROPERTIES (1 << 14) +#define TCFLAGS_HAVE_FIELD_EQUALITY (1 << 15) +#define TCFLAGS_HAVE_FIELD_COMPARE (1 << 16) +#define TCFLAGS_HAVE_FIELD_HASHING (1 << 17) +#define TCFLAGS_HAVE_FIELD_EXTENDED_HASHING (1 << 18) +#define TCFLAGS_CHECKED_DOMAIN_CONSTRAINTS (1 << 19) +#define TCFLAGS_DOMAIN_BASE_IS_COMPOSITE (1 << 20) /* The flags associated with equality/comparison/hashing are all but these: */ #define TCFLAGS_OPERATOR_FLAGS \ diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index fb8d226d48..d539f3fcf2 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -231,9 +231,9 @@ typedef enum typedef enum { - REQ_SCHEMA = 0x01, /* want schema */ - REQ_DATA = 0x02, /* want data */ - REQ_SPECIAL = 0x04 /* for special TOC entries */ + REQ_SCHEMA = (1 << 0), /* want schema */ + REQ_DATA = (1 << 1), /* want data */ + REQ_SPECIAL = (1 << 2) /* for special TOC entries */ } teReqs; struct _archiveHandle diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index e8fecc6026..60ca891d5d 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -950,8 +950,8 @@ typedef BTScanOpaqueData *BTScanOpaque; * to use bits 16-31 (see skey.h). The uppermost bits are copied from the * index's indoption[] array entry for the index attribute. */ -#define SK_BT_REQFWD 0x00010000 /* required to continue forward scan */ -#define SK_BT_REQBKWD 0x00020000 /* required to continue backward scan */ +#define SK_BT_REQFWD (1 << 16) /* required to continue forward scan */ +#define SK_BT_REQBKWD (1 << 17) /* required to continue backward scan */ #define SK_BT_INDOPTION_SHIFT 24 /* must clear the above bits */ #define SK_BT_DESC (INDOPTION_DESC << SK_BT_INDOPTION_SHIFT) #define SK_BT_NULLS_FIRST (INDOPTION_NULLS_FIRST << SK_BT_INDOPTION_SHIFT) diff --git a/src/include/access/skey.h b/src/include/access/skey.h index 7d2df1bac3..51f215be6d 100644 --- a/src/include/access/skey.h +++ b/src/include/access/skey.h @@ -112,15 +112,15 @@ typedef ScanKeyData *ScanKey; * bits should be defined here). Bits 16-31 are reserved for use within * individual index access methods. */ -#define SK_ISNULL 0x0001 /* sk_argument is NULL */ -#define SK_UNARY 0x0002 /* unary operator (not supported!) */ -#define SK_ROW_HEADER 0x0004 /* row comparison header (see above) */ -#define SK_ROW_MEMBER 0x0008 /* row comparison member (see above) */ -#define SK_ROW_END 0x0010 /* last row comparison member */ -#define SK_SEARCHARRAY 0x0020 /* scankey represents ScalarArrayOp */ -#define SK_SEARCHNULL 0x0040 /* scankey represents "col IS NULL" */ -#define SK_SEARCHNOTNULL 0x0080 /* scankey represents "col IS NOT NULL" */ -#define SK_ORDER_BY 0x0100 /* scankey is for ORDER BY op */ +#define SK_ISNULL (1 << 0) /* sk_argument is NULL */ +#define SK_UNARY (1 << 1) /* unary operator (not supported!) */ +#define SK_ROW_HEADER (1 << 2) /* row comparison header (see above) */ +#define SK_ROW_MEMBER (1 << 3) /* row comparison member (see above) */ +#define SK_ROW_END (1 << 4) /* last row comparison member */ +#define SK_SEARCHARRAY (1 << 5) /* scankey represents ScalarArrayOp */ +#define SK_SEARCHNULL (1 << 6) /* scankey represents "col IS NULL" */ +#define SK_SEARCHNOTNULL (1 << 7) /* scankey represents "col IS NOT NULL" */ +#define SK_ORDER_BY (1 << 8) /* scankey is for ORDER BY op */ /* diff --git a/src/include/access/toast_helper.h b/src/include/access/toast_helper.h index 0e92acc546..ef999e14f4 100644 --- a/src/include/access/toast_helper.h +++ b/src/include/access/toast_helper.h @@ -74,10 +74,10 @@ typedef struct * TOAST_NEEDS_CHANGE indicates that a new tuple needs to built; in other * words, the toaster did something. */ -#define TOAST_NEEDS_DELETE_OLD 0x0001 -#define TOAST_NEEDS_FREE 0x0002 -#define TOAST_HAS_NULLS 0x0004 -#define TOAST_NEEDS_CHANGE 0x0008 +#define TOAST_NEEDS_DELETE_OLD (1 << 0) +#define TOAST_NEEDS_FREE (1 << 1) +#define TOAST_HAS_NULLS (1 << 2) +#define TOAST_NEEDS_CHANGE (1 << 3) /* * Flags indicating the status of a TOAST operation with respect to a @@ -97,8 +97,8 @@ typedef struct */ #define TOASTCOL_NEEDS_DELETE_OLD TOAST_NEEDS_DELETE_OLD #define TOASTCOL_NEEDS_FREE TOAST_NEEDS_FREE -#define TOASTCOL_IGNORE 0x0010 -#define TOASTCOL_INCOMPRESSIBLE 0x0020 +#define TOASTCOL_IGNORE (1 << 4) +#define TOASTCOL_INCOMPRESSIBLE (1 << 5) extern void toast_tuple_init(ToastTupleContext *ttc); extern int toast_tuple_find_biggest_attribute(ToastTupleContext *ttc, diff --git a/src/include/catalog/dependency.h b/src/include/catalog/dependency.h index 901d5019cd..3894b9bfce 100644 --- a/src/include/catalog/dependency.h +++ b/src/include/catalog/dependency.h @@ -131,13 +131,13 @@ typedef enum ObjectClass #define LAST_OCLASS OCLASS_TRANSFORM /* flag bits for performDeletion/performMultipleDeletions: */ -#define PERFORM_DELETION_INTERNAL 0x0001 /* internal action */ -#define PERFORM_DELETION_CONCURRENTLY 0x0002 /* concurrent drop */ -#define PERFORM_DELETION_QUIETLY 0x0004 /* suppress notices */ -#define PERFORM_DELETION_SKIP_ORIGINAL 0x0008 /* keep original obj */ -#define PERFORM_DELETION_SKIP_EXTENSIONS 0x0010 /* keep extensions */ -#define PERFORM_DELETION_CONCURRENT_LOCK 0x0020 /* normal drop with - * concurrent lock mode */ +#define PERFORM_DELETION_INTERNAL (1 << 0) /* internal action */ +#define PERFORM_DELETION_CONCURRENTLY (1 << 1) /* concurrent drop */ +#define PERFORM_DELETION_QUIETLY (1 << 2) /* suppress notices */ +#define PERFORM_DELETION_SKIP_ORIGINAL (1 << 3) /* keep original obj */ +#define PERFORM_DELETION_SKIP_EXTENSIONS (1 << 4) /* keep extensions */ +#define PERFORM_DELETION_CONCURRENT_LOCK (1 << 5) /* normal drop with + * concurrent lock mode */ /* in dependency.c */ diff --git a/src/include/catalog/heap.h b/src/include/catalog/heap.h index f94defff3c..0c766b9a75 100644 --- a/src/include/catalog/heap.h +++ b/src/include/catalog/heap.h @@ -20,9 +20,9 @@ /* flag bits for CheckAttributeType/CheckAttributeNamesTypes */ -#define CHKATYPE_ANYARRAY 0x01 /* allow ANYARRAY */ -#define CHKATYPE_ANYRECORD 0x02 /* allow RECORD and RECORD[] */ -#define CHKATYPE_IS_PARTKEY 0x04 /* attname is part key # not column */ +#define CHKATYPE_ANYARRAY (1 << 0) /* allow ANYARRAY */ +#define CHKATYPE_ANYRECORD (1 << 1) /* allow RECORD and RECORD[] */ +#define CHKATYPE_IS_PARTKEY (1 << 2) /* attname is part key # not column */ typedef struct RawColumnDefault { diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index c041628049..1e908cb89e 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -149,11 +149,11 @@ extern void reindex_index(Oid indexId, bool skip_constraint_checks, char relpersistence, int options); /* Flag bits for reindex_relation(): */ -#define REINDEX_REL_PROCESS_TOAST 0x01 -#define REINDEX_REL_SUPPRESS_INDEX_USE 0x02 -#define REINDEX_REL_CHECK_CONSTRAINTS 0x04 -#define REINDEX_REL_FORCE_INDEXES_UNLOGGED 0x08 -#define REINDEX_REL_FORCE_INDEXES_PERMANENT 0x10 +#define REINDEX_REL_PROCESS_TOAST (1 << 0) +#define REINDEX_REL_SUPPRESS_INDEX_USE (1 << 1) +#define REINDEX_REL_CHECK_CONSTRAINTS (1 << 2) +#define REINDEX_REL_FORCE_INDEXES_UNLOGGED (1 << 3) +#define REINDEX_REL_FORCE_INDEXES_PERMANENT (1 << 4) extern bool reindex_relation(Oid relid, int flags, int options); diff --git a/src/include/commands/event_trigger.h b/src/include/commands/event_trigger.h index 407fd6a978..6e83633621 100644 --- a/src/include/commands/event_trigger.h +++ b/src/include/commands/event_trigger.h @@ -29,9 +29,9 @@ typedef struct EventTriggerData CommandTag tag; } EventTriggerData; -#define AT_REWRITE_ALTER_PERSISTENCE 0x01 -#define AT_REWRITE_DEFAULT_VAL 0x02 -#define AT_REWRITE_COLUMN_REWRITE 0x04 +#define AT_REWRITE_ALTER_PERSISTENCE (1 << 0) +#define AT_REWRITE_DEFAULT_VAL (1 << 1) +#define AT_REWRITE_COLUMN_REWRITE (1 << 2) /* * EventTriggerData is the node type that is passed as fmgr "context" info diff --git a/src/include/common/fe_memutils.h b/src/include/common/fe_memutils.h index b2badd3172..c6b3ad7acc 100644 --- a/src/include/common/fe_memutils.h +++ b/src/include/common/fe_memutils.h @@ -13,10 +13,10 @@ * Flags for pg_malloc_extended and palloc_extended, deliberately named * the same as the backend flags. */ -#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) not - * actually used for frontends */ -#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ -#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */ +#define MCXT_ALLOC_HUGE (1 << 0) /* allow huge allocation (> 1 GB) not + * actually used for frontends */ +#define MCXT_ALLOC_NO_OOM (1 << 1) /* no failure if out-of-memory */ +#define MCXT_ALLOC_ZERO (1 << 2) /* zero allocated memory */ /* * "Safe" memory allocation functions --- these exit(1) on failure diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 0c48d2a519..b1da025c3c 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -53,12 +53,12 @@ * mean that the plan can't queue any AFTER triggers; just that the caller * is responsible for there being a trigger context for them to be queued in. */ -#define EXEC_FLAG_EXPLAIN_ONLY 0x0001 /* EXPLAIN, no ANALYZE */ -#define EXEC_FLAG_REWIND 0x0002 /* need efficient rescan */ -#define EXEC_FLAG_BACKWARD 0x0004 /* need backward scan */ -#define EXEC_FLAG_MARK 0x0008 /* need mark/restore */ -#define EXEC_FLAG_SKIP_TRIGGERS 0x0010 /* skip AfterTrigger calls */ -#define EXEC_FLAG_WITH_NO_DATA 0x0020 /* rel scannability doesn't matter */ +#define EXEC_FLAG_EXPLAIN_ONLY (1 << 0) /* EXPLAIN, no ANALYZE */ +#define EXEC_FLAG_REWIND (1 << 1) /* need efficient rescan */ +#define EXEC_FLAG_BACKWARD (1 << 2) /* need backward scan */ +#define EXEC_FLAG_MARK (1 << 3) /* need mark/restore */ +#define EXEC_FLAG_SKIP_TRIGGERS (1 << 4) /* skip AfterTrigger calls */ +#define EXEC_FLAG_WITH_NO_DATA (1 << 5) /* rel scannability doesn't matter */ /* Hook for plugins to get control in ExecutorStart() */ diff --git a/src/include/foreign/foreign.h b/src/include/foreign/foreign.h index 5e0cf533fb..b5a623fdb9 100644 --- a/src/include/foreign/foreign.h +++ b/src/include/foreign/foreign.h @@ -58,10 +58,10 @@ typedef struct ForeignTable } ForeignTable; /* Flags for GetForeignServerExtended */ -#define FSV_MISSING_OK 0x01 +#define FSV_MISSING_OK (1 << 0) /* Flags for GetForeignDataWrapperExtended */ -#define FDW_MISSING_OK 0x01 +#define FDW_MISSING_OK (1 << 0) extern ForeignServer *GetForeignServer(Oid serverid); diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index 72e3352398..6186e01693 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -295,9 +295,9 @@ extern int trace_recovery(int trace_level); *****************************************************************************/ /* flags to be OR'd to form sec_context */ -#define SECURITY_LOCAL_USERID_CHANGE 0x0001 -#define SECURITY_RESTRICTED_OPERATION 0x0002 -#define SECURITY_NOFORCE_RLS 0x0004 +#define SECURITY_LOCAL_USERID_CHANGE (1 << 0) +#define SECURITY_RESTRICTED_OPERATION (1 << 1) +#define SECURITY_NOFORCE_RLS (1 << 2) extern char *DatabasePath; diff --git a/src/include/nodes/extensible.h b/src/include/nodes/extensible.h index d7bf0ba913..3d625b8195 100644 --- a/src/include/nodes/extensible.h +++ b/src/include/nodes/extensible.h @@ -78,8 +78,8 @@ extern const ExtensibleNodeMethods *GetExtensibleNodeMethods(const char *name, * Flags for custom paths, indicating what capabilities the resulting scan * will have. */ -#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN 0x0001 -#define CUSTOMPATH_SUPPORT_MARK_RESTORE 0x0002 +#define CUSTOMPATH_SUPPORT_BACKWARD_SCAN (1 << 0) +#define CUSTOMPATH_SUPPORT_MARK_RESTORE (1 << 1) /* * Custom path methods. Mostly, we just need to know how to convert a diff --git a/src/include/nodes/nodeFuncs.h b/src/include/nodes/nodeFuncs.h index 9cc56eecaa..d49cddf5c8 100644 --- a/src/include/nodes/nodeFuncs.h +++ b/src/include/nodes/nodeFuncs.h @@ -17,17 +17,17 @@ /* flags bits for query_tree_walker and query_tree_mutator */ -#define QTW_IGNORE_RT_SUBQUERIES 0x01 /* subqueries in rtable */ -#define QTW_IGNORE_CTE_SUBQUERIES 0x02 /* subqueries in cteList */ -#define QTW_IGNORE_RC_SUBQUERIES 0x03 /* both of above */ -#define QTW_IGNORE_JOINALIASES 0x04 /* JOIN alias var lists */ -#define QTW_IGNORE_RANGE_TABLE 0x08 /* skip rangetable entirely */ -#define QTW_EXAMINE_RTES_BEFORE 0x10 /* examine RTE nodes before their - * contents */ -#define QTW_EXAMINE_RTES_AFTER 0x20 /* examine RTE nodes after their - * contents */ -#define QTW_DONT_COPY_QUERY 0x40 /* do not copy top Query */ -#define QTW_EXAMINE_SORTGROUP 0x80 /* include SortGroupNode lists */ +#define QTW_IGNORE_RT_SUBQUERIES (1 << 0) /* subqueries in rtable */ +#define QTW_IGNORE_CTE_SUBQUERIES (1 << 1) /* subqueries in cteList */ +#define QTW_IGNORE_RC_SUBQUERIES (QTW_IGNORE_RT_SUBQUERIES | QTW_IGNORE_CTE_SUBQUERIES) +#define QTW_IGNORE_JOINALIASES (1 << 2) /* JOIN alias var lists */ +#define QTW_IGNORE_RANGE_TABLE (1 << 3) /* skip rangetable entirely */ +#define QTW_EXAMINE_RTES_BEFORE (1 << 4) /* examine RTE nodes before their + * contents */ +#define QTW_EXAMINE_RTES_AFTER (1 << 5) /* examine RTE nodes after their + * contents */ +#define QTW_DONT_COPY_QUERY (1 << 6) /* do not copy top Query */ +#define QTW_EXAMINE_SORTGROUP (1 << 7) /* include SortGroupNode lists */ /* callback function for check_functions_in_node */ typedef bool (*check_function_callback) (Oid func_id, void *context); diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 3684f87a88..ad96c9bb95 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -769,10 +769,10 @@ typedef enum AggStrategy */ /* Primitive options supported by nodeAgg.c: */ -#define AGGSPLITOP_COMBINE 0x01 /* substitute combinefn for transfn */ -#define AGGSPLITOP_SKIPFINAL 0x02 /* skip finalfn, return state as-is */ -#define AGGSPLITOP_SERIALIZE 0x04 /* apply serialfn to output */ -#define AGGSPLITOP_DESERIALIZE 0x08 /* apply deserialfn to input */ +#define AGGSPLITOP_COMBINE (1 << 0) /* substitute combinefn for transfn */ +#define AGGSPLITOP_SKIPFINAL (1 << 1) /* skip finalfn, return state as-is */ +#define AGGSPLITOP_SERIALIZE (1 << 2) /* apply serialfn to output */ +#define AGGSPLITOP_DESERIALIZE (1 << 3) /* apply deserialfn to input */ /* Supported operating modes (i.e., useful combinations of these options): */ typedef enum AggSplit diff --git a/src/include/nodes/params.h b/src/include/nodes/params.h index 4898d90848..9de8e42a35 100644 --- a/src/include/nodes/params.h +++ b/src/include/nodes/params.h @@ -85,7 +85,7 @@ struct ParseState; * and paramCompileArg is rather arbitrary. */ -#define PARAM_FLAG_CONST 0x0001 /* parameter is constant */ +#define PARAM_FLAG_CONST (1 << 0) /* parameter is constant */ typedef struct ParamExternData { diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index ec14fc2036..e436a4279d 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -503,24 +503,24 @@ typedef struct WindowDef * The START_foo and END_foo options must come in pairs of adjacent bits for * the convenience of gram.y, even though some of them are useless/invalid. */ -#define FRAMEOPTION_NONDEFAULT 0x00001 /* any specified? */ -#define FRAMEOPTION_RANGE 0x00002 /* RANGE behavior */ -#define FRAMEOPTION_ROWS 0x00004 /* ROWS behavior */ -#define FRAMEOPTION_GROUPS 0x00008 /* GROUPS behavior */ -#define FRAMEOPTION_BETWEEN 0x00010 /* BETWEEN given? */ -#define FRAMEOPTION_START_UNBOUNDED_PRECEDING 0x00020 /* start is U. P. */ -#define FRAMEOPTION_END_UNBOUNDED_PRECEDING 0x00040 /* (disallowed) */ -#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING 0x00080 /* (disallowed) */ -#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING 0x00100 /* end is U. F. */ -#define FRAMEOPTION_START_CURRENT_ROW 0x00200 /* start is C. R. */ -#define FRAMEOPTION_END_CURRENT_ROW 0x00400 /* end is C. R. */ -#define FRAMEOPTION_START_OFFSET_PRECEDING 0x00800 /* start is O. P. */ -#define FRAMEOPTION_END_OFFSET_PRECEDING 0x01000 /* end is O. P. */ -#define FRAMEOPTION_START_OFFSET_FOLLOWING 0x02000 /* start is O. F. */ -#define FRAMEOPTION_END_OFFSET_FOLLOWING 0x04000 /* end is O. F. */ -#define FRAMEOPTION_EXCLUDE_CURRENT_ROW 0x08000 /* omit C.R. */ -#define FRAMEOPTION_EXCLUDE_GROUP 0x10000 /* omit C.R. & peers */ -#define FRAMEOPTION_EXCLUDE_TIES 0x20000 /* omit C.R.'s peers */ +#define FRAMEOPTION_NONDEFAULT (1 << 0) /* any specified? */ +#define FRAMEOPTION_RANGE (1 << 1) /* RANGE behavior */ +#define FRAMEOPTION_ROWS (1 << 2) /* ROWS behavior */ +#define FRAMEOPTION_GROUPS (1 << 3) /* GROUPS behavior */ +#define FRAMEOPTION_BETWEEN (1 << 4) /* BETWEEN given? */ +#define FRAMEOPTION_START_UNBOUNDED_PRECEDING (1 << 5) /* start is U. P. */ +#define FRAMEOPTION_END_UNBOUNDED_PRECEDING (1 << 6) /* (disallowed) */ +#define FRAMEOPTION_START_UNBOUNDED_FOLLOWING (1 << 7) /* (disallowed) */ +#define FRAMEOPTION_END_UNBOUNDED_FOLLOWING (1 << 8) /* end is U. F. */ +#define FRAMEOPTION_START_CURRENT_ROW (1 << 9) /* start is C. R. */ +#define FRAMEOPTION_END_CURRENT_ROW (1 << 10) /* end is C. R. */ +#define FRAMEOPTION_START_OFFSET_PRECEDING (1 << 11) /* start is O. P. */ +#define FRAMEOPTION_END_OFFSET_PRECEDING (1 << 12) /* end is O. P. */ +#define FRAMEOPTION_START_OFFSET_FOLLOWING (1 << 13) /* start is O. F. */ +#define FRAMEOPTION_END_OFFSET_FOLLOWING (1 << 14) /* end is O. F. */ +#define FRAMEOPTION_EXCLUDE_CURRENT_ROW (1 << 15) /* omit C.R. */ +#define FRAMEOPTION_EXCLUDE_GROUP (1 << 16) /* omit C.R. & peers */ +#define FRAMEOPTION_EXCLUDE_TIES (1 << 17) /* omit C.R.'s peers */ #define FRAMEOPTION_START_OFFSET \ (FRAMEOPTION_START_OFFSET_PRECEDING | FRAMEOPTION_START_OFFSET_FOLLOWING) @@ -2702,16 +2702,16 @@ typedef struct SecLabelStmt * of the query are always postponed until execution. * ---------------------- */ -#define CURSOR_OPT_BINARY 0x0001 /* BINARY */ -#define CURSOR_OPT_SCROLL 0x0002 /* SCROLL explicitly given */ -#define CURSOR_OPT_NO_SCROLL 0x0004 /* NO SCROLL explicitly given */ -#define CURSOR_OPT_INSENSITIVE 0x0008 /* INSENSITIVE */ -#define CURSOR_OPT_HOLD 0x0010 /* WITH HOLD */ +#define CURSOR_OPT_BINARY (1 << 0) /* BINARY */ +#define CURSOR_OPT_SCROLL (1 << 1) /* SCROLL explicitly given */ +#define CURSOR_OPT_NO_SCROLL (1 << 2) /* NO SCROLL explicitly given */ +#define CURSOR_OPT_INSENSITIVE (1 << 3) /* INSENSITIVE */ +#define CURSOR_OPT_HOLD (1 << 4) /* WITH HOLD */ /* these planner-control flags do not correspond to any SQL grammar: */ -#define CURSOR_OPT_FAST_PLAN 0x0020 /* prefer fast-start plan */ -#define CURSOR_OPT_GENERIC_PLAN 0x0040 /* force use of generic plan */ -#define CURSOR_OPT_CUSTOM_PLAN 0x0080 /* force use of custom plan */ -#define CURSOR_OPT_PARALLEL_OK 0x0100 /* parallel mode OK */ +#define CURSOR_OPT_FAST_PLAN (1 << 16) /* prefer fast-start plan */ +#define CURSOR_OPT_GENERIC_PLAN (1 << 17) /* force use of generic plan */ +#define CURSOR_OPT_CUSTOM_PLAN (1 << 18) /* force use of custom plan */ +#define CURSOR_OPT_PARALLEL_OK (1 << 19) /* parallel mode OK */ typedef struct DeclareCursorStmt { diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h index b4059895de..27c24169d4 100644 --- a/src/include/nodes/pathnodes.h +++ b/src/include/nodes/pathnodes.h @@ -2453,9 +2453,9 @@ typedef struct JoinPathExtraData * for which we support partial aggregation (not, for example, grouping sets). * It says nothing about parallel-safety or the availability of suitable paths. */ -#define GROUPING_CAN_USE_SORT 0x0001 -#define GROUPING_CAN_USE_HASH 0x0002 -#define GROUPING_CAN_PARTIAL_AGG 0x0004 +#define GROUPING_CAN_USE_SORT (1 << 0) +#define GROUPING_CAN_USE_HASH (1 << 1) +#define GROUPING_CAN_PARTIAL_AGG (1 << 2) /* * What kind of partitionwise aggregation is in use? diff --git a/src/include/optimizer/optimizer.h b/src/include/optimizer/optimizer.h index dea0e7338d..63932e73db 100644 --- a/src/include/optimizer/optimizer.h +++ b/src/include/optimizer/optimizer.h @@ -174,14 +174,14 @@ extern SortGroupClause *get_sortgroupref_clause_noerr(Index sortref, /* in util/var.c: */ /* Bits that can be OR'd into the flags argument of pull_var_clause() */ -#define PVC_INCLUDE_AGGREGATES 0x0001 /* include Aggrefs in output list */ -#define PVC_RECURSE_AGGREGATES 0x0002 /* recurse into Aggref arguments */ -#define PVC_INCLUDE_WINDOWFUNCS 0x0004 /* include WindowFuncs in output list */ -#define PVC_RECURSE_WINDOWFUNCS 0x0008 /* recurse into WindowFunc arguments */ -#define PVC_INCLUDE_PLACEHOLDERS 0x0010 /* include PlaceHolderVars in - * output list */ -#define PVC_RECURSE_PLACEHOLDERS 0x0020 /* recurse into PlaceHolderVar - * arguments */ +#define PVC_INCLUDE_AGGREGATES (1 << 0) /* include Aggrefs in output list */ +#define PVC_RECURSE_AGGREGATES (1 << 1) /* recurse into Aggref arguments */ +#define PVC_INCLUDE_WINDOWFUNCS (1 << 2) /* include WindowFuncs in output list */ +#define PVC_RECURSE_WINDOWFUNCS (1 << 3) /* recurse into WindowFunc arguments */ +#define PVC_INCLUDE_PLACEHOLDERS (1 << 4) /* include PlaceHolderVars in + * output list */ +#define PVC_RECURSE_PLACEHOLDERS (1 << 5) /* recurse into PlaceHolderVar + * arguments */ extern Bitmapset *pull_varnos(Node *node); extern Bitmapset *pull_varnos_of_level(Node *node, int levelsup); diff --git a/src/include/replication/reorderbuffer.h b/src/include/replication/reorderbuffer.h index bd9dd7ec67..734472266c 100644 --- a/src/include/replication/reorderbuffer.h +++ b/src/include/replication/reorderbuffer.h @@ -167,13 +167,13 @@ typedef struct ReorderBufferChange } ReorderBufferChange; /* ReorderBufferTXN txn_flags */ -#define RBTXN_HAS_CATALOG_CHANGES 0x0001 -#define RBTXN_IS_SUBXACT 0x0002 -#define RBTXN_IS_SERIALIZED 0x0004 -#define RBTXN_IS_SERIALIZED_CLEAR 0x0008 -#define RBTXN_IS_STREAMED 0x0010 -#define RBTXN_HAS_TOAST_INSERT 0x0020 -#define RBTXN_HAS_SPEC_INSERT 0x0040 +#define RBTXN_HAS_CATALOG_CHANGES (1 << 0) +#define RBTXN_IS_SUBXACT (1 << 1) +#define RBTXN_IS_SERIALIZED (1 << 2) +#define RBTXN_IS_SERIALIZED_CLEAR (1 << 3) +#define RBTXN_IS_STREAMED (1 << 4) +#define RBTXN_HAS_TOAST_INSERT (1 << 5) +#define RBTXN_HAS_SPEC_INSERT (1 << 6) /* Does the transaction have catalog changes? */ #define rbtxn_has_catalog_changes(txn) \ diff --git a/src/include/storage/dsm.h b/src/include/storage/dsm.h index 0455576f4a..9bd6b05ddb 100644 --- a/src/include/storage/dsm.h +++ b/src/include/storage/dsm.h @@ -17,7 +17,7 @@ typedef struct dsm_segment dsm_segment; -#define DSM_CREATE_NULL_IF_MAXSEGMENTS 0x0001 +#define DSM_CREATE_NULL_IF_MAXSEGMENTS (1 << 0) /* A sentinel value for an invalid DSM handle. */ #define DSM_HANDLE_INVALID 0 diff --git a/src/include/storage/predicate_internals.h b/src/include/storage/predicate_internals.h index cf9694d65e..cade610165 100644 --- a/src/include/storage/predicate_internals.h +++ b/src/include/storage/predicate_internals.h @@ -115,28 +115,28 @@ typedef struct SERIALIZABLEXACT int pid; /* pid of associated process */ } SERIALIZABLEXACT; -#define SXACT_FLAG_COMMITTED 0x00000001 /* already committed */ -#define SXACT_FLAG_PREPARED 0x00000002 /* about to commit */ -#define SXACT_FLAG_ROLLED_BACK 0x00000004 /* already rolled back */ -#define SXACT_FLAG_DOOMED 0x00000008 /* will roll back */ +#define SXACT_FLAG_COMMITTED (1 << 0) /* already committed */ +#define SXACT_FLAG_PREPARED (1 << 1) /* about to commit */ +#define SXACT_FLAG_ROLLED_BACK (1 << 2) /* already rolled back */ +#define SXACT_FLAG_DOOMED (1 << 3) /* will roll back */ /* * The following flag actually means that the flagged transaction has a * conflict out *to a transaction which committed ahead of it*. It's hard * to get that into a name of a reasonable length. */ -#define SXACT_FLAG_CONFLICT_OUT 0x00000010 -#define SXACT_FLAG_READ_ONLY 0x00000020 -#define SXACT_FLAG_DEFERRABLE_WAITING 0x00000040 -#define SXACT_FLAG_RO_SAFE 0x00000080 -#define SXACT_FLAG_RO_UNSAFE 0x00000100 -#define SXACT_FLAG_SUMMARY_CONFLICT_IN 0x00000200 -#define SXACT_FLAG_SUMMARY_CONFLICT_OUT 0x00000400 +#define SXACT_FLAG_CONFLICT_OUT (1 << 4) +#define SXACT_FLAG_READ_ONLY (1 << 5) +#define SXACT_FLAG_DEFERRABLE_WAITING (1 << 6) +#define SXACT_FLAG_RO_SAFE (1 << 7) +#define SXACT_FLAG_RO_UNSAFE (1 << 8) +#define SXACT_FLAG_SUMMARY_CONFLICT_IN (1 << 9) +#define SXACT_FLAG_SUMMARY_CONFLICT_OUT (1 << 10) /* * The following flag means the transaction has been partially released * already, but is being preserved because parallel workers might have a * reference to it. It'll be recycled by the leader at end-of-transaction. */ -#define SXACT_FLAG_PARTIALLY_RELEASED 0x00000800 +#define SXACT_FLAG_PARTIALLY_RELEASED (1 << 11) /* * The following types are used to provide an ad hoc list for holding diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h index e77f76ae8a..e68f5cfe7b 100644 --- a/src/include/storage/proc.h +++ b/src/include/storage/proc.h @@ -51,14 +51,14 @@ struct XidCache /* * Flags for PGPROC->statusFlags and PROC_HDR->statusFlags[] */ -#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */ -#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */ -#define PROC_IN_SAFE_IC 0x04 /* currently running CREATE INDEX - * CONCURRENTLY on non-expressional, - * non-partial index */ -#define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */ -#define PROC_IN_LOGICAL_DECODING 0x10 /* currently doing logical - * decoding outside xact */ +#define PROC_IS_AUTOVACUUM (1 << 0) /* is it an autovac worker? */ +#define PROC_IN_VACUUM (1 << 1) /* currently running lazy vacuum */ +#define PROC_IN_SAFE_IC (1 << 2) /* currently running CREATE INDEX + * CONCURRENTLY on non-expressional, + * non-partial index */ +#define PROC_VACUUM_FOR_WRAPAROUND (1 << 3) /* set by autovac only */ +#define PROC_IN_LOGICAL_DECODING (1 << 4) /* currently doing logical + * decoding outside xact */ /* flags reset at EOXact */ #define PROC_VACUUM_STATE_MASK \ diff --git a/src/include/storage/reinit.h b/src/include/storage/reinit.h index 15d2e410dc..9dd3423c6e 100644 --- a/src/include/storage/reinit.h +++ b/src/include/storage/reinit.h @@ -22,7 +22,7 @@ extern void ResetUnloggedRelations(int op); extern bool parse_filename_for_nontemp_relation(const char *name, int *oidchars, ForkNumber *fork); -#define UNLOGGED_RELATION_CLEANUP 0x0001 -#define UNLOGGED_RELATION_INIT 0x0002 +#define UNLOGGED_RELATION_CLEANUP (1 << 0) +#define UNLOGGED_RELATION_INIT (1 << 1) #endif /* REINIT_H */ diff --git a/src/include/tcop/utility.h b/src/include/tcop/utility.h index 9594856c88..30acbfb521 100644 --- a/src/include/tcop/utility.h +++ b/src/include/tcop/utility.h @@ -53,9 +53,9 @@ typedef struct AlterTableUtilityContext * recovery. It can't write WAL, nor can it do things that would imperil * replay of future WAL received from the primary. */ -#define COMMAND_OK_IN_READ_ONLY_TXN 0x0001 -#define COMMAND_OK_IN_PARALLEL_MODE 0x0002 -#define COMMAND_OK_IN_RECOVERY 0x0004 +#define COMMAND_OK_IN_READ_ONLY_TXN (1 << 0) +#define COMMAND_OK_IN_PARALLEL_MODE (1 << 1) +#define COMMAND_OK_IN_RECOVERY (1 << 2) /* * We say that a command is strictly read-only if it is sufficiently read-only diff --git a/src/include/tsearch/ts_public.h b/src/include/tsearch/ts_public.h index 63aca2b1f5..1ecf581c1a 100644 --- a/src/include/tsearch/ts_public.h +++ b/src/include/tsearch/ts_public.h @@ -112,9 +112,9 @@ typedef struct } TSLexeme; /* Flag bits that can appear in TSLexeme.flags */ -#define TSL_ADDPOS 0x01 -#define TSL_PREFIX 0x02 -#define TSL_FILTER 0x04 +#define TSL_ADDPOS (1 << 0) +#define TSL_PREFIX (1 << 1) +#define TSL_FILTER (1 << 2) /* * Struct for supporting complex dictionaries like thesaurus. diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h index 4db5ad3f12..6e65b1f0bf 100644 --- a/src/include/utils/builtins.h +++ b/src/include/utils/builtins.h @@ -109,10 +109,10 @@ extern Datum numeric_float8_no_overflow(PG_FUNCTION_ARGS); /* format_type.c */ /* Control flags for format_type_extended */ -#define FORMAT_TYPE_TYPEMOD_GIVEN 0x01 /* typemod defined by caller */ -#define FORMAT_TYPE_ALLOW_INVALID 0x02 /* allow invalid types */ -#define FORMAT_TYPE_FORCE_QUALIFY 0x04 /* force qualification of type */ -#define FORMAT_TYPE_INVALID_AS_NULL 0x08 /* NULL if undefined */ +#define FORMAT_TYPE_TYPEMOD_GIVEN (1 << 0) /* typemod defined by caller */ +#define FORMAT_TYPE_ALLOW_INVALID (1 << 1) /* allow invalid types */ +#define FORMAT_TYPE_FORCE_QUALIFY (1 << 2) /* force qualification of type */ +#define FORMAT_TYPE_INVALID_AS_NULL (1 << 3) /* NULL if undefined */ extern char *format_type_extended(Oid type_oid, int32 typemod, bits16 flags); extern char *format_type_be(Oid type_oid); diff --git a/src/include/utils/dsa.h b/src/include/utils/dsa.h index e07126bc9a..ab199b0fe9 100644 --- a/src/include/utils/dsa.h +++ b/src/include/utils/dsa.h @@ -70,9 +70,9 @@ typedef pg_atomic_uint64 dsa_pointer_atomic; #endif /* Flags for dsa_allocate_extended. */ -#define DSA_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */ -#define DSA_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ -#define DSA_ALLOC_ZERO 0x04 /* zero allocated memory */ +#define DSA_ALLOC_HUGE (1 << 0) /* allow huge allocation (> 1 GB) */ +#define DSA_ALLOC_NO_OOM (1 << 1) /* no failure if out-of-memory */ +#define DSA_ALLOC_ZERO (1 << 2) /* zero allocated memory */ /* A sentinel value for dsa_pointer used to indicate failure to allocate. */ #define InvalidDsaPointer ((dsa_pointer) 0) diff --git a/src/include/utils/expandedrecord.h b/src/include/utils/expandedrecord.h index 75b5789345..3a76128008 100644 --- a/src/include/utils/expandedrecord.h +++ b/src/include/utils/expandedrecord.h @@ -49,14 +49,14 @@ typedef struct ExpandedRecordHeader /* Assorted flag bits */ int flags; -#define ER_FLAG_FVALUE_VALID 0x0001 /* fvalue is up to date? */ -#define ER_FLAG_FVALUE_ALLOCED 0x0002 /* fvalue is local storage? */ -#define ER_FLAG_DVALUES_VALID 0x0004 /* dvalues/dnulls are up to date? */ -#define ER_FLAG_DVALUES_ALLOCED 0x0008 /* any field values local storage? */ -#define ER_FLAG_HAVE_EXTERNAL 0x0010 /* any field values are external? */ -#define ER_FLAG_TUPDESC_ALLOCED 0x0020 /* tupdesc is local storage? */ -#define ER_FLAG_IS_DOMAIN 0x0040 /* er_decltypeid is domain? */ -#define ER_FLAG_IS_DUMMY 0x0080 /* this header is dummy (see below) */ +#define ER_FLAG_FVALUE_VALID (1 << 0) /* fvalue is up to date? */ +#define ER_FLAG_FVALUE_ALLOCED (1 << 1) /* fvalue is local storage? */ +#define ER_FLAG_DVALUES_VALID (1 << 2) /* dvalues/dnulls are up to date? */ +#define ER_FLAG_DVALUES_ALLOCED (1 << 3) /* any field values local storage? */ +#define ER_FLAG_HAVE_EXTERNAL (1 << 4) /* any field values are external? */ +#define ER_FLAG_TUPDESC_ALLOCED (1 << 5) /* tupdesc is local storage? */ +#define ER_FLAG_IS_DOMAIN (1 << 6) /* er_decltypeid is domain? */ +#define ER_FLAG_IS_DUMMY (1 << 7) /* this header is dummy (see below) */ /* flag bits that are not to be cleared when replacing tuple data: */ #define ER_FLAGS_NON_DATA \ (ER_FLAG_TUPDESC_ALLOCED | ER_FLAG_IS_DOMAIN | ER_FLAG_IS_DUMMY) diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h index 7f36e1146f..95535e22db 100644 --- a/src/include/utils/guc_tables.h +++ b/src/include/utils/guc_tables.h @@ -169,13 +169,13 @@ struct config_generic }; /* bit values in status field */ -#define GUC_IS_IN_FILE 0x0001 /* found it in config file */ +#define GUC_IS_IN_FILE (1 << 0) /* found it in config file */ /* * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile. * Do not assume that its value represents useful information elsewhere. */ -#define GUC_PENDING_RESTART 0x0002 /* changed value cannot be applied yet */ -#define GUC_NEEDS_REPORT 0x0004 /* new value must be reported to client */ +#define GUC_PENDING_RESTART (1 << 1) /* changed value cannot be applied yet */ +#define GUC_NEEDS_REPORT (1 << 2) /* new value must be reported to client */ /* GUC records for specific variable types */ diff --git a/src/include/utils/hsearch.h b/src/include/utils/hsearch.h index bebf89b3c4..edb9c2e3dd 100644 --- a/src/include/utils/hsearch.h +++ b/src/include/utils/hsearch.h @@ -79,19 +79,19 @@ typedef struct HASHCTL } HASHCTL; /* Flags to indicate which parameters are supplied */ -#define HASH_PARTITION 0x0001 /* Hashtable is used w/partitioned locking */ -#define HASH_SEGMENT 0x0002 /* Set segment size */ -#define HASH_DIRSIZE 0x0004 /* Set directory size (initial and max) */ -#define HASH_ELEM 0x0010 /* Set keysize and entrysize */ -#define HASH_BLOBS 0x0020 /* Select support functions for binary keys */ -#define HASH_FUNCTION 0x0040 /* Set user defined hash function */ -#define HASH_COMPARE 0x0080 /* Set user defined comparison function */ -#define HASH_KEYCOPY 0x0100 /* Set user defined key-copying function */ -#define HASH_ALLOC 0x0200 /* Set memory allocator */ -#define HASH_CONTEXT 0x0400 /* Set memory allocation context */ -#define HASH_SHARED_MEM 0x0800 /* Hashtable is in shared memory */ -#define HASH_ATTACH 0x1000 /* Do not initialize hctl */ -#define HASH_FIXED_SIZE 0x2000 /* Initial size is a hard limit */ +#define HASH_PARTITION (1 << 0) /* Hashtable is used w/partitioned locking */ +#define HASH_SEGMENT (1 << 1) /* Set segment size */ +#define HASH_DIRSIZE (1 << 2) /* Set directory size (initial and max) */ +#define HASH_ELEM (1 << 3) /* Set keysize and entrysize */ +#define HASH_BLOBS (1 << 4) /* Select support functions for binary keys */ +#define HASH_FUNCTION (1 << 5) /* Set user defined hash function */ +#define HASH_COMPARE (1 << 6) /* Set user defined comparison function */ +#define HASH_KEYCOPY (1 << 7) /* Set user defined key-copying function */ +#define HASH_ALLOC (1 << 8) /* Set memory allocator */ +#define HASH_CONTEXT (1 << 9) /* Set memory allocation context */ +#define HASH_SHARED_MEM (1 << 10) /* Hashtable is in shared memory */ +#define HASH_ATTACH (1 << 11) /* Do not initialize hctl */ +#define HASH_FIXED_SIZE (1 << 12) /* Initial size is a hard limit */ /* max_dsize value to indicate expansible directory */ diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index fecfe1f4f6..eec4162480 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -36,8 +36,8 @@ typedef enum IOFuncSelector } IOFuncSelector; /* Flag bits for get_attstatsslot */ -#define ATTSTATSSLOT_VALUES 0x01 -#define ATTSTATSSLOT_NUMBERS 0x02 +#define ATTSTATSSLOT_VALUES (1 << 0) +#define ATTSTATSSLOT_NUMBERS (1 << 1) /* Result struct for get_attstatsslot */ typedef struct AttStatsSlot diff --git a/src/include/utils/palloc.h b/src/include/utils/palloc.h index c801e12478..0279004ea4 100644 --- a/src/include/utils/palloc.h +++ b/src/include/utils/palloc.h @@ -61,9 +61,9 @@ extern PGDLLIMPORT MemoryContext CurrentMemoryContext; /* * Flags for MemoryContextAllocExtended. */ -#define MCXT_ALLOC_HUGE 0x01 /* allow huge allocation (> 1 GB) */ -#define MCXT_ALLOC_NO_OOM 0x02 /* no failure if out-of-memory */ -#define MCXT_ALLOC_ZERO 0x04 /* zero allocated memory */ +#define MCXT_ALLOC_HUGE (1 << 0) /* allow huge allocation (> 1 GB) */ +#define MCXT_ALLOC_NO_OOM (1 << 1) /* no failure if out-of-memory */ +#define MCXT_ALLOC_ZERO (1 << 2) /* zero allocated memory */ /* * Fundamental memory-allocation operations (more are in utils/memutils.h) diff --git a/src/include/utils/regproc.h b/src/include/utils/regproc.h index 330417e888..1d0ffa1469 100644 --- a/src/include/utils/regproc.h +++ b/src/include/utils/regproc.h @@ -16,8 +16,8 @@ #include "nodes/pg_list.h" /* Control flags for format_procedure_extended */ -#define FORMAT_PROC_INVALID_AS_NULL 0x01 /* NULL if undefined */ -#define FORMAT_PROC_FORCE_QUALIFY 0x02 /* force qualification */ +#define FORMAT_PROC_INVALID_AS_NULL (1 << 0) /* NULL if undefined */ +#define FORMAT_PROC_FORCE_QUALIFY (1 << 1) /* force qualification */ extern char *format_procedure_extended(Oid procedure_oid, bits16 flags); /* Control flags for format_operator_extended */ diff --git a/src/include/utils/sharedtuplestore.h b/src/include/utils/sharedtuplestore.h index 9754504cc5..ffe3105586 100644 --- a/src/include/utils/sharedtuplestore.h +++ b/src/include/utils/sharedtuplestore.h @@ -27,7 +27,7 @@ typedef struct SharedTuplestoreAccessor SharedTuplestoreAccessor; * A flag indicating that the tuplestore will only be scanned once, so backing * files can be unlinked early. */ -#define SHARED_TUPLESTORE_SINGLE_PASS 0x01 +#define SHARED_TUPLESTORE_SINGLE_PASS (1 << 0) extern size_t sts_estimate(int participants); diff --git a/src/include/utils/typcache.h b/src/include/utils/typcache.h index cdd20e56d7..f67d33efdd 100644 --- a/src/include/utils/typcache.h +++ b/src/include/utils/typcache.h @@ -127,22 +127,22 @@ typedef struct TypeCacheEntry } TypeCacheEntry; /* Bit flags to indicate which fields a given caller needs to have set */ -#define TYPECACHE_EQ_OPR 0x0001 -#define TYPECACHE_LT_OPR 0x0002 -#define TYPECACHE_GT_OPR 0x0004 -#define TYPECACHE_CMP_PROC 0x0008 -#define TYPECACHE_HASH_PROC 0x0010 -#define TYPECACHE_EQ_OPR_FINFO 0x0020 -#define TYPECACHE_CMP_PROC_FINFO 0x0040 -#define TYPECACHE_HASH_PROC_FINFO 0x0080 -#define TYPECACHE_TUPDESC 0x0100 -#define TYPECACHE_BTREE_OPFAMILY 0x0200 -#define TYPECACHE_HASH_OPFAMILY 0x0400 -#define TYPECACHE_RANGE_INFO 0x0800 -#define TYPECACHE_DOMAIN_BASE_INFO 0x1000 -#define TYPECACHE_DOMAIN_CONSTR_INFO 0x2000 -#define TYPECACHE_HASH_EXTENDED_PROC 0x4000 -#define TYPECACHE_HASH_EXTENDED_PROC_FINFO 0x8000 +#define TYPECACHE_EQ_OPR (1 << 0) +#define TYPECACHE_LT_OPR (1 << 1) +#define TYPECACHE_GT_OPR (1 << 2) +#define TYPECACHE_CMP_PROC (1 << 3) +#define TYPECACHE_HASH_PROC (1 << 4) +#define TYPECACHE_EQ_OPR_FINFO (1 << 5) +#define TYPECACHE_CMP_PROC_FINFO (1 << 6) +#define TYPECACHE_HASH_PROC_FINFO (1 << 7) +#define TYPECACHE_TUPDESC (1 << 8) +#define TYPECACHE_BTREE_OPFAMILY (1 << 9) +#define TYPECACHE_HASH_OPFAMILY (1 << 10) +#define TYPECACHE_RANGE_INFO (1 << 11) +#define TYPECACHE_DOMAIN_BASE_INFO (1 << 12) +#define TYPECACHE_DOMAIN_CONSTR_INFO (1 << 13) +#define TYPECACHE_HASH_EXTENDED_PROC (1 << 14) +#define TYPECACHE_HASH_EXTENDED_PROC_FINFO (1 << 15) /* This value will not equal any valid tupledesc identifier, nor 0 */ #define INVALID_TUPLEDESC_IDENTIFIER ((uint64) 1) diff --git a/src/test/isolation/isolationtester.c b/src/test/isolation/isolationtester.c index f80261c022..2ab82a6d23 100644 --- a/src/test/isolation/isolationtester.c +++ b/src/test/isolation/isolationtester.c @@ -41,8 +41,8 @@ static void run_all_permutations_recurse(TestSpec *testspec, int nsteps, static void run_named_permutations(TestSpec *testspec); static void run_permutation(TestSpec *testspec, int nsteps, Step **steps); -#define STEP_NONBLOCK 0x1 /* return 0 as soon as cmd waits for a lock */ -#define STEP_RETRY 0x2 /* this is a retry of a previously-waiting cmd */ +#define STEP_NONBLOCK (1 << 0) /* return 0 as soon as cmd waits for a lock */ +#define STEP_RETRY (1 << 1) /* this is a retry of a previously-waiting cmd */ static bool try_complete_step(TestSpec *testspec, Step *step, int flags); static int step_qsort_cmp(const void *a, const void *b); -- 2.29.2