Skip to contentSkip to conversation

test-wildmatch.c: Fix some sparse warnings

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

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test-wildmatch.c: Fix some sparse warnings

In particular, sparse complains as follows:

SP test-wildmatch.c
test-wildmatch.c:40:5: warning: symbol 'wildmatch_errors' was not \
declared. Should it be static?
test-wildmatch.c:41:6: warning: symbol 'number_separator' was not \
declared. Should it be static?
test-wildmatch.c:45:5: warning: symbol 'explode_mod' was not \
declared. Should it be static?
test-wildmatch.c:46:5: warning: symbol 'empties_mod' was not \
declared. Should it be static?
test-wildmatch.c:47:5: warning: symbol 'empty_at_start' was not \
declared. Should it be static?
test-wildmatch.c:48:5: warning: symbol 'empty_at_end' was not \
declared. Should it be static?
test-wildmatch.c:49:6: warning: symbol 'empties' was not \
declared. Should it be static?

In order to suppress the warnings, we simply add the static modifier to the declaration of (most of) the above symbols. Note that the 'number_separator' symbol was not actually used, so we removed the declaration instead. Also, we add the static modifier to the 'fnmatch_errors' variable (not noted above because it was #ifdef-ed out).

---

Hi Nguyen,

If you need to re-roll your 'nd/wildmatch' branch, could you please squash this patch into the relevent commit(s). Also, I note that two commits have "compat/wildmatch" in the subject, but the files are at the top level.

Thanks!

ATB,
Ramsay Jones

 test-wildmatch.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)
test-wildmatch.c +7 -8
index b94921b..bb726c8 100644
@@ -34,19 +34,18 @@
 #ifdef COMPARE_WITH_FNMATCH
 #include <fnmatch.h>
 
-int fnmatch_errors = 0;
+static int fnmatch_errors = 0;
 #endif
 
-int wildmatch_errors = 0;
-char number_separator = ',';
+static int wildmatch_errors = 0;
 
 typedef char bool;
 
-int explode_mod = 0;
-int empties_mod = 0;
-int empty_at_start = 0;
-int empty_at_end = 0;
-char *empties;
+static int explode_mod = 0;
+static int empties_mod = 0;
+static int empty_at_start = 0;
+static int empty_at_end = 0;
+static char *empties;
 
 static struct option options[] = {
   OPT_STRING('e', "empties", &empties, "", ""),
Signature · 1 line
1.7.12