{"thread":{"id":"22989","subject":"[PATCH 3/5] Dangling commas in enum is not portable (resend)","startedAt":"2010-03-11T16:32:35Z","lastAt":"2010-04-25T16:03:06Z","messageCount":5,"participants":["Gary V. Vaughan","Felipe Contreras","Tor Arntsen"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"136605","messageId":"20100311163235.GC7877@thor.il.thewrittenword.com","threadId":"22989","inReplyTo":null,"subject":"[PATCH 3/5] Dangling commas in enum is not portable (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-03-11T16:32:35Z","receivedAt":"2010-03-11T16:32:35Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"Unfortunately there are a still a lot of vendor compilers that choke\nwhen the last entry in an enum has a dangling comma (irix is one, and\nI can get you a list of which of our particular platforms exhibit this\nproblem).\n\nThis patch simply deletes all the commas that are required to be able\nto compile those enums on all of our supported architectures.\n---\n builtin/apply.c        |    2 +-\n builtin/branch.c       |    6 +++---\n builtin/commit.c       |    4 ++--\n builtin/help.c         |    2 +-\n builtin/mailinfo.c     |    4 ++--\n builtin/receive-pack.c |    2 +-\n cache.h                |   12 ++++++------\n commit.h               |    2 +-\n connect.c              |    2 +-\n ctype.c                |    4 ++--\n diff.h                 |    2 +-\n dir.c                  |    4 ++--\n fast-import.c          |    2 +-\n grep.h                 |    8 ++++----\n http-push.c            |    2 +-\n http-walker.c          |    2 +-\n imap-send.c            |    2 +-\n remote.h               |    2 +-\n rerere.c               |    2 +-\n revision.c             |    2 +-\n wt-status.h            |    2 +-\n 21 files changed, 35 insertions(+), 35 deletions(-)\n\ndiff --git a/builtin/apply.c b/builtin/apply.c\nindex 3af4ae0..e50f1ce 100644\n--- a/builtin/apply.c\n+++ b/builtin/apply.c\n@@ -56,7 +56,7 @@ static enum ws_error_action {\n \tnowarn_ws_error,\n \twarn_on_ws_error,\n \tdie_on_ws_error,\n-\tcorrect_ws_error,\n+\tcorrect_ws_error\n } ws_error_action = warn_on_ws_error;\n static int whitespace_error;\n static int squelch_whitespace_errors = 5;\ndiff --git a/builtin/branch.c b/builtin/branch.c\nindex 6cf7e72..ea23a0f 100644\n--- a/builtin/branch.c\n+++ b/builtin/branch.c\n@@ -36,20 +36,20 @@ static char branch_colors[][COLOR_MAXLEN] = {\n \tGIT_COLOR_NORMAL,\t/* PLAIN */\n \tGIT_COLOR_RED,\t\t/* REMOTE */\n \tGIT_COLOR_NORMAL,\t/* LOCAL */\n-\tGIT_COLOR_GREEN,\t/* CURRENT */\n+\tGIT_COLOR_GREEN\t\t/* CURRENT */\n };\n enum color_branch {\n \tBRANCH_COLOR_RESET = 0,\n \tBRANCH_COLOR_PLAIN = 1,\n \tBRANCH_COLOR_REMOTE = 2,\n \tBRANCH_COLOR_LOCAL = 3,\n-\tBRANCH_COLOR_CURRENT = 4,\n+\tBRANCH_COLOR_CURRENT = 4\n };\n \n static enum merge_filter {\n \tNO_FILTER = 0,\n \tSHOW_NOT_MERGED,\n-\tSHOW_MERGED,\n+\tSHOW_MERGED\n } merge_filter;\n static unsigned char merge_filter_ref[20];\n \ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex f4c7344..530d9ce 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -57,7 +57,7 @@ static struct lock_file false_lock; /* used only for partial commits */\n static enum {\n \tCOMMIT_AS_IS = 1,\n \tCOMMIT_NORMAL,\n-\tCOMMIT_PARTIAL,\n+\tCOMMIT_PARTIAL\n } commit_style;\n \n static const char *logfile, *force_author;\n@@ -77,7 +77,7 @@ static char *untracked_files_arg, *force_date;\n static enum {\n \tCLEANUP_SPACE,\n \tCLEANUP_NONE,\n-\tCLEANUP_ALL,\n+\tCLEANUP_ALL\n } cleanup_mode;\n static char *cleanup_arg;\n \ndiff --git a/builtin/help.c b/builtin/help.c\nindex 3182a2b..a9836b0 100644\n--- a/builtin/help.c\n+++ b/builtin/help.c\n@@ -26,7 +26,7 @@ enum help_format {\n \tHELP_FORMAT_NONE,\n \tHELP_FORMAT_MAN,\n \tHELP_FORMAT_INFO,\n-\tHELP_FORMAT_WEB,\n+\tHELP_FORMAT_WEB\n };\n \n static int show_all = 0;\ndiff --git a/builtin/mailinfo.c b/builtin/mailinfo.c\nindex ce2ef6b..b39a8b7 100644\n--- a/builtin/mailinfo.c\n+++ b/builtin/mailinfo.c\n@@ -17,10 +17,10 @@ static struct strbuf name = STRBUF_INIT;\n static struct strbuf email = STRBUF_INIT;\n \n static enum  {\n-\tTE_DONTCARE, TE_QP, TE_BASE64,\n+\tTE_DONTCARE, TE_QP, TE_BASE64\n } transfer_encoding;\n static enum  {\n-\tTYPE_TEXT, TYPE_OTHER,\n+\tTYPE_TEXT, TYPE_OTHER\n } message_type;\n \n static struct strbuf charset = STRBUF_INIT;\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex 0559fcc..9225dae 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -16,7 +16,7 @@ enum deny_action {\n \tDENY_UNCONFIGURED,\n \tDENY_IGNORE,\n \tDENY_WARN,\n-\tDENY_REFUSE,\n+\tDENY_REFUSE\n };\n \n static int deny_deletes;\ndiff --git a/cache.h b/cache.h\nindex 89f6a40..2f7da15 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -361,7 +361,7 @@ enum object_type {\n \tOBJ_OFS_DELTA = 6,\n \tOBJ_REF_DELTA = 7,\n \tOBJ_ANY,\n-\tOBJ_MAX,\n+\tOBJ_MAX\n };\n \n static inline enum object_type object_type(unsigned int mode)\n@@ -553,7 +553,7 @@ extern int core_apply_sparse_checkout;\n enum safe_crlf {\n \tSAFE_CRLF_FALSE = 0,\n \tSAFE_CRLF_FAIL = 1,\n-\tSAFE_CRLF_WARN = 2,\n+\tSAFE_CRLF_WARN = 2\n };\n \n extern enum safe_crlf safe_crlf;\n@@ -564,14 +564,14 @@ enum branch_track {\n \tBRANCH_TRACK_REMOTE,\n \tBRANCH_TRACK_ALWAYS,\n \tBRANCH_TRACK_EXPLICIT,\n-\tBRANCH_TRACK_OVERRIDE,\n+\tBRANCH_TRACK_OVERRIDE\n };\n \n enum rebase_setup_type {\n \tAUTOREBASE_NEVER = 0,\n \tAUTOREBASE_LOCAL,\n \tAUTOREBASE_REMOTE,\n-\tAUTOREBASE_ALWAYS,\n+\tAUTOREBASE_ALWAYS\n };\n \n enum push_default_type {\n@@ -667,7 +667,7 @@ enum sharedrepo {\n \tOLD_PERM_GROUP      = 1,\n \tOLD_PERM_EVERYBODY  = 2,\n \tPERM_GROUP          = 0660,\n-\tPERM_EVERYBODY      = 0664,\n+\tPERM_EVERYBODY      = 0664\n };\n int git_config_perm(const char *var, const char *value);\n int set_shared_perm(const char *path, int mode);\n@@ -877,7 +877,7 @@ struct ref {\n \t\tREF_STATUS_REJECT_NODELETE,\n \t\tREF_STATUS_UPTODATE,\n \t\tREF_STATUS_REMOTE_REJECT,\n-\t\tREF_STATUS_EXPECTING_REPORT,\n+\t\tREF_STATUS_EXPECTING_REPORT\n \t} status;\n \tchar *remote_status;\n \tstruct ref *peer_ref; /* when renaming */\ndiff --git a/commit.h b/commit.h\nindex 3cf5166..25a30ac 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -60,7 +60,7 @@ enum cmit_fmt {\n \tCMIT_FMT_EMAIL,\n \tCMIT_FMT_USERFORMAT,\n \n-\tCMIT_FMT_UNSPECIFIED,\n+\tCMIT_FMT_UNSPECIFIED\n };\n \n struct pretty_print_context\ndiff --git a/connect.c b/connect.c\nindex 323a771..dcca1d8 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -131,7 +131,7 @@ int path_match(const char *path, int nr, char **match)\n enum protocol {\n \tPROTO_LOCAL = 1,\n \tPROTO_SSH,\n-\tPROTO_GIT,\n+\tPROTO_GIT\n };\n \n static enum protocol get_protocol(const char *name)\ndiff --git a/ctype.c b/ctype.c\nindex 7ee64c7..b694b9c 100644\n--- a/ctype.c\n+++ b/ctype.c\n@@ -10,7 +10,7 @@ enum {\n \tA = GIT_ALPHA,\n \tD = GIT_DIGIT,\n \tG = GIT_GLOB_SPECIAL,\t/* *, ?, [, \\\\ */\n-\tR = GIT_REGEX_SPECIAL,\t/* $, (, ), +, ., ^, {, | */\n+\tR = GIT_REGEX_SPECIAL\t/* $, (, ), +, ., ^, {, | */\n };\n \n unsigned char sane_ctype[256] = {\n@@ -21,6 +21,6 @@ unsigned char sane_ctype[256] = {\n \t0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,\t\t/*  64.. 79 */\n \tA, A, A, A, A, A, A, A, A, A, A, G, G, 0, R, 0,\t\t/*  80.. 95 */\n \t0, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,\t\t/*  96..111 */\n-\tA, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0,\t\t/* 112..127 */\n+\tA, A, A, A, A, A, A, A, A, A, A, R, R, 0, 0, 0\t\t/* 112..127 */\n \t/* Nothing in the 128.. range */\n };\ndiff --git a/diff.h b/diff.h\nindex 2ef3341..b9645fe 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -131,7 +131,7 @@ enum color_diff {\n \tDIFF_FILE_NEW = 5,\n \tDIFF_COMMIT = 6,\n \tDIFF_WHITESPACE = 7,\n-\tDIFF_FUNCINFO = 8,\n+\tDIFF_FUNCINFO = 8\n };\n const char *diff_get_color(int diff_use_color, enum color_diff ix);\n #define diff_get_color_opt(o, ix) \\\ndiff --git a/dir.c b/dir.c\nindex 133c333..5ea7a92 100644\n--- a/dir.c\n+++ b/dir.c\n@@ -465,7 +465,7 @@ static struct dir_entry *dir_add_ignored(struct dir_struct *dir, const char *pat\n enum exist_status {\n \tindex_nonexistent = 0,\n \tindex_directory,\n-\tindex_gitdir,\n+\tindex_gitdir\n };\n \n /*\n@@ -533,7 +533,7 @@ static enum exist_status directory_exists_in_index(const char *dirname, int len)\n enum directory_treatment {\n \tshow_directory,\n \tignore_directory,\n-\trecurse_into_directory,\n+\trecurse_into_directory\n };\n \n static enum directory_treatment treat_directory(struct dir_struct *dir,\ndiff --git a/fast-import.c b/fast-import.c\nindex 309f2c5..faa51a9 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -267,7 +267,7 @@ struct hash_list\n typedef enum {\n \tWHENSPEC_RAW = 1,\n \tWHENSPEC_RFC2822,\n-\tWHENSPEC_NOW,\n+\tWHENSPEC_NOW\n } whenspec_type;\n \n struct recent_command\ndiff --git a/grep.h b/grep.h\nindex d35bc29..81f7ae9 100644\n--- a/grep.h\n+++ b/grep.h\n@@ -10,17 +10,17 @@ enum grep_pat_token {\n \tGREP_OPEN_PAREN,\n \tGREP_CLOSE_PAREN,\n \tGREP_NOT,\n-\tGREP_OR,\n+\tGREP_OR\n };\n \n enum grep_context {\n \tGREP_CONTEXT_HEAD,\n-\tGREP_CONTEXT_BODY,\n+\tGREP_CONTEXT_BODY\n };\n \n enum grep_header_field {\n \tGREP_HEADER_AUTHOR = 0,\n-\tGREP_HEADER_COMMITTER,\n+\tGREP_HEADER_COMMITTER\n };\n \n struct grep_pat {\n@@ -40,7 +40,7 @@ enum grep_expr_node {\n \tGREP_NODE_ATOM,\n \tGREP_NODE_NOT,\n \tGREP_NODE_AND,\n-\tGREP_NODE_OR,\n+\tGREP_NODE_OR\n };\n \n struct grep_expr {\ndiff --git a/http-push.c b/http-push.c\nindex 432b20f..bb9ef04 100644\n--- a/http-push.c\n+++ b/http-push.c\n@@ -105,7 +105,7 @@ enum transfer_state {\n \tRUN_PUT,\n \tRUN_MOVE,\n \tABORTED,\n-\tCOMPLETE,\n+\tCOMPLETE\n };\n \n struct transfer_request\ndiff --git a/http-walker.c b/http-walker.c\nindex 700bc13..f3ef0ec 100644\n--- a/http-walker.c\n+++ b/http-walker.c\n@@ -15,7 +15,7 @@ enum object_request_state {\n \tWAITING,\n \tABORTED,\n \tACTIVE,\n-\tCOMPLETE,\n+\tCOMPLETE\n };\n \n struct object_request\ndiff --git a/imap-send.c b/imap-send.c\nindex fa70383..d63a10b 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -230,7 +230,7 @@ enum CAPABILITY {\n \tLITERALPLUS,\n \tNAMESPACE,\n \tSTARTTLS,\n-\tAUTH_CRAM_MD5,\n+\tAUTH_CRAM_MD5\n };\n \n static const char *cap_list[] = {\ndiff --git a/remote.h b/remote.h\nindex 6e13643..888d7c1 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -145,7 +145,7 @@ int branch_merge_matches(struct branch *, int n, const char *);\n enum match_refs_flags {\n \tMATCH_REFS_NONE\t\t= 0,\n \tMATCH_REFS_ALL \t\t= (1 << 0),\n-\tMATCH_REFS_MIRROR\t= (1 << 1),\n+\tMATCH_REFS_MIRROR\t= (1 << 1)\n };\n \n /* Reporting of tracking info */\ndiff --git a/rerere.c b/rerere.c\nindex a59f74f..e66bf6b 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -153,7 +153,7 @@ static int handle_path(unsigned char *sha1, struct rerere_io *io, int marker_siz\n \tgit_SHA_CTX ctx;\n \tint hunk_no = 0;\n \tenum {\n-\t\tRR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL,\n+\t\tRR_CONTEXT = 0, RR_SIDE_1, RR_SIDE_2, RR_ORIGINAL\n \t} hunk = RR_CONTEXT;\n \tstruct strbuf one = STRBUF_INIT, two = STRBUF_INIT;\n \tstruct strbuf buf = STRBUF_INIT;\ndiff --git a/revision.c b/revision.c\nindex 29721ec..d8a558c 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1759,7 +1759,7 @@ int prepare_revision_walk(struct rev_info *revs)\n enum rewrite_result {\n \trewrite_one_ok,\n \trewrite_one_noparents,\n-\trewrite_one_error,\n+\trewrite_one_error\n };\n \n static enum rewrite_result rewrite_one(struct rev_info *revs, struct commit **pp)\ndiff --git a/wt-status.h b/wt-status.h\nindex c60f40a..d348258 100644\n--- a/wt-status.h\n+++ b/wt-status.h\n@@ -11,7 +11,7 @@ enum color_wt_status {\n \tWT_STATUS_CHANGED,\n \tWT_STATUS_UNTRACKED,\n \tWT_STATUS_NOBRANCH,\n-\tWT_STATUS_UNMERGED,\n+\tWT_STATUS_UNMERGED\n };\n \n enum untracked_status_type {\n-- \n1.7.0.2\n\n\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"},{"id":"136657","messageId":"94a0d4531003120118l2a5c69ebh7e62ea8630f94738@mail.gmail.com","threadId":"22989","inReplyTo":"20100311163235.GC7877@thor.il.thewrittenword.com","subject":"Re: [PATCH 3/5] Dangling commas in enum is not portable (resend)","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2010-03-12T09:18:47Z","receivedAt":"2010-03-12T09:18:47Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"On Thu, Mar 11, 2010 at 6:32 PM, Gary V. Vaughan\n<git@mlists.thewrittenword.com> wrote:\n> Unfortunately there are a still a lot of vendor compilers that choke\n> when the last entry in an enum has a dangling comma (irix is one, and\n> I can get you a list of which of our particular platforms exhibit this\n> problem).\n\nI would appreciate that list if it's not much trouble.\n\n-- \nFelipe Contreras\n"},{"id":"140320","messageId":"20100315031718.GA21130@thor.il.thewrittenword.com","threadId":"22989","inReplyTo":"94a0d4531003120118l2a5c69ebh7e62ea8630f94738@mail.gmail.com","subject":"Re: [PATCH 3/5] Dangling commas in enum is not portable (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-04-25T08:35:41Z","receivedAt":"2010-04-25T08:35:41Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"On Fri, Mar 12, 2010 at 11:18:47AM +0200, Felipe Contreras wrote:\n> On Thu, Mar 11, 2010 at 6:32 PM, Gary V. Vaughan\n> <git@mlists.thewrittenword.com> wrote:\n> > Unfortunately there are a still a lot of vendor compilers that choke\n> > when the last entry in an enum has a dangling comma (irix is one, and\n> > I can get you a list of which of our particular platforms exhibit this\n> > problem).\n> \n> I would appreciate that list if it's not much trouble.\n\nI take it back.  I've been porting this patch forward from our builds\nof previous releases, and at some point it certainly was necessary\n(otherwise I wouldn't have written the patch)... and yet, all of our\nplatforms are now able to compile a minimal test program in C.\nEither the offending vendor compilers have issued an update to accept\nthe dangling comma syntax, or we have retired the machines that used\nto have this problem since I originally wrote the patch.\n\nIt's notable that aCC (the HP C++ compiler) and CC (the SunOS C++\ncompiler) both issue a warning on dangling enum commas, but even they\nstill compile successfully.\n\nSorry for the noise,\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"},{"id":"140337","messageId":"l2od2d39d861004250612g9ac6c7b4qdaa8ce0f973846e7@mail.gmail.com","threadId":"22989","inReplyTo":"20100315031718.GA21130@thor.il.thewrittenword.com","subject":"Re: [PATCH 3/5] Dangling commas in enum is not portable (resend)","fromName":"Tor Arntsen","fromEmail":"tor@spacetec.no","sentAt":"2010-04-25T13:12:37Z","receivedAt":"2010-04-25T13:12:37Z","isPatch":true,"sender":{"key":"tor@spacetec.no","avatar":null},"body":"On Sun, Apr 25, 2010 at 10:35, Gary V. Vaughan\n<git@mlists.thewrittenword.com> wrote:\n\n> I take it back.  I've been porting this patch forward from our builds\n> of previous releases, and at some point it certainly was necessary\n> (otherwise I wouldn't have written the patch)... and yet, all of our\n> platforms are now able to compile a minimal test program in C.\n> Either the offending vendor compilers have issued an update to accept\n> the dangling comma syntax, or we have retired the machines that used\n> to have this problem since I originally wrote the patch.\n>\n> It's notable that aCC (the HP C++ compiler) and CC (the SunOS C++\n> compiler) both issue a warning on dangling enum commas, but even they\n> still compile successfully.\n>\n> Sorry for the noise,\n\nThe SGI MIPS Compiler v6.2 on IRIX 6.2 compiles, but with a warning.\nLater MIPSPro 7.2 and 7.4 versions (on 6.5) are OK (silent)\nUnfortunately IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to\ncompile with a trailing comma.\nIBM XLC V10.1 (I have one on AIX 6.1) is OK (silent)\nNative compiler on Tru64 V5.1 is OK (silent)\n\nSo, from the boxes I have access to the IBM XLC V5 version is the one\nwhich has a problem.\n\n-Tor\n"},{"id":"140344","messageId":"20100425152449.GB27695@thor.il.thewrittenword.com","threadId":"22989","inReplyTo":"l2od2d39d861004250612g9ac6c7b4qdaa8ce0f973846e7@mail.gmail.com","subject":"Re: [PATCH 3/5] Dangling commas in enum is not portable (resend)","fromName":"Gary V. Vaughan","fromEmail":"git@mlists.thewrittenword.com","sentAt":"2010-04-25T16:03:06Z","receivedAt":"2010-04-25T16:03:06Z","isPatch":true,"sender":{"key":"git@mlists.thewrittenword.com","avatar":null},"body":"On Sun, Apr 25, 2010 at 03:12:37PM +0200, Tor Arntsen wrote:\n> On Sun, Apr 25, 2010 at 10:35, Gary V. Vaughan\n> <git@mlists.thewrittenword.com> wrote:\n> \n> > I take it back. ?I've been porting this patch forward from our builds\n> > of previous releases, and at some point it certainly was necessary\n> > (otherwise I wouldn't have written the patch)... and yet, all of our\n> > platforms are now able to compile a minimal test program in C.\n> > [[...]]\n> > It's notable that aCC (the HP C++ compiler) and CC (the SunOS C++\n> > compiler) both issue a warning on dangling enum commas, but even they\n> > still compile successfully.\n> \n> The SGI MIPS Compiler v6.2 on IRIX 6.2 compiles, but with a warning.\n> Later MIPSPro 7.2 and 7.4 versions (on 6.5) are OK (silent)\n> Unfortunately IBM VisualAge C 5.0 (I have 5.0.2) on AIX 5.1 fails to\n> compile with a trailing comma.\n> IBM XLC V10.1 (I have one on AIX 6.1) is OK (silent)\n> Native compiler on Tru64 V5.1 is OK (silent)\n> \n> So, from the boxes I have access to the IBM XLC V5 version is the one\n> which has a problem.\n\nI'd be happy to resurrect this patch and resubmit against the latest\ngit release.\n\nCheers,\n-- \nGary V. Vaughan (gary@thewrittenword.com)\n"}]}