In particular, sparse complains as follows:

        SP grep.c
    grep.c:1472:5: warning: symbol 'grep_source_load' was not \
        declared. Should it be static?
    grep.c:1500:5: warning: symbol 'grep_source_is_binary' was not \
        declared. Should it be static?

These warnings actually illustrate a known bug in sparse. The forward
declarations of these functions (on lines 6-7) include the static
modifier. These forward declarations convey the file scope property to
the later function definitions. Note that the function definition does
not have to include the static modifier for this to take effect.

In order to suppress the warnings, we simply include the (redundant)
static modifier in the function definitions. Note that repeating the
modifier, while not needed by the definition of C, does make it clear
to the human reader, at the point of definition, that the symbol has
file scope.

Signed-off-by: Ramsay Jones <>
 grep.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/grep.c b/grep.c
index c7f8a47..898be6e 100644
--- a/grep.c
+++ b/grep.c
@@ -1469,7 +1469,7 @@ static int grep_source_load_file(struct grep_source *gs)
        return 0;
-int grep_source_load(struct grep_source *gs)
+static int grep_source_load(struct grep_source *gs)
        if (gs->buf)
                return 0;
@@ -1497,7 +1497,7 @@ void grep_source_load_driver(struct grep_source *gs)
-int grep_source_is_binary(struct grep_source *gs)
+static int grep_source_is_binary(struct grep_source *gs)
        if (gs->driver->binary != -1)

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to