Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 611806c

Browse files
committed
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
1 parent f0efa5a commit 611806c

File tree

212 files changed

+390
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+390
-390
lines changed

contrib/amcheck/verify_heapam.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ typedef enum XidBoundsViolation
4343
XID_IN_FUTURE,
4444
XID_PRECEDES_CLUSTERMIN,
4545
XID_PRECEDES_RELMIN,
46-
XID_BOUNDS_OK
46+
XID_BOUNDS_OK,
4747
} XidBoundsViolation;
4848

4949
typedef enum XidCommitStatus
5050
{
5151
XID_COMMITTED,
5252
XID_IS_CURRENT_XID,
5353
XID_IN_PROGRESS,
54-
XID_ABORTED
54+
XID_ABORTED,
5555
} XidCommitStatus;
5656

5757
typedef enum SkipPages
5858
{
5959
SKIP_PAGES_ALL_FROZEN,
6060
SKIP_PAGES_ALL_VISIBLE,
61-
SKIP_PAGES_NONE
61+
SKIP_PAGES_NONE,
6262
} SkipPages;
6363

6464
/*

contrib/btree_gist/btree_gist.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum gbtree_type
3535
gbt_t_bool,
3636
gbt_t_inet,
3737
gbt_t_uuid,
38-
gbt_t_enum
38+
gbt_t_enum,
3939
};
4040

4141
#endif

contrib/pg_prewarm/pg_prewarm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ typedef enum
3333
{
3434
PREWARM_PREFETCH,
3535
PREWARM_READ,
36-
PREWARM_BUFFER
36+
PREWARM_BUFFER,
3737
} PrewarmType;
3838

3939
static PGIOAlignedBlock blockbuffer;

contrib/pg_stat_statements/pg_stat_statements.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ typedef enum pgssVersion
118118
PGSS_V1_8,
119119
PGSS_V1_9,
120120
PGSS_V1_10,
121-
PGSS_V1_11
121+
PGSS_V1_11,
122122
} pgssVersion;
123123

124124
typedef enum pgssStoreKind
@@ -282,7 +282,7 @@ typedef enum
282282
{
283283
PGSS_TRACK_NONE, /* track no statements */
284284
PGSS_TRACK_TOP, /* only top level statements */
285-
PGSS_TRACK_ALL /* all statements, including nested ones */
285+
PGSS_TRACK_ALL, /* all statements, including nested ones */
286286
} PGSSTrackLevel;
287287

288288
static const struct config_enum_entry track_options[] =

contrib/pg_surgery/heap_surgery.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PG_MODULE_MAGIC;
2929
typedef enum HeapTupleForceOption
3030
{
3131
HEAP_FORCE_KILL,
32-
HEAP_FORCE_FREEZE
32+
HEAP_FORCE_FREEZE,
3333
} HeapTupleForceOption;
3434

3535
PG_FUNCTION_INFO_V1(heap_force_kill);

contrib/pgcrypto/pgp.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ enum PGP_S2K_TYPE
3838
{
3939
PGP_S2K_SIMPLE = 0,
4040
PGP_S2K_SALTED = 1,
41-
PGP_S2K_ISALTED = 3
41+
PGP_S2K_ISALTED = 3,
4242
};
4343

4444
enum PGP_PKT_TYPE
@@ -60,7 +60,7 @@ enum PGP_PKT_TYPE
6060
PGP_PKT_USER_ATTR = 17,
6161
PGP_PKT_SYMENCRYPTED_DATA_MDC = 18,
6262
PGP_PKT_MDC = 19,
63-
PGP_PKT_PRIV_61 = 61 /* occurs in gpg secring */
63+
PGP_PKT_PRIV_61 = 61, /* occurs in gpg secring */
6464
};
6565

6666
enum PGP_PUB_ALGO_TYPE
@@ -69,7 +69,7 @@ enum PGP_PUB_ALGO_TYPE
6969
PGP_PUB_RSA_ENCRYPT = 2,
7070
PGP_PUB_RSA_SIGN = 3,
7171
PGP_PUB_ELG_ENCRYPT = 16,
72-
PGP_PUB_DSA_SIGN = 17
72+
PGP_PUB_DSA_SIGN = 17,
7373
};
7474

7575
enum PGP_SYMENC_TYPE
@@ -84,15 +84,15 @@ enum PGP_SYMENC_TYPE
8484
PGP_SYM_AES_128 = 7, /* should */
8585
PGP_SYM_AES_192 = 8,
8686
PGP_SYM_AES_256 = 9,
87-
PGP_SYM_TWOFISH = 10
87+
PGP_SYM_TWOFISH = 10,
8888
};
8989

