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>
This commit is contained in:
Gary V. Vaughan 2010-05-14 09:31:35 +00:00 коммит произвёл Junio C Hamano
Родитель 48793cf46a
Коммит 4b05548fc0
26 изменённых файлов: 45 добавлений и 45 удалений

2
attr.h
Просмотреть файл

@ -34,7 +34,7 @@ int git_checkattr(const char *path, int, struct git_attr_check *);
enum git_attr_direction {
GIT_ATTR_CHECKIN,
GIT_ATTR_CHECKOUT,
GIT_ATTR_INDEX,
GIT_ATTR_INDEX
};
void git_attr_set_direction(enum git_attr_direction, struct index_state *);

Просмотреть файл

@ -56,7 +56,7 @@ static enum ws_error_action {
nowarn_ws_error,
warn_on_ws_error,
die_on_ws_error,
correct_ws_error,
correct_ws_error
} ws_error_action = warn_on_ws_error;
static int whitespace_error;
static int squelch_whitespace_errors = 5;
@ -64,7 +64,7 @@ static int applied_after_fixing_ws;
static enum ws_ignore {
ignore_ws_none,
ignore_ws_change,
ignore_ws_change
} ws_ignore_action = ignore_ws_none;

Просмотреть файл

@ -43,13 +43,13 @@ enum color_branch {
BRANCH_COLOR_PLAIN = 1,
BRANCH_COLOR_REMOTE = 2,
BRANCH_COLOR_LOCAL = 3,
BRANCH_COLOR_CURRENT = 4,
BRANCH_COLOR_CURRENT = 4
};
static enum merge_filter {
NO_FILTER = 0,
SHOW_NOT_MERGED,
SHOW_MERGED,
SHOW_MERGED
} merge_filter;
static unsigned char merge_filter_ref[20];

Просмотреть файл

@ -57,7 +57,7 @@ static struct lock_file false_lock; /* used only for partial commits */
static enum {
COMMIT_AS_IS = 1,
COMMIT_NORMAL,
COMMIT_PARTIAL,
COMMIT_PARTIAL
} commit_style;
static const char *logfile, *force_author;
@ -78,7 +78,7 @@ static char *untracked_files_arg, *force_date;
static enum {
CLEANUP_SPACE,
CLEANUP_NONE,
CLEANUP_ALL,
CLEANUP_ALL
} cleanup_mode;
static char *cleanup_arg;
@ -90,7 +90,7 @@ static int null_termination;
static enum {
STATUS_FORMAT_LONG,
STATUS_FORMAT_SHORT,
STATUS_FORMAT_PORCELAIN,
STATUS_FORMAT_PORCELAIN
} status_format = STATUS_FORMAT_LONG;
static int opt_parse_m(const struct option *opt, const char *arg, int unset)

Просмотреть файл

@ -26,7 +26,7 @@ enum help_format {
HELP_FORMAT_NONE,
HELP_FORMAT_MAN,
HELP_FORMAT_INFO,
HELP_FORMAT_WEB,
HELP_FORMAT_WEB
};
static int show_all = 0;

Просмотреть файл

@ -17,10 +17,10 @@ static struct strbuf name = STRBUF_INIT;
static struct strbuf email = STRBUF_INIT;
static enum {
TE_DONTCARE, TE_QP, TE_BASE64,
TE_DONTCARE, TE_QP, TE_BASE64
} transfer_encoding;
static enum {
TYPE_TEXT, TYPE_OTHER,
TYPE_TEXT, TYPE_OTHER
} message_type;
static struct strbuf charset = STRBUF_INIT;

Просмотреть файл

@ -16,7 +16,7 @@ enum deny_action {
DENY_UNCONFIGURED,
DENY_IGNORE,
DENY_WARN,
DENY_REFUSE,
DENY_REFUSE
};
static int deny_deletes;

Просмотреть файл

@ -317,7 +317,7 @@ struct push_info {
PUSH_STATUS_UPTODATE,
PUSH_STATUS_FASTFORWARD,
PUSH_STATUS_OUTOFDATE,
PUSH_STATUS_NOTQUERIED,
PUSH_STATUS_NOTQUERIED
} status;
};

16
cache.h
Просмотреть файл

