git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Subject: [PATCH] bloom: fix `make sparse` warning
@ 2020-05-07 23:51 Ramsay Jones
  2020-05-08 12:15 ` Derrick Stolee
  0 siblings, 1 reply; 2+ messages in thread
From: Ramsay Jones @ 2020-05-07 23:51 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Đoàn Trần Công Danh, Jeff King,
	GIT Mailing-list

From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>

* We need a `final_new_line` to make our source code as text file, per
  POSIX and C specification.
* `bloom_filters` should be limited to interal linkage only

Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---

Hi Junio,

This patch by Danh seems to have slipped through the cracks, so I decided
to pass it along. The original version of this patch (which I don't seem
to be able to find) clashed with one of Jeff's series [1], because they
both fixed up a 'No newline at end of file' issue with test-bloom.c.
Also as Danh points out [2], the original patch didn't fix up the test
files.

Anyway, this fixes up some 8 sparse warnings on 'master' and 'next':

  $ diff sp-out sp-out1
  17d16
  < bloom.h:90:6: warning: no newline at end of file
  20,22d18
  < bloom.c:276:1: warning: no newline at end of file
  < bloom.h:90:6: warning: no newline at end of file
  < bloom.c:12:26: warning: symbol 'bloom_filters' was not declared. Should it be static?
  33d28
  < bloom.h:90:6: warning: no newline at end of file
  163d157
  < bloom.h:90:6: warning: no newline at end of file
  366,367d359
  < ./bloom.h:90:6: warning: no newline at end of file
  < t/helper/test-bloom.c:6:30: warning: symbol 'settings' was not declared. Should it be static?
  $ 
  
... along with a further warning on 'pu', due to the 'ds/line-log-on-bloom'
branch adding another '#include "bloom.h"'.


[1] https://lore.kernel.org/git/20200423205851.GA1633985@coredump.intra.peff.net/
[2] https://lore.kernel.org/git/20200424010047.GD1949@danh.dev/

ATB,
Ramsay Jones

 bloom.c               | 4 ++--
 bloom.h               | 2 +-
 t/helper/test-bloom.c | 2 +-
 t/t0095-bloom.sh      | 2 +-
 t/t4216-log-bloom.sh  | 2 +-
 5 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/bloom.c b/bloom.c
index dd9bab9bbd..ee025e0c61 100644
--- a/bloom.c
+++ b/bloom.c
@@ -9,7 +9,7 @@
 
 define_commit_slab(bloom_filter_slab, struct bloom_filter);
 
-struct bloom_filter_slab bloom_filters;
+static struct bloom_filter_slab bloom_filters;
 
 struct pathmap_hash_entry {
     struct hashmap_entry entry;
@@ -273,4 +273,4 @@ int bloom_filter_contains(const struct bloom_filter *filter,
 	}
 
 	return 1;
-}
\ No newline at end of file
+}
diff --git a/bloom.h b/bloom.h
index b935186425..e0e59e0754 100644
--- a/bloom.h
+++ b/bloom.h
@@ -87,4 +87,4 @@ int bloom_filter_contains(const struct bloom_filter *filter,
 			  const struct bloom_key *key,
 			  const struct bloom_filter_settings *settings);
 
-#endif
\ No newline at end of file
+#endif
diff --git a/t/helper/test-bloom.c b/t/helper/test-bloom.c
index 77eb27adac..456f5ea7f9 100644
--- a/t/helper/test-bloom.c
+++ b/t/helper/test-bloom.c
@@ -3,7 +3,7 @@
 #include "test-tool.h"
 #include "commit.h"
 
-struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
+static struct bloom_filter_settings settings = DEFAULT_BLOOM_FILTER_SETTINGS;
 
 static void add_string_to_filter(const char *data, struct bloom_filter *filter) {
 		struct bloom_key key;
diff --git a/t/t0095-bloom.sh b/t/t0095-bloom.sh
index 8f9eef116d..809ec7b0b8 100755
--- a/t/t0095-bloom.sh
+++ b/t/t0095-bloom.sh
@@ -114,4 +114,4 @@ test_expect_success EXPENSIVE 'get bloom filter for commit with 513 changes' '
 	test_cmp expect actual
 '
 
-test_done
\ No newline at end of file
+test_done
diff --git a/t/t4216-log-bloom.sh b/t/t4216-log-bloom.sh
index c7011f33e2..21b68dd6c8 100755
--- a/t/t4216-log-bloom.sh
+++ b/t/t4216-log-bloom.sh
@@ -152,4 +152,4 @@ test_expect_success 'Use Bloom filters if they exist in the latest but not all c
 	test_bloom_filters_used_when_some_filters_are_missing "-- A/B"
 '
 
-test_done
\ No newline at end of file
+test_done
-- 
2.26.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Subject: [PATCH] bloom: fix `make sparse` warning
  2020-05-07 23:51 Subject: [PATCH] bloom: fix `make sparse` warning Ramsay Jones
@ 2020-05-08 12:15 ` Derrick Stolee
  0 siblings, 0 replies; 2+ messages in thread
From: Derrick Stolee @ 2020-05-08 12:15 UTC (permalink / raw)
  To: Ramsay Jones, Junio C Hamano
  Cc: Đoàn Trần Công Danh, Jeff King,
	GIT Mailing-list



On 5/7/2020 7:51 PM, Ramsay Jones wrote:
> From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
>  <congdanhqx@gmail.com>
> 
> * We need a `final_new_line` to make our source code as text file, per
>   POSIX and C specification.
> * `bloom_filters` should be limited to interal linkage only
> 
> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
> 
> Hi Junio,
> 
> This patch by Danh seems to have slipped through the cracks, so I decided
> to pass it along. The original version of this patch (which I don't seem
> to be able to find) clashed with one of Jeff's series [1], because they
> both fixed up a 'No newline at end of file' issue with test-bloom.c.
> Also as Danh points out [2], the original patch didn't fix up the test
> files.
> 
> Anyway, this fixes up some 8 sparse warnings on 'master' and 'next':
> 
>   $ diff sp-out sp-out1
>   17d16
>   < bloom.h:90:6: warning: no newline at end of file
>   20,22d18
>   < bloom.c:276:1: warning: no newline at end of file
>   < bloom.h:90:6: warning: no newline at end of file
>   < bloom.c:12:26: warning: symbol 'bloom_filters' was not declared. Should it be static?
>   33d28
>   < bloom.h:90:6: warning: no newline at end of file
>   163d157
>   < bloom.h:90:6: warning: no newline at end of file
>   366,367d359
>   < ./bloom.h:90:6: warning: no newline at end of file
>   < t/helper/test-bloom.c:6:30: warning: symbol 'settings' was not declared. Should it be static?
>   $ 
>   
> ... along with a further warning on 'pu', due to the 'ds/line-log-on-bloom'
> branch adding another '#include "bloom.h"'.

Thanks for being careful and making sure this gets in.

The patch looks good to me.

-Stolee

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-08 12:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 23:51 Subject: [PATCH] bloom: fix `make sparse` warning Ramsay Jones
2020-05-08 12:15 ` Derrick Stolee

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).