9090
enum PGP_COMPR_TYPE
9191
{
9292
PGP_COMPR_NONE = 0, /* must */
9393
PGP_COMPR_ZIP = 1, /* should */
9494
PGP_COMPR_ZLIB = 2,
95-
PGP_COMPR_BZIP2 = 3
95+
PGP_COMPR_BZIP2 = 3,
9696
};
9797

9898
enum PGP_DIGEST_TYPE
@@ -106,7 +106,7 @@ enum PGP_DIGEST_TYPE
106106
PGP_DIGEST_HAVAL5_160 = 7, /* obsolete */
107107
PGP_DIGEST_SHA256 = 8,
108108
PGP_DIGEST_SHA384 = 9,
109-
PGP_DIGEST_SHA512 = 10
109+
PGP_DIGEST_SHA512 = 10,
110110
};
111111

112112
#define PGP_MAX_KEY (256/8)

contrib/postgres_fdw/deparse.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ typedef enum
8383
* it has default collation that is not
8484
* traceable to a foreign Var */
8585
FDW_COLLATE_SAFE, /* collation derives from a foreign Var */
86-
FDW_COLLATE_UNSAFE /* collation is non-default and derives from
86+
FDW_COLLATE_UNSAFE, /* collation is non-default and derives from
8787
* something other than a foreign Var */
8888
} FDWCollateState;
8989

contrib/postgres_fdw/postgres_fdw.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ enum FdwScanPrivateIndex
8282
* String describing join i.e. names of relations being joined and types
8383
* of join, added when the scan is join
8484
*/
85-
FdwScanPrivateRelations
85+
FdwScanPrivateRelations,
8686
};
8787

8888
/*
@@ -108,7 +108,7 @@ enum FdwModifyPrivateIndex
108108
/* has-returning flag (as a Boolean node) */
109109
FdwModifyPrivateHasReturning,
110110
/* Integer list of attribute numbers retrieved by RETURNING */
111-
FdwModifyPrivateRetrievedAttrs
111+
FdwModifyPrivateRetrievedAttrs,
112112
};
113113

114114
/*
@@ -129,7 +129,7 @@ enum FdwDirectModifyPrivateIndex
129129
/* Integer list of attribute numbers retrieved by RETURNING */
130130
FdwDirectModifyPrivateRetrievedAttrs,
131131
/* set-processed flag (as a Boolean node) */
132-
FdwDirectModifyPrivateSetProcessed
132+
FdwDirectModifyPrivateSetProcessed,
133133
};
134134

135135
/*
@@ -285,7 +285,7 @@ enum FdwPathPrivateIndex
285285
/* has-final-sort flag (as a Boolean node) */
286286
FdwPathPrivateHasFinalSort,
287287
/* has-limit flag (as a Boolean node) */
288-
FdwPathPrivateHasLimit
288+
FdwPathPrivateHasLimit,
289289
};
290290

291291
/* Struct for extra information passed to estimate_path_cost_size() */

contrib/postgres_fdw/postgres_fdw.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ typedef enum PgFdwSamplingMethod
143143
ANALYZE_SAMPLE_AUTO, /* choose by server version */
144144
ANALYZE_SAMPLE_RANDOM, /* remote random() */
145145
ANALYZE_SAMPLE_SYSTEM, /* TABLESAMPLE system */
146-
ANALYZE_SAMPLE_BERNOULLI /* TABLESAMPLE bernoulli */
146+
ANALYZE_SAMPLE_BERNOULLI, /* TABLESAMPLE bernoulli */
147147
} PgFdwSamplingMethod;
148148

149149
/* in postgres_fdw.c */

contrib/vacuumlo/vacuumlo.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ enum trivalue
3535
{
3636
TRI_DEFAULT,
3737
TRI_NO,
38-
TRI_YES
38+
TRI_YES,
3939
};
4040

4141
struct _param

src/backend/access/gist/gistbuild.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ typedef enum
7575
GIST_BUFFERING_STATS, /* gathering statistics of index tuple size
7676
* before switching to the buffering build
7777
* mode */
78-
GIST_BUFFERING_ACTIVE /* in buffering build mode */
78+
GIST_BUFFERING_ACTIVE, /* in buffering build mode */
7979
} GistBuildMode;
8080

8181
/* Working state for gistbuild and its callback */

