Dangling commas in enum is not portable (resend)
PATCH 3/5 Dangling commas in enum is not portable (resend)
Unfortunately there are a still a lot of vendor compilers that choke when the last entry in an enum has a dangling comma (irix is one, and I can get you a list of which of our particular platforms exhibit this problem).
This patch simply deletes all the commas that are required to be able to compile those enums on all of our supported architectures.
--- builtin/apply.c | 2 +- builtin/branch.c | 6 +++--- builtin/commit.c | 4 ++-- builtin/help.c | 2 +- builtin/mailinfo.c | 4 ++-- builtin/receive-pack.c | 2 +- cache.h | 12 ++++++------ commit.h | 2 +- connect.c | 2 +- ctype.c | 4 ++-- diff.h | 2 +- dir.c | 4 ++-- fast-import.c | 2 +- grep.h | 8 ++++---- http-push.c | 2 +- http-walker.c | 2 +- imap-send.c | 2 +- remote.h | 2 +- rerere.c | 2 +- revision.c | 2 +- wt-status.h | 2 +- 21 files changed, 35 insertions(+), 35 deletions(-)
builtin/apply.c +1 -1
@@ -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 ;
builtin/branch.c +3 -3
@@ -36,20 +36,20 @@ static char branch_colors[][COLOR_MAXLEN] = {GIT_COLOR_NORMAL ,/* PLAIN */ GIT_COLOR_RED ,/* REMOTE */ GIT_COLOR_NORMAL ,/* LOCAL */ - GIT_COLOR_GREEN, /* CURRENT */ + GIT_COLOR_GREEN /* CURRENT */ };enum color_branch {BRANCH_COLOR_RESET =0 ,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 ];
builtin/commit.c +2 -2
@@ -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;
@@ -77,7 +77,7 @@ static char *untracked_files_arg, *force_date;static enum {CLEANUP_SPACE ,CLEANUP_NONE , -CLEANUP_ALL , +CLEANUP_ALL } cleanup_mode;static char *cleanup_arg;
builtin/help.c +1 -1
@@ -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 ;
builtin/mailinfo.c +2 -2
@@ -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 ;
builtin/receive-pack.c +1 -1
@@ -16,7 +16,7 @@ enum deny_action {DENY_UNCONFIGURED ,DENY_IGNORE ,DENY_WARN , - DENY_REFUSE, + DENY_REFUSE };static int deny_deletes;
cache.h +6 -6
@@ -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)
@@ -553,7 +553,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;
@@ -564,14 +564,14 @@ 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 {
@@ -667,7 +667,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);
@@ -877,7 +877,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 */
commit.h +1 -1
@@ -60,7 +60,7 @@ enum cmit_fmt {CMIT_FMT_EMAIL ,CMIT_FMT_USERFORMAT , - CMIT_FMT_UNSPECIFIED, + CMIT_FMT_UNSPECIFIED };struct pretty_print_context
connect.c +1 -1
@@ -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)
ctype.c +2 -2
@@ -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] = {
@@ -21,6 +21,6 @@ unsigned char sane_ctype[256] = {0 ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,/* 64.. 79 */ A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,G ,G ,0 ,R ,0 ,/* 80.. 95 */ 0 ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,/* 96..111 */ - A, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0, /* 112..127 */ +A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,A ,R ,R ,0 ,0 ,0 /* 112..127 */ /* Nothing in the 128.. range */ };
diff.h +1 -1
@@ -131,7 +131,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) \
dir.c +2 -2
@@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *patenum 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,
fast-import.c +1 -1
@@ -267,7 +267,7 @@ struct hash_listtypedef enum {WHENSPEC_RAW =1 ,WHENSPEC_RFC2822 , -WHENSPEC_NOW , +WHENSPEC_NOW }whenspec_type ;struct recent_command
grep.h +4 -4
@@ -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 {
http-push.c +1 -1
@@ -105,7 +105,7 @@ enum transfer_state {RUN_PUT ,RUN_MOVE ,ABORTED , - COMPLETE, + COMPLETE };struct transfer_request
http-walker.c +1 -1
@@ -15,7 +15,7 @@ enum object_request_state {WAITING ,ABORTED ,ACTIVE , - COMPLETE, + COMPLETE };struct object_request
imap-send.c +1 -1
@@ -230,7 +230,7 @@ enum CAPABILITY {LITERALPLUS ,NAMESPACE ,STARTTLS , - AUTH_CRAM_MD5, +AUTH_CRAM_MD5 }; static const char *cap_list[] = {
remote.h +1 -1
@@ -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 */
rerere.c +1 -1
@@ -153,7 +153,7 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_sizgit_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 ;
revision.c +1 -1
@@ -1759,7 +1759,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)
wt-status.h +1 -1
@@ -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 {
Signature · 5 lines
1.7.0.2 -- Gary V. Vaughan ([email protected])
Quoted 4 lines · Gary V. Vaughan
Unfortunately there are a still a lot of vendor compilers that choke when the last entry in an enum has a dangling comma (irix is one, and I can get you a list of which of our particular platforms exhibit this problem).
I would appreciate that list if it's not much trouble.
Signature · 1 line
Felipe Contreras
Quoted 8 lines · Felipe Contreras
Quoted 4 lines · Gary V. Vaughan
Unfortunately there are a still a lot of vendor compilers that choke when the last entry in an enum has a dangling comma (irix is one, and I can get you a list of which of our particular platforms exhibit this problem).
I would appreciate that list if it's not much trouble.
I take it back. I've been porting this patch forward from our builds of previous releases, and at some point it certainly was necessary (otherwise I wouldn't have written the patch)... and yet, all of our platforms are now able to compile a minimal test program in C. Either the offending vendor compilers have issued an update to accept the dangling comma syntax, or we have retired the machines that used to have this problem since I originally wrote the patch.
It's notable that aCC (the HP C++ compiler) and CC (the SunOS C++ compiler) both issue a warning on dangling enum commas, but even they still compile successfully.
Sorry for the noise,
Signature · 1 line
Gary V. Vaughan ([email protected])
Quoted 8 lines · Gary V. Vaughan
I take it back. I've been porting this patch forward from our builds of previous releases, and at some point it certainly was necessary (otherwise I wouldn't have written the patch)... and yet, all of our platforms are now able to compile a minimal test program in C. Either the offending vendor compilers have issued an update to accept the dangling comma syntax, or we have retired the machines that used to have this problem since I originally wrote the patch.
Quoted 5 lines
It's notable that aCC (the HP C++ compiler) and CC (the SunOS C++ compiler) both issue a warning on dangling enum commas, but even they still compile successfully.
Sorry for the noise,
The SGI MIPS Compiler v6.2 on IRIX 6.2 compiles, but with a warning. Later MIPSPro 7.2 and 7.4 versions (on 6.5) are OK (silent) Unfortunately IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to compile with a trailing comma.
IBM XLC V10.1 (I have one on AIX 6.1) is OK (silent) Native compiler on Tru64 V5.1 is OK (silent)
So, from the boxes I have access to the IBM XLC V5 version is the one which has a problem.
-Tor
Quoted 19 lines · Tor Arntsen
Quoted 8 lines · Gary V. Vaughan
I take it back. ?I've been porting this patch forward from our builds of previous releases, and at some point it certainly was necessary (otherwise I wouldn't have written the patch)... and yet, all of our platforms are now able to compile a minimal test program in C. [[...]]
It's notable that aCC (the HP C++ compiler) and CC (the SunOS C++ compiler) both issue a warning on dangling enum commas, but even they still compile successfully.The SGI MIPS Compiler v6.2 on IRIX 6.2 compiles, but with a warning. Later MIPSPro 7.2 and 7.4 versions (on 6.5) are OK (silent) Unfortunately IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to compile with a trailing comma.
IBM XLC V10.1 (I have one on AIX 6.1) is OK (silent) Native compiler on Tru64 V5.1 is OK (silent)
Quoted 2 lines
So, from the boxes I have access to the IBM XLC V5 version is the one which has a problem.
I'd be happy to resurrect this patch and resubmit against the latest git release.
Cheers,
Signature · 1 line
Gary V. Vaughan ([email protected])