Skip to contentSkip to conversation

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

PATCH New Ramsay Jones 1 participant 1 message Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 setup.c: Fix some "symbol not declared" sparse warnings

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.

---

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(-)
setup.c +2 -2
index 58dc16c..013ad11 100644
@@ -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;
Signature · 1 line
1.7.5