1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-08 06:02:22 +03:00

Add trailing commas to enum definitions

Since C99, there can be a trailing comma after the last value in an
enum definition.  A lot of new code has been introducing this style on
the fly.  Some new patches are now taking an inconsistent approach to
this.  Some add the last comma on the fly if they add a new last
value, some are trying to preserve the existing style in each place,
some are even dropping the last comma if there was one.  We could
nudge this all in a consistent direction if we just add the trailing
commas everywhere once.

I omitted a few places where there was a fixed "last" value that will
always stay last.  I also skipped the header files of libpq and ecpg,
in case people want to use those with older compilers.  There were
also a small number of cases where the enum type wasn't used anywhere
(but the enum values were), which ended up confusing pgindent a bit,
so I left those alone.

Discussion: https://www.postgresql.org/message-id/flat/386f8c45-c8ac-4681-8add-e3b0852c1620%40eisentraut.org
This commit is contained in:
Peter Eisentraut
2023-10-26 09:16:25 +02:00
parent f0efa5aec1
commit 611806cd72
212 changed files with 390 additions and 390 deletions

View File

@@ -43,7 +43,7 @@ typedef enum XidBoundsViolation
XID_IN_FUTURE,
XID_PRECEDES_CLUSTERMIN,
XID_PRECEDES_RELMIN,
XID_BOUNDS_OK
XID_BOUNDS_OK,
} XidBoundsViolation;
typedef enum XidCommitStatus
@@ -51,14 +51,14 @@ typedef enum XidCommitStatus
XID_COMMITTED,
XID_IS_CURRENT_XID,
XID_IN_PROGRESS,
XID_ABORTED
XID_ABORTED,
} XidCommitStatus;
typedef enum SkipPages
{
SKIP_PAGES_ALL_FROZEN,
SKIP_PAGES_ALL_VISIBLE,
SKIP_PAGES_NONE
SKIP_PAGES_NONE,
} SkipPages;
/*

View File

@@ -35,7 +35,7 @@ enum gbtree_type
gbt_t_bool,
gbt_t_inet,
gbt_t_uuid,
gbt_t_enum
gbt_t_enum,
};
#endif

View File

@@ -33,7 +33,7 @@ typedef enum
{
PREWARM_PREFETCH,
PREWARM_READ,
PREWARM_BUFFER
PREWARM_BUFFER,
} PrewarmType;
static PGIOAlignedBlock blockbuffer;

View File

@@ -118,7 +118,7 @@ typedef enum pgssVersion
PGSS_V1_8,
PGSS_V1_9,
PGSS_V1_10,
PGSS_V1_11
PGSS_V1_11,
} pgssVersion;
typedef enum pgssStoreKind
@@ -282,7 +282,7 @@ typedef enum
{
PGSS_TRACK_NONE, /* track no statements */
PGSS_TRACK_TOP, /* only top level statements */
PGSS_TRACK_ALL /* all statements, including nested ones */
PGSS_TRACK_ALL, /* all statements, including nested ones */
} PGSSTrackLevel;
static const struct config_enum_entry track_options[] =

View File

@@ -29,7 +29,7 @@ PG_MODULE_MAGIC;
typedef enum HeapTupleForceOption
{
HEAP_FORCE_KILL,
HEAP_FORCE_FREEZE
HEAP_FORCE_FREEZE,
} HeapTupleForceOption;
PG_FUNCTION_INFO_V1(heap_force_kill);

View File

