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

[PATCH] setup.c: Fix some "symbol not declared" sparse warnings

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
May 17, 2011, 17:43 UTC
Message-ID
<4DD2B3AE.8060208@ramsay1.demon.co.uk>

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

    setup.c:159:3: 'pathspec_magic'
    setup.c:176:12: 'prefix_pathspec'

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

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
Hi Junio,

I noticed these sparse warnings on the next branch (as of a few days ago).

ATB, Ramsay Jones

 setup.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/setup.c b/setup.c
index 58dc16c..013ad11 100644
--- a/setup.c
+++ b/setup.c
@@ -152,7 +152,7 @@ void verify_non_filename(const char *prefix, const char *arg)
  */
 #define PATHSPEC_FROMTOP    (1<<0)
 
-struct pathspec_magic {
+static struct pathspec_magic {
 	unsigned bit;
 	char mnemonic; /* this cannot be ':'! */
 	const char *name;
@@ -173,7 +173,7 @@ struct pathspec_magic {
  * the prefix part must always match literally, and a single stupid
  * string cannot express such a case.
  */
-const char *prefix_pathspec(const char *prefix, int prefixlen, const char *elt)
+static const char *prefix_pathspec(const char *prefix, int prefixlen, const char *elt)
 {
 	unsigned magic = 0;
 	const char *copyfrom = elt;
-- 
1.7.5
Message 1 of 1 in “setup.c: Fix some "symbol not declared" sparse warnings”
  1. setup.c: Fix some "symbol not declared" sparse warningsRamsay Jones, May 17, 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.