Skip to content

Commit 4b05548

Browse files
Gary V. Vaughangitster
Gary V. Vaughan
authored andcommitted
enums: omit trailing comma for portability
Without this patch at least IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to compile git. enum style is inconsistent already, with some enums declared on one line, some over 3 lines with the enum values all on the middle line, sometimes with 1 enum value per line... and independently of that the trailing comma is sometimes present and other times absent, often mixing with/without trailing comma styles in a single file, and sometimes in consecutive enum declarations. Clearly, omitting the comma is the more portable style, and this patch changes all enum declarations to use the portable omitted dangling comma style consistently. Signed-off-by: Gary V. Vaughan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48793cf commit 4b05548

26 files changed

+45
-45
lines changed

attr.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ int git_checkattr(const char *path, int, struct git_attr_check *);
3434
enum git_attr_direction {
3535
GIT_ATTR_CHECKIN,
3636
GIT_ATTR_CHECKOUT,
37-
GIT_ATTR_INDEX,
37+
GIT_ATTR_INDEX
3838
};
3939
void git_attr_set_direction(enum git_attr_direction, struct index_state *);
4040

builtin/apply.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,15 @@ static enum ws_error_action {
5656
nowarn_ws_error,
5757
warn_on_ws_error,
5858
die_on_ws_error,
59-
correct_ws_error,
59+
correct_ws_error
6060
} ws_error_action = warn_on_ws_error;
6161
static int whitespace_error;
6262
static int squelch_whitespace_errors = 5;
6363
static int applied_after_fixing_ws;
6464

6565
static enum ws_ignore {
6666
ignore_ws_none,
67-
ignore_ws_change,
67+
ignore_ws_change
6868
} ws_ignore_action = ignore_ws_none;
6969

7070

builtin/branch.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ enum color_branch {
4343
BRANCH_COLOR_PLAIN = 1,
4444
BRANCH_COLOR_REMOTE = 2,
4545
BRANCH_COLOR_LOCAL = 3,
46-
BRANCH_COLOR_CURRENT = 4,
46+
BRANCH_COLOR_CURRENT = 4
4747
};
4848

4949
static enum merge_filter {
5050
NO_FILTER = 0,
5151
SHOW_NOT_MERGED,
52-
SHOW_MERGED,
52+
SHOW_MERGED
5353
} merge_filter;
5454
static unsigned char merge_filter_ref[20];
5555

builtin/commit.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static struct lock_file false_lock; /* used only for partial commits */
5757
static enum {
5858
COMMIT_AS_IS = 1,
5959
COMMIT_NORMAL,
60-
COMMIT_PARTIAL,
60+
COMMIT_PARTIAL
6161
} commit_style;
6262

6363
static const char *logfile, *force_author;
@@ -78,7 +78,7 @@ static char *untracked_files_arg, *force_date;
7878
static enum {
7979
CLEANUP_SPACE,
8080
CLEANUP_NONE,
81-
CLEANUP_ALL,
81+
CLEANUP_ALL
8282
} cleanup_mode;
8383
static char *cleanup_arg;
8484

@@ -90,7 +90,7 @@ static int null_termination;
9090
static enum {
9191
STATUS_FORMAT_LONG,
9292
STATUS_FORMAT_SHORT,
93-
STATUS_FORMAT_PORCELAIN,
93+
STATUS_FORMAT_PORCELAIN
9494
} status_format = STATUS_FORMAT_LONG;
9595

9696
static int opt_parse_m(const struct option *opt, const char *arg, int unset)

builtin/help.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ enum help_format {
2626
HELP_FORMAT_NONE,
2727
HELP_FORMAT_MAN,
2828
HELP_FORMAT_INFO,
29-
HELP_FORMAT_WEB,
29+
HELP_FORMAT_WEB
3030
};
3131

3232
static int show_all = 0;

builtin/mailinfo.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ static struct strbuf name = STRBUF_INIT;
1717
static struct strbuf email = STRBUF_INIT;
1818

