1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +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

@@ -51,7 +51,7 @@ typedef enum IndexAMProperty
AMPROP_CAN_UNIQUE,
AMPROP_CAN_MULTI_COL,
AMPROP_CAN_EXCLUDE,
AMPROP_CAN_INCLUDE
AMPROP_CAN_INCLUDE,
} IndexAMProperty;
/*

View File

@@ -117,7 +117,7 @@ typedef enum IndexUniqueCheck
UNIQUE_CHECK_NO, /* Don't do any uniqueness checking */
UNIQUE_CHECK_YES, /* Enforce uniqueness at insertion time */
UNIQUE_CHECK_PARTIAL, /* Test uniqueness, but no error */
UNIQUE_CHECK_EXISTING /* Check if existing tuple is unique */
UNIQUE_CHECK_EXISTING, /* Check if existing tuple is unique */
} IndexUniqueCheck;

View File

@@ -143,7 +143,7 @@ typedef enum
{
GPTP_NO_WORK,
GPTP_INSERT,
GPTP_SPLIT
GPTP_SPLIT,
} GinPlaceToPageRC;
typedef struct GinBtreeData

View File

@@ -385,7 +385,7 @@ typedef enum GistOptBufferingMode
{
GIST_OPTION_BUFFERING_AUTO,
GIST_OPTION_BUFFERING_ON,
GIST_OPTION_BUFFERING_OFF
GIST_OPTION_BUFFERING_OFF,
} GistOptBufferingMode;
/*

View File

@@ -97,7 +97,7 @@ typedef enum
HEAPTUPLE_LIVE, /* tuple is live (committed, no deleter) */
HEAPTUPLE_RECENTLY_DEAD, /* tuple is dead, but not deletable yet */
HEAPTUPLE_INSERT_IN_PROGRESS, /* inserting xact is still in progress */
HEAPTUPLE_DELETE_IN_PROGRESS /* deleting xact is still in progress */
HEAPTUPLE_DELETE_IN_PROGRESS, /* deleting xact is still in progress */
} HTSV_Result;
/*

View File

@@ -47,7 +47,7 @@ typedef enum
/* an update that doesn't touch "key" columns */
MultiXactStatusNoKeyUpdate = 0x04,
/* other updates, and delete */
MultiXactStatusUpdate = 0x05
MultiXactStatusUpdate = 0x05,
} MultiXactStatus;
#define MaxMultiXactStatus MultiXactStatusUpdate

View File

@@ -32,7 +32,7 @@ typedef enum relopt_type
RELOPT_TYPE_INT,
RELOPT_TYPE_REAL,
RELOPT_TYPE_ENUM,
RELOPT_TYPE_STRING
RELOPT_TYPE_STRING,
} relopt_type;
/* kinds supported by reloptions */

View File

@@ -44,7 +44,7 @@ typedef enum
SLRU_PAGE_EMPTY, /* buffer is not in use */
SLRU_PAGE_READ_IN_PROGRESS, /* page is being read in */
SLRU_PAGE_VALID, /* page is valid and not being written */
SLRU_PAGE_WRITE_IN_PROGRESS /* page is being written out */
SLRU_PAGE_WRITE_IN_PROGRESS, /* page is being written out */
} SlruPageStatus;
/*

View File

@@ -68,7 +68,7 @@ typedef enum spgChooseResultType
{
spgMatchNode = 1, /* descend into existing node */
spgAddNode, /* add a node to the inner tuple */
spgSplitTuple /* split inner tuple (change its prefix) */
spgSplitTuple, /* split inner tuple (change its prefix) */
} spgChooseResultType;
typedef struct spgChooseOut

View File

@@ -61,8 +61,8 @@ typedef enum ScanOptions
SO_ALLOW_PAGEMODE = 1 << 8,
/* unregister snapshot at scan end? */
SO_TEMP_SNAPSHOT = 1 << 9
} ScanOptions;
SO_TEMP_SNAPSHOT = 1 << 9,
} ScanOptions;
/*
* Result codes for table_{update,delete,lock_tuple}, and for visibility
@@ -99,7 +99,7 @@ typedef enum TM_Result
TM_BeingModified,
/* lock couldn't be acquired, action skipped. Only used by lock_tuple */
TM_WouldBlock
TM_WouldBlock,
} TM_Result;
/*
@@ -115,7 +115,7 @@ typedef enum TU_UpdateIndexes
TU_All,
/* Only summarized columns were updated, TID is unchanged */
TU_Summarizing
TU_Summarizing,
} TU_UpdateIndexes;
/*

View File

@@ -38,7 +38,7 @@ typedef enum ToastCompressionId
{
TOAST_PGLZ_COMPRESSION_ID = 0,
TOAST_LZ4_COMPRESSION_ID = 1,
TOAST_INVALID_COMPRESSION_ID = 2
TOAST_INVALID_COMPRESSION_ID = 2,
} ToastCompressionId;
/*

View File

@@ -72,8 +72,8 @@ typedef enum
SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote
* write */
SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */
SYNCHRONOUS_COMMIT_REMOTE_APPLY /* wait for local and remote flush and
* remote apply */
SYNCHRONOUS_COMMIT_REMOTE_APPLY, /* wait for local and remote flush and
* remote apply */
} SyncCommitLevel;
/* Define the default setting for synchronous_commit */
@@ -132,7 +132,7 @@ typedef enum
XACT_EVENT_PREPARE,
XACT_EVENT_PRE_COMMIT,
XACT_EVENT_PARALLEL_PRE_COMMIT,
XACT_EVENT_PRE_PREPARE
XACT_EVENT_PRE_PREPARE,
} XactEvent;
typedef void (*XactCallback) (XactEvent event, void *arg);
@@ -142,7 +142,7 @@ typedef enum
SUBXACT_EVENT_START_SUB,
SUBXACT_EVENT_COMMIT_SUB,
SUBXACT_EVENT_ABORT_SUB,
SUBXACT_EVENT_PRE_COMMIT_SUB
SUBXACT_EVENT_PRE_COMMIT_SUB,
} SubXactEvent;
typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,

