threads / patch / 53596

patchgit.c: fix sparse warning

Subject: [PATCH] git.c: fix sparse warning

## tl;dr

2 messages between Jun 1, 2020 and Jun 3, 2020. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Ramsay Jones· Jun 1, 2020, 23:27 UTC · lore

Commit 4acc44d720 (config: add setting to ignore sparsity patterns in some cmds, 2020-05-27) adds an external symbol definition without a corresponding external symbol declaration. This causes sparse to complain: "symbol 'opt_restrict_to_sparse_paths' was not declared. Should it be static?".

In order to suppress the warning, #include the 'sparse-checkout.h' header file, which contains the required extern declaration.

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
---
Hi Matheus,

If you need to re-roll your 'mt/grep-sparse-checkout' branch, could you please squash this into the relevant patch.

[This is the minimum fix - but I might be tempted to move the definition of the variable to 'sparse-checkout.c' as well.]

Thanks!

ATB, Ramsay Jones

 git.c | 1 +
 1 file changed, 1 insertion(+)
Show changes to git.c +1 −0
diff --git a/git.c b/git.c
index 07de4363ef..6e62001f2f 100644
--- a/git.c
+++ b/git.c
@@ -5,6 +5,7 @@
 #include "run-command.h"
 #include "alias.h"
 #include "shallow.h"
+#include "sparse-checkout.h"
 
 #define RUN_SETUP		(1<<0)
 #define RUN_SETUP_GENTLY	(1<<1)
-- 
2.26.2
Matheus Tavares Bernardino· Jun 3, 2020, 02:17 UTC · re: Ramsay Jones · lore

Re: [PATCH] git.c: fix sparse warning

On Mon, Jun 1, 2020 at 8:27 PM Ramsay Jones <ramsay@ramsayjones.plus.com> wrote:
Show 18 quoted lines
>
>
> Commit 4acc44d720 (config: add setting to ignore sparsity patterns in
> some cmds, 2020-05-27) adds an external symbol definition without a
> corresponding external symbol declaration. This causes sparse to
> complain: "symbol 'opt_restrict_to_sparse_paths' was not declared.
> Should it be static?".
>
> In order to suppress the warning, #include the 'sparse-checkout.h'
> header file, which contains the required extern declaration.
>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
> ---
>
> Hi Matheus,
>
> If you need to re-roll your 'mt/grep-sparse-checkout' branch, could you
> please squash this into the relevant patch.
Sure! Thanks for catching this.

← back to recent threads