{"thread":{"id":"49669","subject":"[PATCH v3 0/3] delta-islands: avoid unused function messages","startedAt":"2018-10-25T11:04:59Z","lastAt":"2018-10-27T01:45:33Z","messageCount":9,"participants":["Carlo Marcelo Arenas Belón","SZEDER Gábor","Ramsay Jones","Carlo Arenas"],"isPatch":true,"patchVersion":3,"patchTotal":3},"messages":[{"id":"361504","messageId":"20181025110427.13655-1-carenas@gmail.com","threadId":"49669","inReplyTo":null,"subject":"[PATCH v3 0/3] delta-islands: avoid unused function messages","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-10-25T11:04:24Z","receivedAt":"2018-10-25T11:04:59Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"the macro generated code from delta-islands (using khash) triggers\nsome unused function warnings in macOS, OpenBSD and some linux with a\nnewer version of clang because of its use of static functions.\n\nChanges from v2:\n* Relay in the C code including git-compat-util as suggested by Jeff\n* Commit message cleanup\n* Make changes hdr-check clean\n\nChanges from v1:\n* Use MAYBE_UNUSED for all cases as suggested by Duy\n\nCarlo Marcelo Arenas Belón (3):\n  commit-slab: move MAYBE_UNUSED into git-compat-util\n  khash: silence -Wunused-function in delta-islands from khash\n  commit-slab: missing definitions and forward declarations (hdr-check)\n\n commit-slab-impl.h | 4 ++--\n commit-slab.h      | 2 ++\n git-compat-util.h  | 2 ++\n khash.h            | 2 +-\n 4 files changed, 7 insertions(+), 3 deletions(-)\n\n-- \n2.19.1\n\n"},{"id":"361505","messageId":"20181025110427.13655-2-carenas@gmail.com","threadId":"49669","inReplyTo":"20181025110427.13655-1-carenas@gmail.com","subject":"[PATCH v3 1/3] commit-slab: move MAYBE_UNUSED into git-compat-util","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-10-25T11:04:25Z","receivedAt":"2018-10-25T11:05:09Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"after 36da893114 (\"config.mak.dev: enable -Wunused-function\", 2018-10-18)\nit is expected to be used to prevent -Wunused-function warnings for code\nthat was macro generated\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n commit-slab-impl.h | 4 +---\n git-compat-util.h  | 2 ++\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/commit-slab-impl.h b/commit-slab-impl.h\nindex ac1e6d409a..e352c2f8c1 100644\n--- a/commit-slab-impl.h\n+++ b/commit-slab-impl.h\n@@ -1,10 +1,8 @@\n #ifndef COMMIT_SLAB_IMPL_H\n #define COMMIT_SLAB_IMPL_H\n \n-#define MAYBE_UNUSED __attribute__((__unused__))\n-\n #define implement_static_commit_slab(slabname, elemtype) \\\n-\timplement_commit_slab(slabname, elemtype, static MAYBE_UNUSED)\n+\timplement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)\n \n #define implement_shared_commit_slab(slabname, elemtype) \\\n \timplement_commit_slab(slabname, elemtype, )\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 48c955541e..8121b73b4a 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -408,6 +408,8 @@ static inline char *git_find_last_dir_sep(const char *path)\n #define LAST_ARG_MUST_BE_NULL\n #endif\n \n+#define MAYBE_UNUSED __attribute__((__unused__))\n+\n #include \"compat/bswap.h\"\n \n #include \"wildmatch.h\"\n-- \n2.19.1\n\n"},{"id":"361506","messageId":"20181025110427.13655-3-carenas@gmail.com","threadId":"49669","inReplyTo":"20181025110427.13655-1-carenas@gmail.com","subject":"[PATCH v3 2/3] khash: silence -Wunused-function in delta-islands from khash","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-10-25T11:04:26Z","receivedAt":"2018-10-25T11:05:14Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"showing the following when compiled with latest clang (OpenBSD, Fedora\nand macOS):\n\ndelta-islands.c:23:1: warning: unused function 'kh_destroy_str'\n      [-Wunused-function]\ndelta-islands.c:23:1: warning: unused function 'kh_clear_str'\n      [-Wunused-function]\ndelta-islands.c:23:1: warning: unused function 'kh_del_str' [-Wunused-function]\n\nReported-by: René Scharfe <l.s.r@web.de>\nSuggested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n khash.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/khash.h b/khash.h\nindex d10caa0c35..532109c87f 100644\n--- a/khash.h\n+++ b/khash.h\n@@ -234,7 +234,7 @@ static const double __ac_HASH_UPPER = 0.77;\n \t__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)\n \n #define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \\\n-\tKHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)\n+\tKHASH_INIT2(name, MAYBE_UNUSED static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)\n \n /* Other convenient macros... */\n \n-- \n2.19.1\n\n"},{"id":"361507","messageId":"20181025110427.13655-4-carenas@gmail.com","threadId":"49669","inReplyTo":"20181025110427.13655-1-carenas@gmail.com","subject":"[PATCH v3 3/3] commit-slab: missing definitions and forward declarations (hdr-check)","fromName":"Carlo Marcelo Arenas Belón","fromEmail":"carenas@gmail.com","sentAt":"2018-10-25T11:04:27Z","receivedAt":"2018-10-25T11:05:17Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"struct commmit needs to be defined before commit-slab can generate\nworking code, object_id should be at least known through a forward\ndeclaration\n\nSigned-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n---\n commit-slab-impl.h | 2 ++\n commit-slab.h      | 2 ++\n 2 files changed, 4 insertions(+)\n\ndiff --git a/commit-slab-impl.h b/commit-slab-impl.h\nindex e352c2f8c1..db7cf3f19b 100644\n--- a/commit-slab-impl.h\n+++ b/commit-slab-impl.h\n@@ -1,6 +1,8 @@\n #ifndef COMMIT_SLAB_IMPL_H\n #define COMMIT_SLAB_IMPL_H\n \n+#include \"commit.h\"\n+\n #define implement_static_commit_slab(slabname, elemtype) \\\n \timplement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)\n \ndiff --git a/commit-slab.h b/commit-slab.h\nindex 69bf0c807c..722252de61 100644\n--- a/commit-slab.h\n+++ b/commit-slab.h\n@@ -1,6 +1,8 @@\n #ifndef COMMIT_SLAB_H\n #define COMMIT_SLAB_H\n \n+struct object_id;\n+\n #include \"commit-slab-decl.h\"\n #include \"commit-slab-impl.h\"\n \n-- \n2.19.1\n\n"},{"id":"361509","messageId":"20181025113045.GM30222@szeder.dev","threadId":"49669","inReplyTo":"20181025110427.13655-3-carenas@gmail.com","subject":"Re: [PATCH v3 2/3] khash: silence -Wunused-function in delta-islands from khash","fromName":"SZEDER Gábor","fromEmail":"szeder.dev@gmail.com","sentAt":"2018-10-25T11:30:45Z","receivedAt":"2018-10-25T11:30:51Z","isPatch":true,"sender":{"key":"szeder.dev@gmail.com","avatar":"https://avatars.githubusercontent.com/u/116324?v=4"},"body":"On Thu, Oct 25, 2018 at 04:04:26AM -0700, Carlo Marcelo Arenas Belón wrote:\n> showing the following when compiled with latest clang (OpenBSD, Fedora\n> and macOS):\n\ns/^s/S/\nThis applies to your other commit messages as well.\n\nBut more importantly, please be explicit about the compiler version\nthat emits the warning, so others won't have to guess when stumbling\nupon this commit in a few months or years time.\n\n> delta-islands.c:23:1: warning: unused function 'kh_destroy_str'\n>       [-Wunused-function]\n> delta-islands.c:23:1: warning: unused function 'kh_clear_str'\n>       [-Wunused-function]\n> delta-islands.c:23:1: warning: unused function 'kh_del_str' [-Wunused-function]\n> \n> Reported-by: René Scharfe <l.s.r@web.de>\n> Suggested-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  khash.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/khash.h b/khash.h\n> index d10caa0c35..532109c87f 100644\n> --- a/khash.h\n> +++ b/khash.h\n> @@ -234,7 +234,7 @@ static const double __ac_HASH_UPPER = 0.77;\n>  \t__KHASH_IMPL(name, SCOPE, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)\n>  \n>  #define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \\\n> -\tKHASH_INIT2(name, static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)\n> +\tKHASH_INIT2(name, MAYBE_UNUSED static inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)\n>  \n>  /* Other convenient macros... */\n>  \n> -- \n> 2.19.1\n> \n"},{"id":"361546","messageId":"b6fe7e58-5b3f-f139-be8d-210526a26767@ramsayjones.plus.com","threadId":"49669","inReplyTo":"20181025110427.13655-4-carenas@gmail.com","subject":"Re: [PATCH v3 3/3] commit-slab: missing definitions and forward declarations (hdr-check)","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-10-25T18:54:35Z","receivedAt":"2018-10-25T18:54:39Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 25/10/2018 12:04, Carlo Marcelo Arenas Belón wrote:\n> struct commmit needs to be defined before commit-slab can generate\n> working code, object_id should be at least known through a forward\n> declaration\n> \n> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n> ---\n>  commit-slab-impl.h | 2 ++\n>  commit-slab.h      | 2 ++\n>  2 files changed, 4 insertions(+)\n> \n> diff --git a/commit-slab-impl.h b/commit-slab-impl.h\n> index e352c2f8c1..db7cf3f19b 100644\n> --- a/commit-slab-impl.h\n> +++ b/commit-slab-impl.h\n> @@ -1,6 +1,8 @@\n>  #ifndef COMMIT_SLAB_IMPL_H\n>  #define COMMIT_SLAB_IMPL_H\n>  \n> +#include \"commit.h\"\n> +\n>  #define implement_static_commit_slab(slabname, elemtype) \\\n>  \timplement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)\n>  \n> diff --git a/commit-slab.h b/commit-slab.h\n> index 69bf0c807c..722252de61 100644\n> --- a/commit-slab.h\n> +++ b/commit-slab.h\n> @@ -1,6 +1,8 @@\n>  #ifndef COMMIT_SLAB_H\n>  #define COMMIT_SLAB_H\n>  \n> +struct object_id;\n> +\n>  #include \"commit-slab-decl.h\"\n>  #include \"commit-slab-impl.h\"\n>  \n> \n\nHmm, sorry, I don't see how this patch has anything to do\nwith the other two patches! ;-)\n\nAlso, I have a patch to fix up the 'commit-reach.h' header\n(it was part of my original series, just had to update the\ncommit message), which adds these very #includes and forward\ndeclarations when _using_ the commit-slab.\n\nI haven't tried applying your patches yet, which may answer\nmy questions, so I am a little puzzled.\n\nATB,\nRamsay Jones\n\n"},{"id":"361560","messageId":"d5b54ed8-689b-6f12-5888-fb598db8f083@ramsayjones.plus.com","threadId":"49669","inReplyTo":"b6fe7e58-5b3f-f139-be8d-210526a26767@ramsayjones.plus.com","subject":"Re: [PATCH v3 3/3] commit-slab: missing definitions and forward declarations (hdr-check)","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-10-25T21:08:42Z","receivedAt":"2018-10-25T21:08:46Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 25/10/2018 19:54, Ramsay Jones wrote:\n> \n> \n> On 25/10/2018 12:04, Carlo Marcelo Arenas Belón wrote:\n>> struct commmit needs to be defined before commit-slab can generate\n>> working code, object_id should be at least known through a forward\n>> declaration\n>>\n>> Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>\n>> ---\n>>  commit-slab-impl.h | 2 ++\n>>  commit-slab.h      | 2 ++\n>>  2 files changed, 4 insertions(+)\n>>\n>> diff --git a/commit-slab-impl.h b/commit-slab-impl.h\n>> index e352c2f8c1..db7cf3f19b 100644\n>> --- a/commit-slab-impl.h\n>> +++ b/commit-slab-impl.h\n>> @@ -1,6 +1,8 @@\n>>  #ifndef COMMIT_SLAB_IMPL_H\n>>  #define COMMIT_SLAB_IMPL_H\n>>  \n>> +#include \"commit.h\"\n>> +\n>>  #define implement_static_commit_slab(slabname, elemtype) \\\n>>  \timplement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)\n>>  \n>> diff --git a/commit-slab.h b/commit-slab.h\n>> index 69bf0c807c..722252de61 100644\n>> --- a/commit-slab.h\n>> +++ b/commit-slab.h\n>> @@ -1,6 +1,8 @@\n>>  #ifndef COMMIT_SLAB_H\n>>  #define COMMIT_SLAB_H\n>>  \n>> +struct object_id;\n>> +\n>>  #include \"commit-slab-decl.h\"\n>>  #include \"commit-slab-impl.h\"\n>>  \n>>\n> \n> Hmm, sorry, I don't see how this patch has anything to do\n> with the other two patches! ;-)\n> \n> Also, I have a patch to fix up the 'commit-reach.h' header\n> (it was part of my original series, just had to update the\n> commit message), which adds these very #includes and forward\n> declarations when _using_ the commit-slab.\n> \n> I haven't tried applying your patches yet, which may answer\n> my questions, so I am a little puzzled.\n\nSo, having now applied your patches, I still don't see what this\npatch has to do with the others! I suppose it is dependent on the\ncompiler/version? (the most up-to-date version of clang available\nto me is 5.0.1).\n\nYes, this will 'fix' the 'commit-reach.h' header (not surprising),\nbut I prefer my patch. ;-)\n\nStill puzzled.\n\nATB,\nRamsay Jones\n\n"},{"id":"361592","messageId":"CAPUEspiFDX8280qezkQ0WvJ5-9cp2eG3p+zX4F6HZNgLBACoHw@mail.gmail.com","threadId":"49669","inReplyTo":"d5b54ed8-689b-6f12-5888-fb598db8f083@ramsayjones.plus.com","subject":"Re: [PATCH v3 3/3] commit-slab: missing definitions and forward declarations (hdr-check)","fromName":"Carlo Arenas","fromEmail":"carenas@gmail.com","sentAt":"2018-10-26T03:15:56Z","receivedAt":"2018-10-26T03:16:09Z","isPatch":true,"sender":{"key":"carenas@gmail.com","avatar":"https://avatars.githubusercontent.com/u/76036?v=4"},"body":"On Thu, Oct 25, 2018 at 2:09 PM Ramsay Jones\n<ramsay@ramsayjones.plus.com> wrote:\n> Yes, this will 'fix' the 'commit-reach.h' header (not surprising),\n> but I prefer my patch. ;-)\n\nI apologize, I joined the list recently and so might had missed a\nreroll; the merged series in pu doesn't seem to include it and the\nerror was around the code I changed, so wanted to make sure it would\nbe addressed sooner rather than later.\n\neitherway, I agree with you my patch (or something better) would fit\nbetter in your topic branch than on mine and while I haven't seen your\npatch I am sure is most likely better.\n\n> Still puzzled.\n\nthis are the last lines of a `make hdr-check` in Fedora Rawhide, it\nshould behave the same regardless of OS or compiler used IMHO\n\n    HDR commit-reach.h\ncommit-reach.h:45:28: warning: ‘struct object_id’ declared inside\nparameter list will not be visible outside of this definition or\ndeclaration\n int ref_newer(const struct object_id *new_oid, const struct object_id\n*old_oid);\n                            ^~~~~~~~~\nIn file included from commit-slab.h:5,\n                 from commit-reach.h:4:\ncommit-reach.h: In function ‘contains_cache_at_peek’:\ncommit-slab-impl.h:47:14: error: dereferencing pointer to incomplete\ntype ‘const struct commit’\n  nth_slab = c->index / s->slab_size;    \\\n              ^~\ncommit-slab-impl.h:7:2: note: in expansion of macro ‘implement_commit_slab’\n  implement_commit_slab(slabname, elemtype, static MAYBE_UNUSED)\n  ^~~~~~~~~~~~~~~~~~~~~\ncommit-slab.h:49:2: note: in expansion of macro ‘implement_static_commit_slab’\n  implement_static_commit_slab(slabname, elemtype)\n  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~\ncommit-reach.h:57:1: note: in expansion of macro ‘define_commit_slab’\n define_commit_slab(contains_cache, enum contains_result);\n ^~~~~~~~~~~~~~~~~~\ncommit-reach.h: At top level:\ncommit-reach.h:69:41: warning: ‘struct object_array’ declared inside\nparameter list will not be visible outside of this definition or\ndeclaration\n int can_all_from_reach_with_flag(struct object_array *from,\n                                         ^~~~~~~~~~~~\nmake: *** [Makefile:2685: commit-reach.hco] Error 1\n\nCarlo\n"},{"id":"361660","messageId":"de120e07-0b26-295e-3128-e8b3891577e2@ramsayjones.plus.com","threadId":"49669","inReplyTo":"CAPUEspiFDX8280qezkQ0WvJ5-9cp2eG3p+zX4F6HZNgLBACoHw@mail.gmail.com","subject":"Re: [PATCH v3 3/3] commit-slab: missing definitions and forward declarations (hdr-check)","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-10-27T01:45:28Z","receivedAt":"2018-10-27T01:45:33Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 26/10/2018 04:15, Carlo Arenas wrote:\n> On Thu, Oct 25, 2018 at 2:09 PM Ramsay Jones\n> <ramsay@ramsayjones.plus.com> wrote:\n>> Yes, this will 'fix' the 'commit-reach.h' header (not surprising),\n>> but I prefer my patch. ;-)\n> \n> I apologize, I joined the list recently and so might had missed a\n> reroll; the merged series in pu doesn't seem to include it and the\n> error was around the code I changed, so wanted to make sure it would\n> be addressed sooner rather than later.\n> \n> eitherway, I agree with you my patch (or something better) would fit\n> better in your topic branch than on mine and while I haven't seen your\n> patch I am sure is most likely better.\n\nHmm, I don't know about that!\n\nSince the original series has progressed, any additions will now\nresult in a new set of patches, rather than a re-roll.\n\nThe original 'commit-reach.h' patch was not applied as part of the\nlast series, since the commit message was felt to be lacking (well,\nit was actually non-existent!). ;-)\n\nI have been making some additional changes to the 'hdr-check' target\nin the Makefile, but I haven't quite finished. I will send the other\n(non-Makefile) changes soon. [These patches will make the 'master'\nand 'next' branches 'hdr-check' clean for me].\n\nATB,\nRamsay Jones\n"}]}