@ -361,7 +361,7 @@ enum object_type {
OBJ_OFS_DELTA = 6,
OBJ_REF_DELTA = 7,
OBJ_ANY,
OBJ_MAX,
OBJ_MAX
};
static inline enum object_type object_type(unsigned int mode)
@ -556,7 +556,7 @@ extern int core_apply_sparse_checkout;
enum safe_crlf {
SAFE_CRLF_FALSE = 0,
SAFE_CRLF_FAIL = 1,
SAFE_CRLF_WARN = 2,
SAFE_CRLF_WARN = 2
};
extern enum safe_crlf safe_crlf;
@ -567,21 +567,21 @@ enum branch_track {
BRANCH_TRACK_REMOTE,
BRANCH_TRACK_ALWAYS,
BRANCH_TRACK_EXPLICIT,
BRANCH_TRACK_OVERRIDE,
BRANCH_TRACK_OVERRIDE
};
enum rebase_setup_type {
AUTOREBASE_NEVER = 0,
AUTOREBASE_LOCAL,
AUTOREBASE_REMOTE,
AUTOREBASE_ALWAYS,
AUTOREBASE_ALWAYS
};
enum push_default_type {
PUSH_DEFAULT_NOTHING = 0,
PUSH_DEFAULT_MATCHING,
PUSH_DEFAULT_TRACKING,
PUSH_DEFAULT_CURRENT,
PUSH_DEFAULT_CURRENT
};
extern enum branch_track git_branch_track;
@ -590,7 +590,7 @@ extern enum push_default_type push_default;
enum object_creation_mode {
OBJECT_CREATION_USES_HARDLINKS = 0,
OBJECT_CREATION_USES_RENAMES = 1,
OBJECT_CREATION_USES_RENAMES = 1
};
extern enum object_creation_mode object_creation_mode;
@ -670,7 +670,7 @@ enum sharedrepo {
OLD_PERM_GROUP = 1,
OLD_PERM_EVERYBODY = 2,
PERM_GROUP = 0660,
PERM_EVERYBODY = 0664,
PERM_EVERYBODY = 0664
};
int git_config_perm(const char *var, const char *value);
int set_shared_perm(const char *path, int mode);
@ -880,7 +880,7 @@ struct ref {
REF_STATUS_REJECT_NODELETE,
REF_STATUS_UPTODATE,
REF_STATUS_REMOTE_REJECT,
REF_STATUS_EXPECTING_REPORT,
REF_STATUS_EXPECTING_REPORT
} status;
char *remote_status;
struct ref *peer_ref; /* when renaming */

Просмотреть файл

@ -60,7 +60,7 @@ enum cmit_fmt {
CMIT_FMT_EMAIL,
CMIT_FMT_USERFORMAT,
CMIT_FMT_UNSPECIFIED,
CMIT_FMT_UNSPECIFIED
};
struct pretty_print_context

Просмотреть файл

@ -131,7 +131,7 @@ int path_match(const char *path, int nr, char **match)
enum protocol {
PROTO_LOCAL = 1,
PROTO_SSH,
PROTO_GIT,
PROTO_GIT
};
static enum protocol get_protocol(const char *name)

Просмотреть файл

