{"thread":{"id":"48956","subject":"[PATCH v2 0/1] Pedantic fix for Apple clang","startedAt":"2018-07-25T21:56:21Z","lastAt":"2018-07-26T00:44:14Z","messageCount":3,"participants":["Beat Bolli","Jonathan Nieder"],"isPatch":true,"patchVersion":2,"patchTotal":1},"messages":[{"id":"353595","messageId":"20180725215607.19910-1-dev+git@drbeat.li","threadId":"48956","inReplyTo":null,"subject":"[PATCH v2 0/1] Pedantic fix for Apple clang","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2018-07-25T21:56:06Z","receivedAt":"2018-07-25T21:56:21Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Following up on my previous series bb/pedantic for gcc, this is a fix\nfor pedantic compilation under MacOS 10.13.6 (High Sierra) with the\ncommand line tools of Xcode Version 9.4.1 (9F2000).\n\nChanges against v1:\n\n- [1/2]: include cache.h in packfile.h.\n\n- [2/2]: drop it. Christian Couder is going to include this in the next\n  version of the cc/remote-odb topic.\n\nBeat Bolli (1):\n  packfile: drop a repeated enum declaration\n\n packfile.h   | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\n-- \n2.18.0\n\n"},{"id":"353596","messageId":"20180725215607.19910-2-dev+git@drbeat.li","threadId":"48956","inReplyTo":"20180725215607.19910-1-dev+git@drbeat.li","subject":"[PATCH v2] packfile: ensure that enum object_type is defined","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2018-07-25T21:56:07Z","receivedAt":"2018-07-25T21:56:21Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with\n\"make DEVELOPER=1 DEVOPTS=pedantic\", the compiler says\n\n    error: redeclaration of already-defined enum 'object_type' is a GNU\n    extension [-Werror,-Wgnu-redeclared-enum]\n\nAccording to https://en.cppreference.com/w/c/language/declarations\n(section \"Redeclaration\"), a repeated declaration after the definition\nis only legal for structs and unions, but not for enums.\n\nDrop the belated declaration of enum object_type and include cache.h\ninstead to make sure the enum is defined.\n\nHelped-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n packfile.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/packfile.h b/packfile.h\nindex 51383774ec72..28318c5c7c42 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -1,12 +1,12 @@\n #ifndef PACKFILE_H\n #define PACKFILE_H\n \n+#include \"cache.h\"\n #include \"oidset.h\"\n \n /* in object-store.h */\n struct packed_git;\n struct object_info;\n-enum object_type;\n \n /*\n  * Generate the filename to be used for a pack file with checksum \"sha1\" and\n-- \n2.18.0\n\n"},{"id":"353604","messageId":"20180726004400.GA217613@aiede.svl.corp.google.com","threadId":"48956","inReplyTo":"20180725215607.19910-2-dev+git@drbeat.li","subject":"Re: [PATCH v2] packfile: ensure that enum object_type is defined","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-07-26T00:44:00Z","receivedAt":"2018-07-26T00:44:14Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Beat Bolli wrote:\n\n> When compiling under Apple LLVM version 9.1.0 (clang-902.0.39.2) with\n> \"make DEVELOPER=1 DEVOPTS=pedantic\", the compiler says\n>\n>     error: redeclaration of already-defined enum 'object_type' is a GNU\n>     extension [-Werror,-Wgnu-redeclared-enum]\n>\n> According to https://en.cppreference.com/w/c/language/declarations\n> (section \"Redeclaration\"), a repeated declaration after the definition\n> is only legal for structs and unions, but not for enums.\n>\n> Drop the belated declaration of enum object_type and include cache.h\n> instead to make sure the enum is defined.\n>\n> Helped-by: Jonathan Nieder <jrnieder@gmail.com>\n> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> ---\n>  packfile.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n\nThanks!  I had run into this using clang on Linux, too, but hadn't\nspent the time to track it down and write a patch.\n\nRunning\n\n\tgit grep -e 'enum [^ ]*;'\n\ndoesn't find any other instances of this error.  Thanks for fixing it.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nBy the way, not about this patch:\n\n[...]\n> +++ b/packfile.h\n> @@ -1,12 +1,12 @@\n>  #ifndef PACKFILE_H\n>  #define PACKFILE_H\n>  \n> +#include \"cache.h\"\n>  #include \"oidset.h\"\n>  \n>  /* in object-store.h */\n>  struct packed_git;\n>  struct object_info;\n> -enum object_type;\n\nThis '/* in object-store.h */' comment can easily go stale since\nnothing enforces that it stays accurate.  I don't think it's a useful\ncomment to have anyway, since it's straightforward to grep for where\nthe struct is defined.  I think we should remove the comment.\n\nThanks,\nJonathan\n"}]}