src/backend/access/heap/vacuumlazy.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ typedef enum
135135
VACUUM_ERRCB_PHASE_VACUUM_INDEX,
136136
VACUUM_ERRCB_PHASE_VACUUM_HEAP,
137137
VACUUM_ERRCB_PHASE_INDEX_CLEANUP,
138-
VACUUM_ERRCB_PHASE_TRUNCATE
138+
VACUUM_ERRCB_PHASE_TRUNCATE,
139139
} VacErrPhase;
140140

141141
typedef struct LVRelState

src/backend/access/nbtree/nbtree.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ typedef enum
5656
BTPARALLEL_NOT_INITIALIZED,
5757
BTPARALLEL_ADVANCING,
5858
BTPARALLEL_IDLE,
59-
BTPARALLEL_DONE
59+
BTPARALLEL_DONE,
6060
} BTPS_State;
6161

6262
/*

src/backend/access/nbtree/nbtsplitloc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef enum
2222
/* strategy for searching through materialized list of split points */
2323
SPLIT_DEFAULT, /* give some weight to truncation */
2424
SPLIT_MANY_DUPLICATES, /* find minimally distinguishing point */
25-
SPLIT_SINGLE_VALUE /* leave left page almost full */
25+
SPLIT_SINGLE_VALUE, /* leave left page almost full */
2626
} FindSplitStrat;
2727

2828
typedef struct

src/backend/access/spgist/spgscan.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ enum SpGistSpecialOffsetNumbers
756756
{
757757
SpGistBreakOffsetNumber = InvalidOffsetNumber,
758758
SpGistRedirectOffsetNumber = MaxOffsetNumber + 1,
759-
SpGistErrorOffsetNumber = MaxOffsetNumber + 2
759+
SpGistErrorOffsetNumber = MaxOffsetNumber + 2,
760760
};
761761

762762
static OffsetNumber

src/backend/access/transam/slru.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ typedef enum
128128
SLRU_READ_FAILED,
129129
SLRU_WRITE_FAILED,
130130
SLRU_FSYNC_FAILED,
131-
SLRU_CLOSE_FAILED
131+
SLRU_CLOSE_FAILED,
132132
} SlruErrorCause;
133133

134134
static SlruErrorCause slru_errcause;

src/backend/access/transam/xact.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef enum TransState
145145
TRANS_INPROGRESS, /* inside a valid transaction */
146146
TRANS_COMMIT, /* commit in progress */
147147
TRANS_ABORT, /* abort in progress */
148-
TRANS_PREPARE /* prepare in progress */
148+
TRANS_PREPARE, /* prepare in progress */
149149
} TransState;
150150

151151
/*
@@ -180,7 +180,7 @@ typedef enum TBlockState
180180
TBLOCK_SUBABORT_END, /* failed subxact, ROLLBACK received */
181181
TBLOCK_SUBABORT_PENDING, /* live subxact, ROLLBACK received */
182182
TBLOCK_SUBRESTART, /* live subxact, ROLLBACK TO received */
183-
TBLOCK_SUBABORT_RESTART /* failed subxact, ROLLBACK TO received */
183+
TBLOCK_SUBABORT_RESTART, /* failed subxact, ROLLBACK TO received */
184184
} TBlockState;
185185

186186
/*

src/backend/access/transam/xlogprefetcher.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ typedef enum
8888
{
8989
LRQ_NEXT_NO_IO,
9090
LRQ_NEXT_IO,
91-
LRQ_NEXT_AGAIN
91+
LRQ_NEXT_AGAIN,
9292
} LsnReadQueueNextStatus;
9393

9494
/*

src/backend/access/transam/xlogrecovery.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ typedef enum
211211
XLOG_FROM_ANY = 0, /* request to read WAL from any source */
212212
XLOG_FROM_ARCHIVE, /* restored using restore_command */
213213
XLOG_FROM_PG_WAL, /* existing file in pg_wal */
214-
XLOG_FROM_STREAM /* streamed from primary */
214+
XLOG_FROM_STREAM, /* streamed from primary */
215215
} XLogSource;
216216

217217
/* human-readable names for XLogSources, for debugging output */

src/backend/catalog/pg_shdepend.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ typedef enum
7373
{
7474
LOCAL_OBJECT,
7575
SHARED_OBJECT,
76-
REMOTE_OBJECT
76+
REMOTE_OBJECT,
7777
} SharedDependencyObjectType;
7878

7979
typedef struct

src/backend/commands/async.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ typedef enum
351351
{
352352
LISTEN_LISTEN,
353353
LISTEN_UNLISTEN,
354-
LISTEN_UNLISTEN_ALL
354+
LISTEN_UNLISTEN_ALL,
355355
} ListenActionKind;
356356

