{"thread":{"id":"53429","subject":"Subject: [PATCH] bloom: fix `make sparse` warning","startedAt":"2020-05-07T23:51:10Z","lastAt":"2020-05-08T12:16:07Z","messageCount":2,"participants":["Ramsay Jones","Derrick Stolee"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"397380","messageId":"01ff8217-bd38-e7e4-58b1-81645ba9282a@ramsayjones.plus.com","threadId":"53429","inReplyTo":null,"subject":"Subject: [PATCH] bloom: fix `make sparse` warning","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2020-05-07T23:51:02Z","receivedAt":"2020-05-07T23:51:10Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=\n <congdanhqx@gmail.com>\n\n* We need a `final_new_line` to make our source code as text file, per\n  POSIX and C specification.\n* `bloom_filters` should be limited to interal linkage only\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n\nHi Junio,\n\nThis patch by Danh seems to have slipped through the cracks, so I decided\nto pass it along. The original version of this patch (which I don't seem\nto be able to find) clashed with one of Jeff's series [1], because they\nboth fixed up a 'No newline at end of file' issue with test-bloom.c.\nAlso as Danh points out [2], the original patch didn't fix up the test\nfiles.\n\nAnyway, this fixes up some 8 sparse warnings on 'master' and 'next':\n\n  $ diff sp-out sp-out1\n  17d16\n  < bloom.h:90:6: warning: no newline at end of file\n  20,22d18\n  < bloom.c:276:1: warning: no newline at end of file\n  < bloom.h:90:6: warning: no newline at end of file\n  < bloom.c:12:26: warning: symbol 'bloom_filters' was not declared. Should it be static?\n  33d28\n  < bloom.h:90:6: warning: no newline at end of file\n  163d157\n  < bloom.h:90:6: warning: no newline at end of file\n  366,367d359\n  < ./bloom.h:90:6: warning: no newline at end of file\n  < t/helper/test-bloom.c:6:30: warning: symbol 'settings' was not declared. Should it be static?\n  $ \n  \n... along with a further warning on 'pu', due to the 'ds/line-log-on-bloom'\nbranch adding another '#include \"bloom.h\"'.\n\n\n[1] https://lore.kernel.org/git/20200423205851.GA1633985@coredump.intra.peff.net/\n[2] https://lore.kernel.org/git/20200424010047.GD1949@danh.dev/\n\nATB,\nRamsay Jones\n\n bloom.c               | 4 ++--\n bloom.h               | 2 +-\n t/helper/test-bloom.c | 2 +-\n t/t0095-bloom.sh      | 2 +-\n t/t4216-log-bloom.sh  | 2 +-\n 5 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/bloom.c b/bloom.c\nindex dd9bab9bbd..ee025e0c61 100644\n--- a/bloom.c\n+++ b/bloom.c\n@@ -9,7 +9,7 @@\n \n define_commit_slab(bloom_filter_slab, struct bloom_filter);\n \n-struct bloom_filter_slab bloom_filters;\n+static struct bloom_filter_slab bloom_filters;\n \n struct pathmap_hash_entry {\n     struct hashmap_entry entry;\n@@ -273,4 +273,4 @@ int bloom_filter_contains(const struct bloom_filter *filter,\n \t}\n \n \treturn 1;\n-}\n\\ No newline at end of file\n+}\ndiff --git a/bloom.h b/bloom.h\nindex b935186425..e0e59e0754 100644\n--- a/bloom.h\n+++ b/bloom.h\n@@ -87,4 +87,4 @@ int bloom_filter_contains(const struct bloom_filter *filter,\n \t\t\t  const struct bloom_key *key,\n \t\t\t  const struct bloom_filter_settings *settings);\n \n-#endif\n\\ No newline at end of file\n+#endif\ndiff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c\nindex 77eb27adac..456f5ea7f9 100644\n--- a/t/helper/test-bloom.c\n+++ b/t/helper/test-bloom.c\n@@ -3,7 +3,7 @@\n #include \"test-tool.h\"\n #include \"commit.h\"\n \n-struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;\n+static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;\n \n static void add_string_to_filter(const char *data, struct bloom_filter *filter) {\n \t\tstruct bloom_key key;\ndiff --git a/t/t0095-bloom.sh b/t/t0095-bloom.sh\nindex 8f9eef116d..809ec7b0b8 100755\n--- a/t/t0095-bloom.sh\n+++ b/t/t0095-bloom.sh\n@@ -114,4 +114,4 @@ test_expect_success EXPENSIVE 'get bloom filter for commit with 513 changes' '\n \ttest_cmp expect actual\n '\n \n-test_done\n\\ No newline at end of file\n+test_done\ndiff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh\nindex c7011f33e2..21b68dd6c8 100755\n--- a/t/t4216-log-bloom.sh\n+++ b/t/t4216-log-bloom.sh\n@@ -152,4 +152,4 @@ test_expect_success 'Use Bloom filters if they exist in the latest but not all c\n \ttest_bloom_filters_used_when_some_filters_are_missing \"-- A/B\"\n '\n \n-test_done\n\\ No newline at end of file\n+test_done\n-- \n2.26.2\n"},{"id":"397400","messageId":"e0594ef1-d471-877b-81d1-980ba47966dc@gmail.com","threadId":"53429","inReplyTo":"01ff8217-bd38-e7e4-58b1-81645ba9282a@ramsayjones.plus.com","subject":"Re: Subject: [PATCH] bloom: fix `make sparse` warning","fromName":"Derrick Stolee","fromEmail":"stolee@gmail.com","sentAt":"2020-05-08T12:15:48Z","receivedAt":"2020-05-08T12:16:07Z","isPatch":true,"sender":{"key":"stolee@gmail.com","avatar":"https://avatars.githubusercontent.com/u/570044?v=4"},"body":"\n\nOn 5/7/2020 7:51 PM, Ramsay Jones wrote:\n> From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=\n>  <congdanhqx@gmail.com>\n> \n> * We need a `final_new_line` to make our source code as text file, per\n>   POSIX and C specification.\n> * `bloom_filters` should be limited to interal linkage only\n> \n> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n> \n> Hi Junio,\n> \n> This patch by Danh seems to have slipped through the cracks, so I decided\n> to pass it along. The original version of this patch (which I don't seem\n> to be able to find) clashed with one of Jeff's series [1], because they\n> both fixed up a 'No newline at end of file' issue with test-bloom.c.\n> Also as Danh points out [2], the original patch didn't fix up the test\n> files.\n> \n> Anyway, this fixes up some 8 sparse warnings on 'master' and 'next':\n> \n>   $ diff sp-out sp-out1\n>   17d16\n>   < bloom.h:90:6: warning: no newline at end of file\n>   20,22d18\n>   < bloom.c:276:1: warning: no newline at end of file\n>   < bloom.h:90:6: warning: no newline at end of file\n>   < bloom.c:12:26: warning: symbol 'bloom_filters' was not declared. Should it be static?\n>   33d28\n>   < bloom.h:90:6: warning: no newline at end of file\n>   163d157\n>   < bloom.h:90:6: warning: no newline at end of file\n>   366,367d359\n>   < ./bloom.h:90:6: warning: no newline at end of file\n>   < t/helper/test-bloom.c:6:30: warning: symbol 'settings' was not declared. Should it be static?\n>   $ \n>   \n> ... along with a further warning on 'pu', due to the 'ds/line-log-on-bloom'\n> branch adding another '#include \"bloom.h\"'.\n\nThanks for being careful and making sure this gets in.\n\nThe patch looks good to me.\n\n-Stolee\n"}]}