@ -10,7 +10,7 @@ enum {
A = GIT_ALPHA,
D = GIT_DIGIT,
G = GIT_GLOB_SPECIAL, /* *, ?, [, \\ */
R = GIT_REGEX_SPECIAL, /* $, (, ), +, ., ^, {, | */
R = GIT_REGEX_SPECIAL /* $, (, ), +, ., ^, {, | */
};
unsigned char sane_ctype[256] = {

2
diff.h
Просмотреть файл

@ -133,7 +133,7 @@ enum color_diff {
DIFF_FILE_NEW = 5,
DIFF_COMMIT = 6,
DIFF_WHITESPACE = 7,
DIFF_FUNCINFO = 8,
DIFF_FUNCINFO = 8
};
const char *diff_get_color(int diff_use_color, enum color_diff ix);
#define diff_get_color_opt(o, ix) \

6
dir.c
Просмотреть файл

@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pat
enum exist_status {
index_nonexistent = 0,
index_directory,
index_gitdir,
index_gitdir
};
/*
@ -533,7 +533,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)
enum directory_treatment {
show_directory,
ignore_directory,
recurse_into_directory,
recurse_into_directory
};
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)
enum path_treatment {
path_ignored,
path_handled,
path_recurse,
path_recurse
};
static enum path_treatment treat_one_path(struct dir_struct *dir,

Просмотреть файл

@ -267,7 +267,7 @@ struct hash_list
typedef enum {
WHENSPEC_RAW = 1,
WHENSPEC_RFC2822,
WHENSPEC_NOW,
WHENSPEC_NOW
} whenspec_type;
struct recent_command

8
grep.h
Просмотреть файл

@ -10,17 +10,17 @@ enum grep_pat_token {
GREP_OPEN_PAREN,
GREP_CLOSE_PAREN,
GREP_NOT,
GREP_OR,
GREP_OR
};
enum grep_context {
GREP_CONTEXT_HEAD,
GREP_CONTEXT_BODY,
GREP_CONTEXT_BODY
};
enum grep_header_field {
GREP_HEADER_AUTHOR = 0,
GREP_HEADER_COMMITTER,
GREP_HEADER_COMMITTER
};
struct grep_pat {
@ -40,7 +40,7 @@ enum grep_expr_node {
GREP_NODE_ATOM,
GREP_NODE_NOT,
GREP_NODE_AND,
GREP_NODE_OR,
GREP_NODE_OR
};
struct grep_expr {

Просмотреть файл

@ -105,7 +105,7 @@ enum transfer_state {
RUN_PUT,
RUN_MOVE,
ABORTED,
COMPLETE,
COMPLETE
};
struct transfer_request

Просмотреть файл

@ -15,7 +15,7 @@ enum object_request_state {
WAITING,
ABORTED,
ACTIVE,
COMPLETE,
COMPLETE
};
struct object_request

Просмотреть файл

@ -230,7 +230,7 @@ enum CAPABILITY {
LITERALPLUS,
NAMESPACE,
STARTTLS,
AUTH_CRAM_MD5,
AUTH_CRAM_MD5
};
static const char *cap_list[] = {

Просмотреть файл

@ -10,7 +10,7 @@ struct merge_options {
enum {
MERGE_RECURSIVE_NORMAL = 0,
MERGE_RECURSIVE_OURS,
MERGE_RECURSIVE_THEIRS,
MERGE_RECURSIVE_THEIRS
} recursive_variant;
const char *subtree_shift;
unsigned buffer_output : 1;

Просмотреть файл

@ -25,7 +25,7 @@ enum parse_opt_flags {
PARSE_OPT_STOP_AT_NON_OPTION = 2,
PARSE_OPT_KEEP_ARGV0 = 4,
PARSE_OPT_KEEP_UNKNOWN = 8,
PARSE_OPT_NO_INTERNAL_HELP = 16,
PARSE_OPT_NO_INTERNAL_HELP = 16
};
enum parse_opt_option_flags {
@ -36,7 +36,7 @@ enum parse_opt_option_flags {
PARSE_OPT_LASTARG_DEFAULT = 16,
PARSE_OPT_NODASH = 32,
PARSE_OPT_LITERAL_ARGHELP = 64,
PARSE_OPT_NEGHELP = 128,
PARSE_OPT_NEGHELP = 128
};
struct option;
@ -160,7 +160,7 @@ extern NORETURN void usage_msg_opt(const char *msg,
enum {
PARSE_OPT_HELP = -1,
PARSE_OPT_DONE,
PARSE_OPT_UNKNOWN,
PARSE_OPT_UNKNOWN
};
/*

Просмотреть файл

@ -828,7 +828,7 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,
enum {
NO_MAGIC,
ADD_LF_BEFORE_NON_EMPTY,
DEL_LF_BEFORE_EMPTY,
DEL_LF_BEFORE_EMPTY
} magic = NO_MAGIC;
switch (placeholder[0]) {

Просмотреть файл

@ -145,7 +145,7 @@ int branch_merge_matches(struct branch *, int n, const char *);
enum match_refs_flags {
MATCH_REFS_NONE = 0,
MATCH_REFS_ALL = (1 << 0),
MATCH_REFS_MIRROR = (1 << 1),
MATCH_REFS_MIRROR = (1 << 1)
};
/* Reporting of tracking info */

Просмотреть файл

@ -153,7 +153,7 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_siz
git_SHA_CTX ctx;
int hunk_no = 0;
enum {
RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL,
RR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL
} hunk = RR_CONTEXT;
struct strbuf one = STRBUF_INIT, two = STRBUF_INIT;
struct strbuf buf = STRBUF_INIT;

Просмотреть файл

@ -1781,7 +1781,7 @@ int prepare_revision_walk(struct rev_info *revs)
enum rewrite_result {
rewrite_one_ok,
rewrite_one_noparents,
rewrite_one_error,
rewrite_one_error
};
static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)

Просмотреть файл

@ -11,7 +11,7 @@ enum color_wt_status {
WT_STATUS_CHANGED,
WT_STATUS_UNTRACKED,
WT_STATUS_NOBRANCH,
WT_STATUS_UNMERGED,
WT_STATUS_UNMERGED
};
enum untracked_status_type {