357357
typedef struct

src/backend/commands/copyto.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typedef enum CopyDest
5151
{
5252
COPY_FILE, /* to file (or a piped program) */
5353
COPY_FRONTEND, /* to frontend */
54-
COPY_CALLBACK /* to callback function */
54+
COPY_CALLBACK, /* to callback function */
5555
} CopyDest;
5656

5757
/*

src/backend/commands/dbcommands.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
typedef enum CreateDBStrategy
8484
{
8585
CREATEDB_WAL_LOG,
86-
CREATEDB_FILE_COPY
86+
CREATEDB_FILE_COPY,
8787
} CreateDBStrategy;
8888

8989
typedef struct

src/backend/commands/user.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ typedef enum
6464
RRG_REMOVE_ADMIN_OPTION,
6565
RRG_REMOVE_INHERIT_OPTION,
6666
RRG_REMOVE_SET_OPTION,
67-
RRG_DELETE_GRANT
67+
RRG_DELETE_GRANT,
6868
} RevokeRoleGrantAction;
6969

7070
/* Potentially set by pg_upgrade_support functions */

src/backend/commands/vacuumparallel.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ typedef enum PVIndVacStatus
118118
PARALLEL_INDVAC_STATUS_INITIAL = 0,
119119
PARALLEL_INDVAC_STATUS_NEED_BULKDELETE,
120120
PARALLEL_INDVAC_STATUS_NEED_CLEANUP,
121-
PARALLEL_INDVAC_STATUS_COMPLETED
121+
PARALLEL_INDVAC_STATUS_COMPLETED,
122122
} PVIndVacStatus;
123123

124124
/*

src/backend/executor/execIndexing.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ typedef enum
121121
{
122122
CEOUC_WAIT,
123123
CEOUC_NOWAIT,
124-
CEOUC_LIVELOCK_PREVENTING_WAIT
124+
CEOUC_LIVELOCK_PREVENTING_WAIT,
125125
} CEOUC_WAIT_MODE;
126126

127127
static bool check_exclusion_or_unique_constraint(Relation heap, Relation index,

src/backend/executor/functions.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ typedef struct
5959
*/
6060
typedef enum
6161
{
62-
F_EXEC_START, F_EXEC_RUN, F_EXEC_DONE
62+
F_EXEC_START, F_EXEC_RUN, F_EXEC_DONE,
6363
} ExecStatus;
6464

6565
typedef struct execution_state

src/backend/executor/nodeMergejoin.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ typedef enum
145145
{
146146
MJEVAL_MATCHABLE, /* normal, potentially matchable tuple */
147147
MJEVAL_NONMATCHABLE, /* tuple cannot join because it has a null */
148-
MJEVAL_ENDOFJOIN /* end of input (physical or effective) */
148+
MJEVAL_ENDOFJOIN, /* end of input (physical or effective) */
149149
} MJEvalResult;
150150

151151

src/backend/executor/nodeTidrangescan.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
typedef enum
4040
{
4141
TIDEXPR_UPPER_BOUND,
42-
TIDEXPR_LOWER_BOUND
42+
TIDEXPR_LOWER_BOUND,
4343
} TidExprType;
4444

4545
/* Upper or lower range bound for scan */

src/backend/libpq/auth-scram.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ typedef enum
129129
{
130130
SCRAM_AUTH_INIT,
131131
SCRAM_AUTH_SALT_SENT,
132-
SCRAM_AUTH_FINISHED
132+
SCRAM_AUTH_FINISHED,
133133
} scram_state_enum;
134134

135135
typedef struct

src/backend/nodes/tidbitmap.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ typedef enum
129129
{
130130
TBM_EMPTY, /* no hashtable, nentries == 0 */
131131
TBM_ONE_PAGE, /* entry1 contains the single entry */
132-
TBM_HASH /* pagetable is valid, entry1 is not */
132+
TBM_HASH, /* pagetable is valid, entry1 is not */
133133
} TBMStatus;
134134

135135
/*
@@ -139,7 +139,7 @@ typedef enum
139139
{
140140
TBM_NOT_ITERATING, /* not yet converted to page and chunk array */
141141
TBM_ITERATING_PRIVATE, /* converted to local page and chunk array */
142-
TBM_ITERATING_SHARED /* converted to shared page and chunk array */
142+
TBM_ITERATING_SHARED, /* converted to shared page and chunk array */
143143
} TBMIteratingState;
144144

145145
/*

0 commit comments

Comments
 (0)