@matheusbsbs / matheus-bagliano / commits / 4b05548fc0
Fork 0

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 <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Gary V. Vaughan committed May 14, 2010 at 09:31 UTC 4b05548fc0523744b7a1276cfa0f4aae19d6d9c9
26 files changed +45 -45
attr.h
+1 -1
@@ -34,7 +34,7 @@ int git_checkattr(const char *path, int, struct git_attr_check *);
34 enum git_attr_direction {
35 GIT_ATTR_CHECKIN,
36 GIT_ATTR_CHECKOUT,
37 - GIT_ATTR_INDEX,
37 + GIT_ATTR_INDEX
38 };
39 void git_attr_set_direction(enum git_attr_direction, struct index_state *);
40
builtin/apply.c
+2 -2
@@ -56,7 +56,7 @@ static enum ws_error_action {
56 nowarn_ws_error,
57 warn_on_ws_error,
58 die_on_ws_error,
59 - correct_ws_error,
59 + correct_ws_error
60 } ws_error_action = warn_on_ws_error;
61 static int whitespace_error;
62 static int squelch_whitespace_errors = 5;
@@ -64,7 +64,7 @@ static int applied_after_fixing_ws;
64
65 static enum ws_ignore {
66 ignore_ws_none,
67 - ignore_ws_change,
67 + ignore_ws_change
68 } ws_ignore_action = ignore_ws_none;
69
70
builtin/branch.c
+2 -2
@@ -43,13 +43,13 @@ enum color_branch {
43 BRANCH_COLOR_PLAIN = 1,
44 BRANCH_COLOR_REMOTE = 2,
45 BRANCH_COLOR_LOCAL = 3,
46 - BRANCH_COLOR_CURRENT = 4,
46 + BRANCH_COLOR_CURRENT = 4
47 };
48
49 static enum merge_filter {
50 NO_FILTER = 0,
51 SHOW_NOT_MERGED,
52 - SHOW_MERGED,
52 + SHOW_MERGED
53 } merge_filter;
54 static unsigned char merge_filter_ref[20];
55
builtin/commit.c
+3 -3
@@ -57,7 +57,7 @@ static struct lock_file false_lock; /* used only for partial commits */
57 static enum {
58 COMMIT_AS_IS = 1,
59 COMMIT_NORMAL,
60 - COMMIT_PARTIAL,
60 + COMMIT_PARTIAL
61 } commit_style;
62
63 static const char *logfile, *force_author;
@@ -78,7 +78,7 @@ static char *untracked_files_arg, *force_date;
78 static enum {
79 CLEANUP_SPACE,
80 CLEANUP_NONE,
81 - CLEANUP_ALL,
81 + CLEANUP_ALL
82 } cleanup_mode;
83 static char *cleanup_arg;
84
@@ -90,7 +90,7 @@ static int null_termination;
90 static enum {
91 STATUS_FORMAT_LONG,
92 STATUS_FORMAT_SHORT,
93 - STATUS_FORMAT_PORCELAIN,
93 + STATUS_FORMAT_PORCELAIN
94 } status_format = STATUS_FORMAT_LONG;
95
96 static int opt_parse_m(const struct option *opt, const char *arg, int unset)
builtin/help.c
+1 -1
@@ -26,7 +26,7 @@ enum help_format {
26 HELP_FORMAT_NONE,
27 HELP_FORMAT_MAN,
28 HELP_FORMAT_INFO,
29 - HELP_FORMAT_WEB,
29 + HELP_FORMAT_WEB
30 };
31
32 static int show_all = 0;
builtin/mailinfo.c
+2 -2
@@ -17,10 +17,10 @@ static struct strbuf name = STRBUF_INIT;
17 static struct strbuf email = STRBUF_INIT;
18
19 static enum {
20 - TE_DONTCARE, TE_QP, TE_BASE64,
20 + TE_DONTCARE, TE_QP, TE_BASE64
21 } transfer_encoding;
22 static enum {
23 - TYPE_TEXT, TYPE_OTHER,
23 + TYPE_TEXT, TYPE_OTHER
24 } message_type;
25
26 static struct strbuf charset = STRBUF_INIT;
builtin/receive-pack.c
+1 -1
@@ -16,7 +16,7 @@ enum deny_action {
16 DENY_UNCONFIGURED,
17 DENY_IGNORE,
18 DENY_WARN,
19 - DENY_REFUSE,
19 + DENY_REFUSE
20 };
21
22 static int deny_deletes;
builtin/remote.c
+1 -1
@@ -317,7 +317,7 @@ struct push_info {
317 PUSH_STATUS_UPTODATE,
318 PUSH_STATUS_FASTFORWARD,
319 PUSH_STATUS_OUTOFDATE,
320 - PUSH_STATUS_NOTQUERIED,
320 + PUSH_STATUS_NOTQUERIED
321 } status;
322 };
323
cache.h
+8 -8
@@ -361,7 +361,7 @@ enum object_type {
361 OBJ_OFS_DELTA = 6,
362 OBJ_REF_DELTA = 7,
363 OBJ_ANY,
364 - OBJ_MAX,
364 + OBJ_MAX
365 };
366
367 static inline enum object_type object_type(unsigned int mode)
@@ -556,7 +556,7 @@ extern int core_apply_sparse_checkout;
556 enum safe_crlf {
557 SAFE_CRLF_FALSE = 0,
558 SAFE_CRLF_FAIL = 1,
559 - SAFE_CRLF_WARN = 2,
559 + SAFE_CRLF_WARN = 2
560 };
561
562 extern enum safe_crlf safe_crlf;
@@ -567,21 +567,21 @@ enum branch_track {
567 BRANCH_TRACK_REMOTE,
568 BRANCH_TRACK_ALWAYS,
569 BRANCH_TRACK_EXPLICIT,
570 - BRANCH_TRACK_OVERRIDE,
570 + BRANCH_TRACK_OVERRIDE
571 };
572
573 enum rebase_setup_type {
574 AUTOREBASE_NEVER = 0,
575 AUTOREBASE_LOCAL,
576 AUTOREBASE_REMOTE,
577 - AUTOREBASE_ALWAYS,
577 + AUTOREBASE_ALWAYS
578 };
579
580 enum push_default_type {
581 PUSH_DEFAULT_NOTHING = 0,
582 PUSH_DEFAULT_MATCHING,
583 PUSH_DEFAULT_TRACKING,
584 - PUSH_DEFAULT_CURRENT,
584 + PUSH_DEFAULT_CURRENT
585 };
586
587 extern enum branch_track git_branch_track;
@@ -590,7 +590,7 @@ extern enum push_default_type push_default;
590
591 enum object_creation_mode {
592 OBJECT_CREATION_USES_HARDLINKS = 0,
593 - OBJECT_CREATION_USES_RENAMES = 1,
593 + OBJECT_CREATION_USES_RENAMES = 1
594 };
595
596 extern enum object_creation_mode object_creation_mode;
@@ -670,7 +670,7 @@ enum sharedrepo {
670 OLD_PERM_GROUP = 1,
671 OLD_PERM_EVERYBODY = 2,
672 PERM_GROUP = 0660,
673 - PERM_EVERYBODY = 0664,
673 + PERM_EVERYBODY = 0664
674 };
675 int git_config_perm(const char *var, const char *value);
676 int set_shared_perm(const char *path, int mode);
@@ -880,7 +880,7 @@ struct ref {
880 REF_STATUS_REJECT_NODELETE,
881 REF_STATUS_UPTODATE,
882 REF_STATUS_REMOTE_REJECT,
883 - REF_STATUS_EXPECTING_REPORT,
883 + REF_STATUS_EXPECTING_REPORT
884 } status;
885 char *remote_status;
886 struct ref *peer_ref; /* when renaming */
commit.h
+1 -1
@@ -60,7 +60,7 @@ enum cmit_fmt {
60 CMIT_FMT_EMAIL,
61 CMIT_FMT_USERFORMAT,
62
63 - CMIT_FMT_UNSPECIFIED,
63 + CMIT_FMT_UNSPECIFIED
64 };
65
66 struct pretty_print_context
connect.c
+1 -1
@@ -131,7 +131,7 @@ int path_match(const char *path, int nr, char **match)
131 enum protocol {
132 PROTO_LOCAL = 1,
133 PROTO_SSH,
134 - PROTO_GIT,
134 + PROTO_GIT
135 };
136
137 static enum protocol get_protocol(const char *name)
ctype.c
+1 -1
@@ -10,7 +10,7 @@ enum {
10 A = GIT_ALPHA,
11 D = GIT_DIGIT,
12 G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
13 - R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
13 + R = GIT_REGEX_SPECIAL /* $, (, ), +, ., ^, {, | */
14 };
15
16 unsigned char sane_ctype[256] = {
diff.h
+1 -1
@@ -133,7 +133,7 @@ enum color_diff {
133 DIFF_FILE_NEW = 5,
134 DIFF_COMMIT = 6,
135 DIFF_WHITESPACE = 7,
136 - DIFF_FUNCINFO = 8,
136 + DIFF_FUNCINFO = 8
137 };
138 const char *diff_get_color(int diff_use_color, enum color_diff ix);
139 #define diff_get_color_opt(o, ix) \
dir.c
+3 -3
@@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pat
465 enum exist_status {
466 index_nonexistent = 0,
467 index_directory,
468 - index_gitdir,
468 + index_gitdir
469 };
470
471 /*
@@ -533,7 +533,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
533 enum directory_treatment {
534 show_directory,
535 ignore_directory,
536 - recurse_into_directory,
536 + recurse_into_directory
537 };
538
539 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)
684 enum path_treatment {
685 path_ignored,
686 path_handled,
687 - path_recurse,
687 + path_recurse
688 };
689
690 static enum path_treatment treat_one_path(struct dir_struct *dir,
fast-import.c
+1 -1
@@ -267,7 +267,7 @@ struct hash_list
267 typedef enum {
268 WHENSPEC_RAW = 1,
269 WHENSPEC_RFC2822,
270 - WHENSPEC_NOW,
270 + WHENSPEC_NOW
271 } whenspec_type;
272
273 struct recent_command
grep.h
+4 -4
@@ -10,17 +10,17 @@ enum grep_pat_token {
10 GREP_OPEN_PAREN,
11 GREP_CLOSE_PAREN,
12 GREP_NOT,
13 - GREP_OR,
13 + GREP_OR
14 };
15
16 enum grep_context {
17 GREP_CONTEXT_HEAD,
18 - GREP_CONTEXT_BODY,
18 + GREP_CONTEXT_BODY
19 };
20
21 enum grep_header_field {
22 GREP_HEADER_AUTHOR = 0,
23 - GREP_HEADER_COMMITTER,
23 + GREP_HEADER_COMMITTER
24 };
25
26 struct grep_pat {
@@ -40,7 +40,7 @@ enum grep_expr_node {
40 GREP_NODE_ATOM,
41 GREP_NODE_NOT,
42 GREP_NODE_AND,
43 - GREP_NODE_OR,
43 + GREP_NODE_OR
44 };
45
46 struct grep_expr {
http-push.c
+1 -1
@@ -105,7 +105,7 @@ enum transfer_state {
105 RUN_PUT,
106 RUN_MOVE,
107 ABORTED,
108 - COMPLETE,
108 + COMPLETE
109 };
110
111 struct transfer_request
http-walker.c
+1 -1
@@ -15,7 +15,7 @@ enum object_request_state {
15 WAITING,
16 ABORTED,
17 ACTIVE,
18 - COMPLETE,
18 + COMPLETE
19 };
20
21 struct object_request
imap-send.c
+1 -1
@@ -230,7 +230,7 @@ enum CAPABILITY {
230 LITERALPLUS,
231 NAMESPACE,
232 STARTTLS,
233 - AUTH_CRAM_MD5,
233 + AUTH_CRAM_MD5
234 };
235
236 static const char *cap_list[] = {
merge-recursive.h
+1 -1
@@ -10,7 +10,7 @@ struct merge_options {
10 enum {
11 MERGE_RECURSIVE_NORMAL = 0,
12 MERGE_RECURSIVE_OURS,
13 - MERGE_RECURSIVE_THEIRS,
13 + MERGE_RECURSIVE_THEIRS
14 } recursive_variant;
15 const char *subtree_shift;
16 unsigned buffer_output : 1;
parse-options.h
+3 -3
@@ -25,7 +25,7 @@ enum parse_opt_flags {
25 PARSE_OPT_STOP_AT_NON_OPTION = 2,
26 PARSE_OPT_KEEP_ARGV0 = 4,
27 PARSE_OPT_KEEP_UNKNOWN = 8,
28 - PARSE_OPT_NO_INTERNAL_HELP = 16,
28 + PARSE_OPT_NO_INTERNAL_HELP = 16
29 };
30
31 enum parse_opt_option_flags {
@@ -36,7 +36,7 @@ enum parse_opt_option_flags {
36 PARSE_OPT_LASTARG_DEFAULT = 16,
37 PARSE_OPT_NODASH = 32,
38 PARSE_OPT_LITERAL_ARGHELP = 64,
39 - PARSE_OPT_NEGHELP = 128,
39 + PARSE_OPT_NEGHELP = 128
40 };
41
42 struct option;
@@ -160,7 +160,7 @@ extern NORETURN void usage_msg_opt(const char *msg,
160 enum {
161 PARSE_OPT_HELP = -1,
162 PARSE_OPT_DONE,
163 - PARSE_OPT_UNKNOWN,
163 + PARSE_OPT_UNKNOWN
164 };
165
166 /*
pretty.c
+1 -1
@@ -828,7 +828,7 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
828 enum {
829 NO_MAGIC,
830 ADD_LF_BEFORE_NON_EMPTY,
831 - DEL_LF_BEFORE_EMPTY,
831 + DEL_LF_BEFORE_EMPTY
832 } magic = NO_MAGIC;
833
834 switch (placeholder[0]) {
remote.h
+1 -1
@@ -145,7 +145,7 @@ int branch_merge_matches(struct branch *, int n, const char *);
145 enum match_refs_flags {
146 MATCH_REFS_NONE = 0,
147 MATCH_REFS_ALL = (1 << 0),
148 - MATCH_REFS_MIRROR = (1 << 1),
148 + MATCH_REFS_MIRROR = (1 << 1)
149 };
150
151 /* Reporting of tracking info */
rerere.c
+1 -1
@@ -153,7 +153,7 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_siz
153 git_SHA_CTX ctx;
154 int hunk_no = 0;
155 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
157 } hunk = RR_CONTEXT;
158 struct strbuf one = STRBUF_INIT, two = STRBUF_INIT;
159 struct strbuf buf = STRBUF_INIT;
revision.c
+1 -1
@@ -1781,7 +1781,7 @@ int prepare_revision_walk(struct rev_info *revs)
1781 enum rewrite_result {
1782 rewrite_one_ok,
1783 rewrite_one_noparents,
1784 - rewrite_one_error,
1784 + rewrite_one_error
1785 };
1786
1787 static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)
wt-status.h
+1 -1
@@ -11,7 +11,7 @@ enum color_wt_status {
11 WT_STATUS_CHANGED,
12 WT_STATUS_UNTRACKED,
13 WT_STATUS_NOBRANCH,
14 - WT_STATUS_UNMERGED,
14 + WT_STATUS_UNMERGED
15 };
16
17 enum untracked_status_type {