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

[PATCH 1/3] sparse: Fix some "symbol not declared" warnings

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Sep 11, 2011, 19:38 UTC
Message-ID
<4E6D0E3F.3090304@ramsay1.demon.co.uk>

In particular, sparse issues the "symbol 'a_symbol' was not declared. Should it be static?" warning for the following symbols:

    submodule.c:321:5: 'submodule_needs_pushing'
    submodule.c:355:5: 'push_submodule'
    builtin/revert.c:662:20: 'commit_list_append'

These symbols only require file scope, so we simply add the static modifier to their declarations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 builtin/revert.c |    4 ++--
 submodule.c      |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 5e97622..5f1cee8 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -659,8 +659,8 @@ static void read_and_refresh_cache(struct replay_opts *opts)
  *     assert(commit_list_count(list) == 2);
  *     return list;
  */
-struct commit_list **commit_list_append(struct commit *commit,
-					struct commit_list **next)
+static struct commit_list **commit_list_append(struct commit *commit,
+						struct commit_list **next)
 {
 	struct commit_list *new = xmalloc(sizeof(struct commit_list));
 	new->item = commit;
diff --git a/submodule.c b/submodule.c
index 38d9877..5a02890 100644
--- a/submodule.c
+++ b/submodule.c
@@ -318,7 +318,7 @@ static int has_remote(const char *refname, const unsigned char *sha1, int flags,
 	return 1;
 }
 
-int submodule_needs_pushing(const char *path, const unsigned char sha1[20], void *data)
+static int submodule_needs_pushing(const char *path, const unsigned char sha1[20], void *data)
 {
 	int *needs_pushing = data;
 
@@ -352,7 +352,7 @@ int submodule_needs_pushing(const char *path, const unsigned char sha1[20], void
 	return 1;
 }
 
-int push_submodule(const char *path, const unsigned char sha1[20], void *data)
+static int push_submodule(const char *path, const unsigned char sha1[20], void *data)
 {
 	if (add_submodule_odb(path) || !lookup_commit_reference(sha1))
 		return 1;
-- 
1.7.6
Next: Junio C Hamano
Message 1 of 14 in “sparse: Fix some "symbol not declared" warnings”
  1. 1/3 sparse: Fix some "symbol not declared" warningsRamsay Jones, Sep 11, 2011
  2. Junio C HamanoSep 11, 2011
  3. Junio C HamanoSep 12, 2011
  4. 1/3 make-static: masterJunio C Hamano, Sep 11, 2011
  5. Ramkumar RamachandraSep 12, 2011
  6. Junio C HamanoSep 15, 2011
  7. Ramsay JonesSep 13, 2011
  8. Junio C HamanoSep 13, 2011
  9. Johannes SixtSep 14, 2011
  10. Junio C HamanoSep 14, 2011
  11. Junio C HamanoSep 14, 2011
  12. Thomas RastSep 14, 2011
  13. 2/3 make-static: nextJunio C Hamano, Sep 11, 2011
  14. 3/3 make-static: puJunio C Hamano, Sep 11, 2011

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.