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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxx>
---

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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]