git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fix various sparse warnings in the git source code

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Jun 18, 2009, 21:48 UTC
Message-ID
<alpine.LFD.2.01.0906181445530.16802@localhost.localdomain>
In-Reply-To
<alpine.LFD.2.01.0906181021520.16802@localhost.localdomain>
On Thu, 18 Jun 2009, Linus Torvalds wrote:
Show 9 quoted lines
> 
>  - warning: symbol 'xyz' was not declared. Should it be static?
> 
>    Sparse wants to see declarations for any functions you export. A lack 
>    of a declaration tends to mean that you should either add one, or you 
>    should mark the function 'static' to show that it's in file scope. 
> 
>    A few of these remain: I only did the ones that should obviously just 
>    be made static.
I don't know why I missed a couple.

That 'wt_status_submodule_summary' one is debatable. It has a few related flags (like 'wt_status_use_color') which _are_ declared, and are used by builtin-commit.c. So maybe we'd like to export it at some point, but it's not declared now, and not used outside of that file, so 'static' it is in this patch.

		Linus
---
 http-push.c    |    2 +-
 unpack-trees.c |    2 +-
 wt-status.c    |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/http-push.c b/http-push.c
index e4ea395..8cc8ee0 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1750,7 +1750,7 @@ static int delete_remote_branch(char *pattern, int force)
 	return 0;
 }
 
-void run_request_queue(void)
+static void run_request_queue(void)
 {
 #ifdef USE_CURL_MULTI
 	is_running_queue = 1;
diff --git a/unpack-trees.c b/unpack-trees.c
index ac9927f..1958319 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -140,7 +140,7 @@ static int unpack_index_entry(struct cache_entry *ce, struct unpack_trees_option
 	return call_unpack_fn(src, o);
 }
 
-int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
+static int traverse_trees_recursive(int n, unsigned long dirmask, unsigned long df_conflicts, struct name_entry *names, struct traverse_info *info)
 {
 	int i;
 	struct tree_desc t[MAX_UNPACK_TREES];
diff --git a/wt-status.c b/wt-status.c
index 24a6abf..47735d8 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -13,7 +13,7 @@
 
 int wt_status_relative_paths = 1;
 int wt_status_use_color = -1;
-int wt_status_submodule_summary;
+static int wt_status_submodule_summary;
 static char wt_status_colors[][COLOR_MAXLEN] = {
 	GIT_COLOR_NORMAL, /* WT_STATUS_HEADER */
 	GIT_COLOR_GREEN,  /* WT_STATUS_UPDATED */
Previous: Linus TorvaldsNext: Linus Torvalds
Message 22 of 23 in “Cast things properly to handle >2G files.”
  1. Cast things properly to handle >2G files.Alfred M. Szmidt, Jun 14, 2009
  2. Johannes SchindelinJun 14, 2009
  3. Nicolas PitreJun 15, 2009
  4. Alfred M. SzmidtJun 15, 2009
  5. Junio C HamanoJun 15, 2009
  6. Johannes SchindelinJun 15, 2009
  7. Linus TorvaldsJun 15, 2009
  8. Alfred M. SzmidtJun 17, 2009
  9. Linus TorvaldsJun 17, 2009
  10. Alfred M. SzmidtJun 17, 2009
  11. Linus TorvaldsJun 17, 2009
  12. Junio C HamanoJun 17, 2009
  13. Fix big left-shifts of unsigned charLinus Torvalds, Jun 18, 2009
  14. Johannes SchindelinJun 18, 2009
  15. Junio C HamanoJun 18, 2009
  16. Linus TorvaldsJun 18, 2009
  17. Johannes SchindelinJun 18, 2009
  18. Linus TorvaldsJun 18, 2009
  19. Fix various sparse warnings in the git source codeLinus Torvalds, Jun 18, 2009
  20. Matthieu MoyJun 18, 2009
  21. Linus TorvaldsJun 18, 2009
  22. Linus TorvaldsJun 18, 2009
  23. Linus TorvaldsJun 17, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.