@@ -38,7 +38,7 @@ enum PGP_S2K_TYPE
{
PGP_S2K_SIMPLE = 0,
PGP_S2K_SALTED = 1,
PGP_S2K_ISALTED = 3
PGP_S2K_ISALTED = 3,
};
enum PGP_PKT_TYPE
@@ -60,7 +60,7 @@ enum PGP_PKT_TYPE
PGP_PKT_USER_ATTR = 17,
PGP_PKT_SYMENCRYPTED_DATA_MDC = 18,
PGP_PKT_MDC = 19,
PGP_PKT_PRIV_61 = 61 /* occurs in gpg secring */
PGP_PKT_PRIV_61 = 61, /* occurs in gpg secring */
};
enum PGP_PUB_ALGO_TYPE
@@ -69,7 +69,7 @@ enum PGP_PUB_ALGO_TYPE
PGP_PUB_RSA_ENCRYPT = 2,
PGP_PUB_RSA_SIGN = 3,
PGP_PUB_ELG_ENCRYPT = 16,
PGP_PUB_DSA_SIGN = 17
PGP_PUB_DSA_SIGN = 17,
};
enum PGP_SYMENC_TYPE
@@ -84,7 +84,7 @@ enum PGP_SYMENC_TYPE
PGP_SYM_AES_128 = 7, /* should */
PGP_SYM_AES_192 = 8,
PGP_SYM_AES_256 = 9,
PGP_SYM_TWOFISH = 10
PGP_SYM_TWOFISH = 10,
};
enum PGP_COMPR_TYPE
@@ -92,7 +92,7 @@ enum PGP_COMPR_TYPE
PGP_COMPR_NONE = 0, /* must */
PGP_COMPR_ZIP = 1, /* should */
PGP_COMPR_ZLIB = 2,
PGP_COMPR_BZIP2 = 3
PGP_COMPR_BZIP2 = 3,
};
enum PGP_DIGEST_TYPE
@@ -106,7 +106,7 @@ enum PGP_DIGEST_TYPE
PGP_DIGEST_HAVAL5_160 = 7, /* obsolete */
PGP_DIGEST_SHA256 = 8,
PGP_DIGEST_SHA384 = 9,
PGP_DIGEST_SHA512 = 10
PGP_DIGEST_SHA512 = 10,
};
#define PGP_MAX_KEY (256/8)

View File

@@ -83,7 +83,7 @@ typedef enum
* it has default collation that is not
* traceable to a foreign Var */
FDW_COLLATE_SAFE, /* collation derives from a foreign Var */
FDW_COLLATE_UNSAFE /* collation is non-default and derives from
FDW_COLLATE_UNSAFE, /* collation is non-default and derives from
* something other than a foreign Var */
} FDWCollateState;

View File

@@ -82,7 +82,7 @@ enum FdwScanPrivateIndex
* String describing join i.e. names of relations being joined and types
* of join, added when the scan is join
*/
FdwScanPrivateRelations
FdwScanPrivateRelations,
};
/*
@@ -108,7 +108,7 @@ enum FdwModifyPrivateIndex
/* has-returning flag (as a Boolean node) */
FdwModifyPrivateHasReturning,
/* Integer list of attribute numbers retrieved by RETURNING */
FdwModifyPrivateRetrievedAttrs
FdwModifyPrivateRetrievedAttrs,
};
/*
@@ -129,7 +129,7 @@ enum FdwDirectModifyPrivateIndex
/* Integer list of attribute numbers retrieved by RETURNING */
FdwDirectModifyPrivateRetrievedAttrs,
/* set-processed flag (as a Boolean node) */
FdwDirectModifyPrivateSetProcessed
FdwDirectModifyPrivateSetProcessed,
};
/*
@@ -285,7 +285,7 @@ enum FdwPathPrivateIndex
/* has-final-sort flag (as a Boolean node) */
FdwPathPrivateHasFinalSort,
/* has-limit flag (as a Boolean node) */
FdwPathPrivateHasLimit
FdwPathPrivateHasLimit,
};
/* Struct for extra information passed to estimate_path_cost_size() */

View File

@@ -143,7 +143,7 @@ typedef enum PgFdwSamplingMethod
ANALYZE_SAMPLE_AUTO, /* choose by server version */
ANALYZE_SAMPLE_RANDOM, /* remote random() */
ANALYZE_SAMPLE_SYSTEM, /* TABLESAMPLE system */
ANALYZE_SAMPLE_BERNOULLI /* TABLESAMPLE bernoulli */
ANALYZE_SAMPLE_BERNOULLI, /* TABLESAMPLE bernoulli */
} PgFdwSamplingMethod;
/* in postgres_fdw.c */

View File

@@ -35,7 +35,7 @@ enum trivalue
{
TRI_DEFAULT,
TRI_NO,
TRI_YES
TRI_YES,
};
struct _param