Skip to contentSkip to conversation

builtin/tag.c: Fix a sparse warning

PATCH In review Ramsay Jones 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 builtin/tag.c: Fix a sparse warning

In particular, sparse complains as follows:

SP builtin/tag.c
builtin/tag.c:411:5: warning: symbol 'parse_opt_points_at' was \
not declared. Should it be static?

In order to suppress the warning, since the parse_opt_points_at() function does not need to be an external symbol, we simply add the static modifier to the function definition.

---

 builtin/tag.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin/tag.c +1 -1
index 8cfaaf8..fe7e5e5 100644
@@ -408,7 +408,7 @@ static int strbuf_check_tag_ref(struct strbuf *sb, const char *name)
 	return check_refname_format(sb->buf, 0);
 }
 
-int parse_opt_points_at(const struct option *opt __attribute__ ((unused)),
+static int parse_opt_points_at(const struct option *opt __attribute__((unused)),
 			const char *arg, int unset)
 {
 	unsigned char sha1[20];
Signature · 1 line
1.7.9
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Ramsay Jones

In particular, sparse complains as follows:

SP builtin/tag.c
builtin/tag.c:411:5: warning: symbol 'parse_opt_points_at' was \
not declared. Should it be static?

Quoted 5 lines

In order to suppress the warning, since the parse_opt_points_at() function does not need to be an external symbol, we simply add the static modifier to the function definition.

Thanks

Quoted 22 lines

---

builtin/tag.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
builtin/tag.c +1 -1
index 8cfaaf8..fe7e5e5 100644
@@ -408,7 +408,7 @@ static int strbuf_check_tag_ref(struct strbuf *sb, const char *name)
 	return check_refname_format(sb->buf, 0);
 }
 
-int parse_opt_points_at(const struct option *opt __attribute__ ((unused)),
+static int parse_opt_points_at(const struct option *opt __attribute__((unused)),
 			const char *arg, int unset)
 {
 	unsigned char sha1[20];
Signature · 1 line
1.7.9