View File

@@ -62,7 +62,7 @@ typedef enum ArchiveMode
{
ARCHIVE_MODE_OFF = 0, /* disabled */
ARCHIVE_MODE_ON, /* enabled while server is running normally */
ARCHIVE_MODE_ALWAYS /* enabled always (even during recovery) */
ARCHIVE_MODE_ALWAYS, /* enabled always (even during recovery) */
} ArchiveMode;
extern PGDLLIMPORT int XLogArchiveMode;
@@ -71,7 +71,7 @@ typedef enum WalLevel
{
WAL_LEVEL_MINIMAL = 0,
WAL_LEVEL_REPLICA,
WAL_LEVEL_LOGICAL
WAL_LEVEL_LOGICAL,
} WalLevel;
/* Compression algorithms for WAL */
@@ -80,7 +80,7 @@ typedef enum WalCompression
WAL_COMPRESSION_NONE = 0,
WAL_COMPRESSION_PGLZ,
WAL_COMPRESSION_LZ4,
WAL_COMPRESSION_ZSTD
WAL_COMPRESSION_ZSTD,
} WalCompression;
/* Recovery states */
@@ -88,7 +88,7 @@ typedef enum RecoveryState
{
RECOVERY_STATE_CRASH = 0, /* crash recovery */
RECOVERY_STATE_ARCHIVE, /* archive recovery */
RECOVERY_STATE_DONE /* currently in production */
RECOVERY_STATE_DONE, /* currently in production */
} RecoveryState;
extern PGDLLIMPORT int wal_level;
@@ -190,7 +190,7 @@ typedef enum WALAvailability
WALAVAIL_EXTENDED, /* WAL segment is reserved by a slot or
* wal_keep_size */
WALAVAIL_UNRESERVED, /* no longer reserved, but not removed yet */
WALAVAIL_REMOVED /* WAL segment has been removed */
WALAVAIL_REMOVED, /* WAL segment has been removed */
} WALAvailability;
struct XLogRecData;

View File

@@ -322,7 +322,7 @@ typedef enum
{
RECOVERY_TARGET_ACTION_PAUSE,
RECOVERY_TARGET_ACTION_PROMOTE,
RECOVERY_TARGET_ACTION_SHUTDOWN
RECOVERY_TARGET_ACTION_SHUTDOWN,
} RecoveryTargetAction;
struct LogicalDecodingContext;

View File

@@ -25,7 +25,7 @@ typedef enum
{
RECOVERY_PREFETCH_OFF,
RECOVERY_PREFETCH_ON,
RECOVERY_PREFETCH_TRY
RECOVERY_PREFETCH_TRY,
} RecoveryPrefetchValue;
struct XLogPrefetcher;

View File

@@ -350,7 +350,7 @@ typedef enum XLogPageReadResult
{
XLREAD_SUCCESS = 0, /* record is successfully read */
XLREAD_FAIL = -1, /* failed during reading a record */
XLREAD_WOULDBLOCK = -2 /* nonblocking mode only, no data */
XLREAD_WOULDBLOCK = -2, /* nonblocking mode only, no data */
} XLogPageReadResult;
/* Read the next XLog record. Returns NULL on end-of-WAL or failure */

View File

@@ -27,7 +27,7 @@ typedef enum
RECOVERY_TARGET_TIME,
RECOVERY_TARGET_NAME,
RECOVERY_TARGET_LSN,
RECOVERY_TARGET_IMMEDIATE
RECOVERY_TARGET_IMMEDIATE,
} RecoveryTargetType;
/*
@@ -37,7 +37,7 @@ typedef enum
{
RECOVERY_TARGET_TIMELINE_CONTROLFILE,
RECOVERY_TARGET_TIMELINE_LATEST,
RECOVERY_TARGET_TIMELINE_NUMERIC
RECOVERY_TARGET_TIMELINE_NUMERIC,
} RecoveryTargetTimeLineGoal;
/* Recovery pause states */
@@ -45,7 +45,7 @@ typedef enum RecoveryPauseState
{
RECOVERY_NOT_PAUSED, /* pause not requested */
RECOVERY_PAUSE_REQUESTED, /* pause requested, but not yet paused */
RECOVERY_PAUSED /* recovery is paused */
RECOVERY_PAUSED, /* recovery is paused */
} RecoveryPauseState;
/* User-settable GUC parameters */

View File

@@ -49,7 +49,7 @@ typedef enum
STANDBY_DISABLED,
STANDBY_INITIALIZED,
STANDBY_SNAPSHOT_PENDING,
STANDBY_SNAPSHOT_READY
STANDBY_SNAPSHOT_READY,
} HotStandbyState;
extern PGDLLIMPORT HotStandbyState standbyState;
@@ -71,7 +71,7 @@ typedef enum
BLK_NEEDS_REDO, /* changes from WAL record need to be applied */
BLK_DONE, /* block is already up-to-date */
BLK_RESTORED, /* block was restored from a full-page image */
BLK_NOTFOUND /* block was not found (and hence does not
BLK_NOTFOUND, /* block was not found (and hence does not
* need to be replayed) */
} XLogRedoAction;