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

[PATCH] test-wildmatch.c: Fix some sparse warnings

From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Date
Sep 19, 2012, 18:13 UTC
Message-ID
<505A0B55.8060609@ramsay1.demon.co.uk>
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).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
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(-)
diff --git a/test-wildmatch.c b/test-wildmatch.c
index b94921b..bb726c8 100644
--- a/test-wildmatch.c
+++ b/test-wildmatch.c
@@ -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, "", ""),
-- 
1.7.12
Message 1 of 1 in “test-wildmatch.c: Fix some sparse warnings”
  1. test-wildmatch.c: Fix some sparse warningsRamsay Jones, Sep 19, 2012

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.