1919
static enum {
20-
TE_DONTCARE, TE_QP, TE_BASE64,
20+
TE_DONTCARE, TE_QP, TE_BASE64
2121
} transfer_encoding;
2222
static enum {
23-
TYPE_TEXT, TYPE_OTHER,
23+
TYPE_TEXT, TYPE_OTHER
2424
} message_type;
2525

2626
static struct strbuf charset = STRBUF_INIT;

builtin/receive-pack.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ enum deny_action {
1616
DENY_UNCONFIGURED,
1717
DENY_IGNORE,
1818
DENY_WARN,
19-
DENY_REFUSE,
19+
DENY_REFUSE
2020
};
2121

2222
static int deny_deletes;

builtin/remote.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ struct push_info {
317317
PUSH_STATUS_UPTODATE,
318318
PUSH_STATUS_FASTFORWARD,
319319
PUSH_STATUS_OUTOFDATE,
320-
PUSH_STATUS_NOTQUERIED,
320+
PUSH_STATUS_NOTQUERIED
321321
} status;
322322
};
323323

cache.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ enum object_type {
361361
OBJ_OFS_DELTA = 6,
362362
OBJ_REF_DELTA = 7,
363363
OBJ_ANY,
364-
OBJ_MAX,
364+
OBJ_MAX
365365
};
366366

367367
static inline enum object_type object_type(unsigned int mode)
@@ -556,7 +556,7 @@ extern int core_apply_sparse_checkout;
556556
enum safe_crlf {
557557
SAFE_CRLF_FALSE = 0,
558558
SAFE_CRLF_FAIL = 1,
559-
SAFE_CRLF_WARN = 2,
559+
SAFE_CRLF_WARN = 2
560560
};
561561

562562
extern enum safe_crlf safe_crlf;
@@ -567,21 +567,21 @@ enum branch_track {
567567
BRANCH_TRACK_REMOTE,
568568
BRANCH_TRACK_ALWAYS,
569569
BRANCH_TRACK_EXPLICIT,
570-
BRANCH_TRACK_OVERRIDE,
570+
BRANCH_TRACK_OVERRIDE
571571
};
572572

573573
enum rebase_setup_type {
574574
AUTOREBASE_NEVER = 0,
575575
AUTOREBASE_LOCAL,
576576
AUTOREBASE_REMOTE,
577-
AUTOREBASE_ALWAYS,
577+
AUTOREBASE_ALWAYS
578578
};
579579

580580
enum push_default_type {
581581
PUSH_DEFAULT_NOTHING = 0,
582582
PUSH_DEFAULT_MATCHING,
583583
PUSH_DEFAULT_TRACKING,
584-
PUSH_DEFAULT_CURRENT,
584+
PUSH_DEFAULT_CURRENT
585585
};
586586

587587
extern enum branch_track git_branch_track;
@@ -590,7 +590,7 @@ extern enum push_default_type push_default;
590590

591591
enum object_creation_mode {
592592
OBJECT_CREATION_USES_HARDLINKS = 0,
593-
OBJECT_CREATION_USES_RENAMES = 1,
593+
OBJECT_CREATION_USES_RENAMES = 1
594594
};
595595

596596
extern enum object_creation_mode object_creation_mode;
@@ -670,7 +670,7 @@ enum sharedrepo {
670670
OLD_PERM_GROUP = 1,
671671
OLD_PERM_EVERYBODY = 2,
672672
PERM_GROUP = 0660,
673-
PERM_EVERYBODY = 0664,
673+
PERM_EVERYBODY = 0664
674674
};
675675
int git_config_perm(const char *var, const char *value);
676676
int set_shared_perm(const char *path, int mode);
@@ -880,7 +880,7 @@ struct ref {
880880
REF_STATUS_REJECT_NODELETE,
881881
REF_STATUS_UPTODATE,
882882
REF_STATUS_REMOTE_REJECT,
883-
REF_STATUS_EXPECTING_REPORT,
883+
REF_STATUS_EXPECTING_REPORT
884884
} status;
885885
char *remote_status;
886886
struct ref *peer_ref; /* when renaming */

