threads / patch / 48494

patchcommit: fix sparse 'not declared' warning

Subject: [PATCH] commit: fix sparse 'not declared' warning

## tl;dr

One message between May 14, 2018 and May 14, 2018. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Ramsay Jones· May 14, 2018, 19:20 UTC · lore
Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Duy,

If you need to re-roll your 'nd/commit-util-to-slab' branch, could you please squash this into the relevant patch (commit 37de2f0a93, "merge: use commit-slab in merge remote desc instead of commit->util", 2018-05-13).

Also, my 'static-check.pl' script has pinged on this series due to the use of the 'implement_shared_commit_slab' macro in revision.c (commit 85d055e876, "revision.c: use commit-slab for show_source", 2018-05-13).

This is because that macro only allows you to set the 'scope' of the complete set of functions that are declared there - in this case three of them are not called (well, two are actually called by another two functions in the set) outside of revision.c.

In particular, the functions 'clear_revision_sources', 'init_revision_sources_with_stride' (used in init_##slabname) and 'revision_sources_at_peek' (used in slabname##_at).

I haven't thought too deeply about this issue, or if it even matters, so I have no solutions to offer. ;-)

Thanks!

ATB, Ramsay Jones

 commit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to commit.c +1 −1
diff --git a/commit.c b/commit.c
index 38a3c0e5e..c0582df16 100644
--- a/commit.c
+++ b/commit.c
@@ -1657,7 +1657,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
 }
 
 define_commit_slab(merge_desc_slab, struct merge_remote_desc *);
-struct merge_desc_slab merge_desc_slab = COMMIT_SLAB_INIT(1, merge_desc_slab);
+static struct merge_desc_slab merge_desc_slab = COMMIT_SLAB_INIT(1, merge_desc_slab);
 
 struct merge_remote_desc *merge_remote_util(struct commit *commit)
 {
-- 
2.17.0

← back to recent threads