commit.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ enum cmit_fmt {
6060
CMIT_FMT_EMAIL,
6161
CMIT_FMT_USERFORMAT,
6262

63-
CMIT_FMT_UNSPECIFIED,
63+
CMIT_FMT_UNSPECIFIED
6464
};
6565

6666
struct pretty_print_context

connect.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ int path_match(const char *path, int nr, char **match)
131131
enum protocol {
132132
PROTO_LOCAL = 1,
133133
PROTO_SSH,
134-
PROTO_GIT,
134+
PROTO_GIT
135135
};
136136

137137
static enum protocol get_protocol(const char *name)

ctype.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enum {
1010
A = GIT_ALPHA,
1111
D = GIT_DIGIT,
1212
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
13-
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
13+
R = GIT_REGEX_SPECIAL /* $, (, ), +, ., ^, {, | */
1414
};
1515

1616
unsigned char sane_ctype[256] = {

diff.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ enum color_diff {
133133
DIFF_FILE_NEW = 5,
134134
DIFF_COMMIT = 6,
135135
DIFF_WHITESPACE = 7,
136-
DIFF_FUNCINFO = 8,
136+
DIFF_FUNCINFO = 8
137137
};
138138
const char *diff_get_color(int diff_use_color, enum color_diff ix);
139139
#define diff_get_color_opt(o, ix) \

dir.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pat
465465
enum exist_status {
466466
index_nonexistent = 0,
467467
index_directory,
468-
index_gitdir,
468+
index_gitdir
469469
};
470470

471471
/*
@@ -533,7 +533,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
533533
enum directory_treatment {
534534
show_directory,
535535
ignore_directory,
536-
recurse_into_directory,
536+
recurse_into_directory
537537
};
538538

539539
static enum directory_treatment treat_directory(struct dir_struct *dir,
@@ -684,7 +684,7 @@ static int get_dtype(struct dirent *de, const char *path, int len)
684684
enum path_treatment {
685685
path_ignored,
686686
path_handled,
687-
path_recurse,
687+
path_recurse
688688
};
689689

690690
static enum path_treatment treat_one_path(struct dir_struct *dir,

fast-import.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ struct hash_list
267267
typedef enum {
268268
WHENSPEC_RAW = 1,
269269
WHENSPEC_RFC2822,
270-
WHENSPEC_NOW,
270+
WHENSPEC_NOW
271271
} whenspec_type;
272272

273273
struct recent_command

grep.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ enum grep_pat_token {
1010
GREP_OPEN_PAREN,
1111
GREP_CLOSE_PAREN,
1212
GREP_NOT,
13-
GREP_OR,
13+
GREP_OR
1414
};
1515

1616
enum grep_context {
1717
GREP_CONTEXT_HEAD,
18-
GREP_CONTEXT_BODY,
18+
GREP_CONTEXT_BODY
1919
};
2020

2121
enum grep_header_field {
2222
GREP_HEADER_AUTHOR = 0,
23-
GREP_HEADER_COMMITTER,
23+
GREP_HEADER_COMMITTER
2424
};
2525

2626
struct grep_pat {
@@ -40,7 +40,7 @@ enum grep_expr_node {
4040
GREP_NODE_ATOM,
4141
GREP_NODE_NOT,
4242
GREP_NODE_AND,
43-
GREP_NODE_OR,
43+
GREP_NODE_OR
4444
};
4545

4646
struct grep_expr {

http-push.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ enum transfer_state {
105105
RUN_PUT,
106106
RUN_MOVE,
107107
ABORTED,
108-
COMPLETE,
108+
COMPLETE
109109
};
110110

111111
struct transfer_request

http-walker.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ enum object_request_state {
1515
WAITING,
1616
ABORTED,
1717
ACTIVE,
18-
COMPLETE,
18+
COMPLETE
1919
};
2020

2121
struct object_request

imap-send.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ enum CAPABILITY {
230230
LITERALPLUS,
231231
NAMESPACE,
232232
STARTTLS,
233-
AUTH_CRAM_MD5,
233+
AUTH_CRAM_MD5
234234
};
235235

236236
static const char *cap_list[] = {

merge-recursive.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ struct merge_options {
1010
enum {
1111
MERGE_RECURSIVE_NORMAL = 0,
1212
MERGE_RECURSIVE_OURS,
13-
MERGE_RECURSIVE_THEIRS,
13+
MERGE_RECURSIVE_THEIRS
1414
} recursive_variant;
1515
const char *subtree_shift;
1616
unsigned buffer_output : 1;

parse-options.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ enum parse_opt_flags {
2525
PARSE_OPT_STOP_AT_NON_OPTION = 2,
2626
PARSE_OPT_KEEP_ARGV0 = 4,
2727
PARSE_OPT_KEEP_UNKNOWN = 8,
28-
PARSE_OPT_NO_INTERNAL_HELP = 16,
28+
PARSE_OPT_NO_INTERNAL_HELP = 16
2929
};
3030

3131
enum parse_opt_option_flags {
@@ -36,7 +36,7 @@ enum parse_opt_option_flags {
3636
PARSE_OPT_LASTARG_DEFAULT = 16,
3737
PARSE_OPT_NODASH = 32,
3838
PARSE_OPT_LITERAL_ARGHELP = 64,
39-
PARSE_OPT_NEGHELP = 128,
39+
PARSE_OPT_NEGHELP = 128
4040
};
4141

4242
struct option;
@@ -160,7 +160,7 @@ extern NORETURN void usage_msg_opt(const char *msg,
160160
enum {
161161
PARSE_OPT_HELP = -1,
162162
PARSE_OPT_DONE,
163-
PARSE_OPT_UNKNOWN,
163+
PARSE_OPT_UNKNOWN
164164
};
165165

166166
/*

pretty.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
828828
enum {
829829
NO_MAGIC,
830830
ADD_LF_BEFORE_NON_EMPTY,
831-
DEL_LF_BEFORE_EMPTY,
831+
DEL_LF_BEFORE_EMPTY
832832
} magic = NO_MAGIC;
833833

834834
switch (placeholder[0]) {

remote.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ int branch_merge_matches(struct branch *, int n, const char *);
145145
enum match_refs_flags {
146146
MATCH_REFS_NONE = 0,
147147
MATCH_REFS_ALL = (1 << 0),
148-
MATCH_REFS_MIRROR = (1 << 1),
148+
MATCH_REFS_MIRROR = (1 << 1)
149149
};
150150

151151
/* Reporting of tracking info */

rerere.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_siz
153153
git_SHA_CTX ctx;
154154
int hunk_no = 0;
155155
enum {
156-
RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL,
156+
RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL
157157
} hunk = RR_CONTEXT;
158158
struct strbuf one = STRBUF_INIT, two = STRBUF_INIT;
159159
struct strbuf buf = STRBUF_INIT;

revision.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1781,7 +1781,7 @@ int prepare_revision_walk(struct rev_info *revs)
17811781
enum rewrite_result {
17821782
rewrite_one_ok,
17831783
rewrite_one_noparents,
1784-
rewrite_one_error,
1784+
rewrite_one_error
17851785
};
17861786

17871787
static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)

wt-status.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ enum color_wt_status {
1111
WT_STATUS_CHANGED,
1212
WT_STATUS_UNTRACKED,
1313
WT_STATUS_NOBRANCH,
14-
WT_STATUS_UNMERGED,
14+
WT_STATUS_UNMERGED
1515
};
1616

1717
enum untracked_status_type {

0 commit comments

Comments
 (0)