{"thread":{"id":"31543","subject":"[PATCH] test-string-list.c: Fix some sparse warnings","startedAt":"2012-09-15T16:18:42Z","lastAt":"2012-09-20T20:43:16Z","messageCount":15,"participants":["Ramsay Jones","Junio C Hamano","Michael Haggerty"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"199110","messageId":"5054AA62.2040603@ramsay1.demon.co.uk","threadId":"31543","inReplyTo":null,"subject":"[PATCH] test-string-list.c: Fix some sparse warnings","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-09-15T16:18:42Z","receivedAt":"2012-09-15T16:18:42Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nIn particular, sparse complains as follows:\n\n        SP test-string-list.c\n    test-string-list.c:10:6: warning: symbol 'parse_string_list' was not \\\n        declared. Should it be static?\n    test-string-list.c:18:6: warning: symbol 'write_list' was not \\\n        declared. Should it be static?\n    test-string-list.c:25:6: warning: symbol 'write_list_compact' was not \\\n        declared. Should it be static?\n    test-string-list.c:38:5: warning: symbol 'prefix_cb' was not \\\n        declared. Should it be static?\n\nIn order to suppress the warnings, since the above symbols do not\nneed more than file scope, we simply include the static modifier\nin their declaration.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n\nHi Michael,\n\nIf you need to re-roll your 'mh/string-list' branch, could you\nplease squash the relevent parts of this patch into those commits.\n\nThanks!\n\nATB,\nRamsay Jones\n\n test-string-list.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/test-string-list.c b/test-string-list.c\nindex 5e9631f..4693295 100644\n--- a/test-string-list.c\n+++ b/test-string-list.c\n@@ -7,7 +7,7 @@\n  * list (as opposed to \"\", which indicates a string list containing a\n  * single empty string).  list->strdup_strings must be set.\n  */\n-void parse_string_list(struct string_list *list, const char *arg)\n+static void parse_string_list(struct string_list *list, const char *arg)\n {\n \tif (!strcmp(arg, \"-\"))\n \t\treturn;\n@@ -15,14 +15,14 @@ void parse_string_list(struct string_list *list, const char *arg)\n \t(void)string_list_split(list, arg, ':', -1);\n }\n \n-void write_list(const struct string_list *list)\n+static void write_list(const struct string_list *list)\n {\n \tint i;\n \tfor (i = 0; i < list->nr; i++)\n \t\tprintf(\"[%d]: \\\"%s\\\"\\n\", i, list->items[i].string);\n }\n \n-void write_list_compact(const struct string_list *list)\n+static void write_list_compact(const struct string_list *list)\n {\n \tint i;\n \tif (!list->nr)\n@@ -35,7 +35,7 @@ void write_list_compact(const struct string_list *list)\n \t}\n }\n \n-int prefix_cb(struct string_list_item *item, void *cb_data)\n+static int prefix_cb(struct string_list_item *item, void *cb_data)\n {\n \tconst char *prefix = (const char *)cb_data;\n \treturn !prefixcmp(item->string, prefix);\n-- \n1.7.12\n"},{"id":"199111","messageId":"7vr4q3ypom.fsf@alter.siamese.dyndns.org","threadId":"31543","inReplyTo":"5054AA62.2040603@ramsay1.demon.co.uk","subject":"Re: [PATCH] test-string-list.c: Fix some sparse warnings","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T20:52:09Z","receivedAt":"2012-09-15T20:52:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Queued.  Thanks.\n"},{"id":"199116","messageId":"1347743452-2487-1-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"5054AA62.2040603@ramsay1.demon.co.uk","subject":"[PATCH 1/7] builtin/notes.c: mark file-scope functions as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:46Z","receivedAt":"2012-09-15T21:10:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n builtin.h       | 2 --\n builtin/notes.c | 7 +++++--\n 2 files changed, 5 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin.h b/builtin.h\nindex 8e37752..95116b8 100644\n--- a/builtin.h\n+++ b/builtin.h\n@@ -21,7 +21,6 @@ struct fmt_merge_msg_opts {\n \n extern int fmt_merge_msg(struct strbuf *in, struct strbuf *out,\n \t\t\t struct fmt_merge_msg_opts *);\n-extern void commit_notes(struct notes_tree *t, const char *msg);\n \n struct notes_rewrite_cfg {\n \tstruct notes_tree **trees;\n@@ -33,7 +32,6 @@ struct notes_rewrite_cfg {\n \tint mode_from_env;\n };\n \n-combine_notes_fn parse_combine_notes_fn(const char *v);\n struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd);\n int copy_note_for_rewrite(struct notes_rewrite_cfg *c,\n \t\t\t  const unsigned char *from_obj, const unsigned char *to_obj);\ndiff --git a/builtin/notes.c b/builtin/notes.c\nindex 554c801..453457a 100644\n--- a/builtin/notes.c\n+++ b/builtin/notes.c\n@@ -19,6 +19,9 @@\n #include \"string-list.h\"\n #include \"notes-merge.h\"\n \n+static void commit_notes(struct notes_tree *t, const char *msg);\n+static combine_notes_fn parse_combine_notes_fn(const char *v);\n+\n static const char * const git_notes_usage[] = {\n \tN_(\"git notes [--ref <notes_ref>] [list [<object>]]\"),\n \tN_(\"git notes [--ref <notes_ref>] add [-f] [-m <msg> | -F <file> | (-c | -C) <object>] [<object>]\"),\n@@ -288,7 +291,7 @@ static int parse_reedit_arg(const struct option *opt, const char *arg, int unset\n \treturn parse_reuse_arg(opt, arg, unset);\n }\n \n-void commit_notes(struct notes_tree *t, const char *msg)\n+static void commit_notes(struct notes_tree *t, const char *msg)\n {\n \tstruct strbuf buf = STRBUF_INIT;\n \tunsigned char commit_sha1[20];\n@@ -312,7 +315,7 @@ void commit_notes(struct notes_tree *t, const char *msg)\n \tstrbuf_release(&buf);\n }\n \n-combine_notes_fn parse_combine_notes_fn(const char *v)\n+static combine_notes_fn parse_combine_notes_fn(const char *v)\n {\n \tif (!strcasecmp(v, \"overwrite\"))\n \t\treturn combine_notes_overwrite;\n-- \n1.7.12.508.g4d78187\n"},{"id":"199117","messageId":"1347743452-2487-2-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"1347743452-2487-1-git-send-email-gitster@pobox.com","subject":"[PATCH 2/7] commit.c: mark file-scope functions as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:47Z","receivedAt":"2012-09-15T21:10:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n commit.c | 7 +++++--\n commit.h | 1 -\n 2 files changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex 0ea441d..0246767 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -9,6 +9,8 @@\n #include \"gpg-interface.h\"\n #include \"mergesort.h\"\n \n+static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);\n+\n int save_commit_buffer = 1;\n \n const char *commit_type = \"commit\";\n@@ -1073,8 +1075,9 @@ static int excluded_header_field(const char *field, size_t len, const char **exc\n \treturn 0;\n }\n \n-struct commit_extra_header *read_commit_extra_header_lines(const char *buffer, size_t size,\n-\t\t\t\t\t\t\t   const char **exclude)\n+static struct commit_extra_header *read_commit_extra_header_lines(\n+\tconst char *buffer, size_t size,\n+\tconst char **exclude)\n {\n \tstruct commit_extra_header *extra = NULL, **tail = &extra, *it = NULL;\n \tconst char *line, *next, *eof, *eob;\ndiff --git a/commit.h b/commit.h\nindex 6edce87..9f21313 100644\n--- a/commit.h\n+++ b/commit.h\n@@ -204,7 +204,6 @@ extern int commit_tree_extended(const struct strbuf *msg, unsigned char *tree,\n \t\t\t\tstruct commit_extra_header *);\n \n extern struct commit_extra_header *read_commit_extra_headers(struct commit *, const char **);\n-extern struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);\n \n extern void free_commit_extra_headers(struct commit_extra_header *extra);\n \n-- \n1.7.12.508.g4d78187\n"},{"id":"199122","messageId":"1347743452-2487-3-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"1347743452-2487-1-git-send-email-gitster@pobox.com","subject":"[PATCH 3/7] diff.c: mark private file-scope symbols as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:48Z","receivedAt":"2012-09-15T21:10:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"---\n diff.c | 2 +-\n diff.h | 1 -\n 2 files changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 32142db..35d3f07 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -25,7 +25,7 @@\n static int diff_detect_rename_default;\n static int diff_rename_limit_default = 400;\n static int diff_suppress_blank_empty;\n-int diff_use_color_default = -1;\n+static int diff_use_color_default = -1;\n static const char *diff_word_regex_cfg;\n static const char *external_diff_cmd_cfg;\n int diff_auto_refresh_index = 1;\ndiff --git a/diff.h b/diff.h\nindex e25addb..a658f85 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -243,7 +243,6 @@ extern int parse_long_opt(const char *opt, const char **argv,\n \n extern int git_diff_basic_config(const char *var, const char *value, void *cb);\n extern int git_diff_ui_config(const char *var, const char *value, void *cb);\n-extern int diff_use_color_default;\n extern void diff_setup(struct diff_options *);\n extern int diff_opt_parse(struct diff_options *, const char **, int);\n extern void diff_setup_done(struct diff_options *);\n-- \n1.7.12.508.g4d78187\n"},{"id":"199119","messageId":"1347743452-2487-4-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"1347743452-2487-1-git-send-email-gitster@pobox.com","subject":"[PATCH 4/7] graph.c: mark private file-scope symbols as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:49Z","receivedAt":"2012-09-15T21:10:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n graph.c | 32 ++++++++++++++++++++++++++++++--\n graph.h | 27 ---------------------------\n 2 files changed, 30 insertions(+), 29 deletions(-)\n\ndiff --git a/graph.c b/graph.c\nindex 7e0a099..e864fe2 100644\n--- a/graph.c\n+++ b/graph.c\n@@ -8,6 +8,34 @@\n /* Internal API */\n \n /*\n+ * Output the next line for a graph.\n+ * This formats the next graph line into the specified strbuf.  It is not\n+ * terminated with a newline.\n+ *\n+ * Returns 1 if the line includes the current commit, and 0 otherwise.\n+ * graph_next_line() will return 1 exactly once for each time\n+ * graph_update() is called.\n+ */\n+static int graph_next_line(struct git_graph *graph, struct strbuf *sb);\n+\n+/*\n+ * Set up a custom scheme for column colors.\n+ *\n+ * The default column color scheme inserts ANSI color escapes to colorize\n+ * the graph. The various color escapes are stored in an array of strings\n+ * where each entry corresponds to a color, except for the last entry,\n+ * which denotes the escape for resetting the color back to the default.\n+ * When generating the graph, strings from this array are inserted before\n+ * and after the various column characters.\n+ *\n+ * This function allows you to enable a custom array of color escapes.\n+ * The 'colors_max' argument is the index of the last \"reset\" entry.\n+ *\n+ * This functions must be called BEFORE graph_init() is called.\n+ */\n+static void graph_set_column_colors(const char **colors, unsigned short colors_max);\n+\n+/*\n  * Output a padding line in the graph.\n  * This is similar to graph_next_line().  However, it is guaranteed to\n  * never print the current commit line.  Instead, if the commit line is\n@@ -62,7 +90,7 @@ enum graph_state {\n static const char **column_colors;\n static unsigned short column_colors_max;\n \n-void graph_set_column_colors(const char **colors, unsigned short colors_max)\n+static void graph_set_column_colors(const char **colors, unsigned short colors_max)\n {\n \tcolumn_colors = colors;\n \tcolumn_colors_max = colors_max;\n@@ -1116,7 +1144,7 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf\n \t\tgraph_update_state(graph, GRAPH_PADDING);\n }\n \n-int graph_next_line(struct git_graph *graph, struct strbuf *sb)\n+static int graph_next_line(struct git_graph *graph, struct strbuf *sb)\n {\n \tswitch (graph->state) {\n \tcase GRAPH_PADDING:\ndiff --git a/graph.h b/graph.h\nindex aff960c..19b0f66 100644\n--- a/graph.h\n+++ b/graph.h\n@@ -4,22 +4,6 @@\n /* A graph is a pointer to this opaque structure */\n struct git_graph;\n \n-/*\n- * Set up a custom scheme for column colors.\n- *\n- * The default column color scheme inserts ANSI color escapes to colorize\n- * the graph. The various color escapes are stored in an array of strings\n- * where each entry corresponds to a color, except for the last entry,\n- * which denotes the escape for resetting the color back to the default.\n- * When generating the graph, strings from this array are inserted before\n- * and after the various column characters.\n- *\n- * This function allows you to enable a custom array of color escapes.\n- * The 'colors_max' argument is the index of the last \"reset\" entry.\n- *\n- * This functions must be called BEFORE graph_init() is called.\n- */\n-void graph_set_column_colors(const char **colors, unsigned short colors_max);\n \n /*\n  * Create a new struct git_graph.\n@@ -49,17 +33,6 @@ void graph_update(struct git_graph *graph, struct commit *commit);\n  */\n int graph_is_commit_finished(struct git_graph const *graph);\n \n-/*\n- * Output the next line for a graph.\n- * This formats the next graph line into the specified strbuf.  It is not\n- * terminated with a newline.\n- *\n- * Returns 1 if the line includes the current commit, and 0 otherwise.\n- * graph_next_line() will return 1 exactly once for each time\n- * graph_update() is called.\n- */\n-int graph_next_line(struct git_graph *graph, struct strbuf *sb);\n-\n \n /*\n  * graph_show_*: helper functions for printing to stdout\n-- \n1.7.12.508.g4d78187\n"},{"id":"199120","messageId":"1347743452-2487-5-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"1347743452-2487-1-git-send-email-gitster@pobox.com","subject":"[PATCH 5/7] grep.c: mark private file-scope symbols as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:50Z","receivedAt":"2012-09-15T21:10:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n grep.c | 6 +++++-\n grep.h | 3 +--\n 2 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/grep.c b/grep.c\nindex 925aa92..c7f8a47 100644\n--- a/grep.c\n+++ b/grep.c\n@@ -3,6 +3,10 @@\n #include \"userdiff.h\"\n #include \"xdiff-interface.h\"\n \n+static int grep_source_load(struct grep_source *gs);\n+static int grep_source_is_binary(struct grep_source *gs);\n+\n+\n static struct grep_pat *create_grep_pat(const char *pat, size_t patlen,\n \t\t\t\t\tconst char *origin, int no,\n \t\t\t\t\tenum grep_pat_token t,\n@@ -403,7 +407,7 @@ static void dump_grep_expression_1(struct grep_expr *x, int in)\n \t}\n }\n \n-void dump_grep_expression(struct grep_opt *opt)\n+static void dump_grep_expression(struct grep_opt *opt)\n {\n \tstruct grep_expr *x = opt->pattern_expression;\n \ndiff --git a/grep.h b/grep.h\nindex 00d71f7..8a28a67 100644\n--- a/grep.h\n+++ b/grep.h\n@@ -159,11 +159,10 @@ struct grep_source {\n \n void grep_source_init(struct grep_source *gs, enum grep_source_type type,\n \t\t      const char *name, const void *identifier);\n-int grep_source_load(struct grep_source *gs);\n void grep_source_clear_data(struct grep_source *gs);\n void grep_source_clear(struct grep_source *gs);\n void grep_source_load_driver(struct grep_source *gs);\n-int grep_source_is_binary(struct grep_source *gs);\n+\n \n int grep_source(struct grep_opt *opt, struct grep_source *gs);\n \n-- \n1.7.12.508.g4d78187\n"},{"id":"199121","messageId":"1347743452-2487-6-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"1347743452-2487-1-git-send-email-gitster@pobox.com","subject":"[PATCH 6/7] rerere.c: mark private file-scope symbols as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:51Z","receivedAt":"2012-09-15T21:10:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n rerere.c | 2 +-\n rerere.h | 1 -\n 2 files changed, 1 insertion(+), 2 deletions(-)\n\ndiff --git a/rerere.c b/rerere.c\nindex b57a34d..a6a5cd5 100644\n--- a/rerere.c\n+++ b/rerere.c\n@@ -25,7 +25,7 @@ const char *rerere_path(const char *hex, const char *file)\n \treturn git_path(\"rr-cache/%s/%s\", hex, file);\n }\n \n-int has_rerere_resolution(const char *hex)\n+static int has_rerere_resolution(const char *hex)\n {\n \tstruct stat st;\n \treturn !stat(rerere_path(hex, \"postimage\"), &st);\ndiff --git a/rerere.h b/rerere.h\nindex fcd8bc1..156d2aa 100644\n--- a/rerere.h\n+++ b/rerere.h\n@@ -16,7 +16,6 @@ extern void *RERERE_RESOLVED;\n extern int setup_rerere(struct string_list *, int);\n extern int rerere(int);\n extern const char *rerere_path(const char *hex, const char *file);\n-extern int has_rerere_resolution(const char *hex);\n extern int rerere_forget(const char **);\n extern int rerere_remaining(struct string_list *);\n extern void rerere_clear(struct string_list *);\n-- \n1.7.12.508.g4d78187\n"},{"id":"199118","messageId":"1347743452-2487-7-git-send-email-gitster@pobox.com","threadId":"31543","inReplyTo":"1347743452-2487-1-git-send-email-gitster@pobox.com","subject":"[PATCH 7/7] notes.c: mark private file-scope symbols as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-15T21:10:52Z","receivedAt":"2012-09-15T21:10:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Signed-off-by: Junio C Hamano <gitster@pobox.com>\n---\n notes.c | 14 ++++++++++++--\n notes.h | 14 --------------\n 2 files changed, 12 insertions(+), 16 deletions(-)\n\ndiff --git a/notes.c b/notes.c\nindex 93e9868..bc454e1 100644\n--- a/notes.c\n+++ b/notes.c\n@@ -1196,8 +1196,18 @@ void free_notes(struct notes_tree *t)\n \tmemset(t, 0, sizeof(struct notes_tree));\n }\n \n-void format_note(struct notes_tree *t, const unsigned char *object_sha1,\n-\t\tstruct strbuf *sb, const char *output_encoding, int flags)\n+/*\n+ * Fill the given strbuf with the notes associated with the given object.\n+ *\n+ * If the given notes_tree structure is not initialized, it will be auto-\n+ * initialized to the default value (see documentation for init_notes() above).\n+ * If the given notes_tree is NULL, the internal/default notes_tree will be\n+ * used instead.\n+ *\n+ * 'flags' is a bitwise combination of the flags for format_display_notes.\n+ */\n+static void format_note(struct notes_tree *t, const unsigned char *object_sha1,\n+\t\t\tstruct strbuf *sb, const char *output_encoding, int flags)\n {\n \tstatic const char utf8[] = \"utf-8\";\n \tconst unsigned char *sha1;\ndiff --git a/notes.h b/notes.h\nindex c716694..3592b19 100644\n--- a/notes.h\n+++ b/notes.h\n@@ -241,20 +241,6 @@ void free_notes(struct notes_tree *t);\n #define NOTES_SHOW_HEADER 1\n #define NOTES_INDENT 2\n \n-/*\n- * Fill the given strbuf with the notes associated with the given object.\n- *\n- * If the given notes_tree structure is not initialized, it will be auto-\n- * initialized to the default value (see documentation for init_notes() above).\n- * If the given notes_tree is NULL, the internal/default notes_tree will be\n- * used instead.\n- *\n- * 'flags' is a bitwise combination of the above formatting flags.\n- */\n-void format_note(struct notes_tree *t, const unsigned char *object_sha1,\n-\t\tstruct strbuf *sb, const char *output_encoding, int flags);\n-\n-\n struct string_list;\n \n struct display_notes_opt {\n-- \n1.7.12.508.g4d78187\n"},{"id":"199204","messageId":"5056DC28.60809@alum.mit.edu","threadId":"31543","inReplyTo":"5054AA62.2040603@ramsay1.demon.co.uk","subject":"Re: [PATCH] test-string-list.c: Fix some sparse warnings","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-09-17T08:15:36Z","receivedAt":"2012-09-17T08:15:36Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 09/15/2012 06:18 PM, Ramsay Jones wrote:\n> \n> In particular, sparse complains as follows:\n> \n>         SP test-string-list.c\n>     test-string-list.c:10:6: warning: symbol 'parse_string_list' was not \\\n>         declared. Should it be static?\n>     test-string-list.c:18:6: warning: symbol 'write_list' was not \\\n>         declared. Should it be static?\n>     test-string-list.c:25:6: warning: symbol 'write_list_compact' was not \\\n>         declared. Should it be static?\n>     test-string-list.c:38:5: warning: symbol 'prefix_cb' was not \\\n>         declared. Should it be static?\n> \n> In order to suppress the warnings, since the above symbols do not\n> need more than file scope, we simply include the static modifier\n> in their declaration.\n\nThanks for fixing this.\n\nIs there some documentation about how to run sparse on the git codebase?\n I naively tried \"make sparse\" and ended up with zillions of errors like\n\n/usr/include/unistd.h:288:54: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:294:6: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:298:6: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:306:6: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:338:18: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:347:6: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:418:36: error: attribute '__leaf__': unknown attribute\n/usr/include/unistd.h:423:50: error: attribute '__leaf__': unknown attribute\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"199514","messageId":"505A08A1.1080303@ramsay1.demon.co.uk","threadId":"31543","inReplyTo":"1347743452-2487-5-git-send-email-gitster@pobox.com","subject":"Re: [PATCH 5/7] grep.c: mark private file-scope symbols as static","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-09-19T18:02:09Z","receivedAt":"2012-09-19T18:02:09Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Junio C Hamano wrote:\n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  grep.c | 6 +++++-\n>  grep.h | 3 +--\n>  2 files changed, 6 insertions(+), 3 deletions(-)\n> \n> diff --git a/grep.c b/grep.c\n> index 925aa92..c7f8a47 100644\n> --- a/grep.c\n> +++ b/grep.c\n> @@ -3,6 +3,10 @@\n>  #include \"userdiff.h\"\n>  #include \"xdiff-interface.h\"\n>  \n> +static int grep_source_load(struct grep_source *gs);\n> +static int grep_source_is_binary(struct grep_source *gs);\n> +\n> +\n>  static struct grep_pat *create_grep_pat(const char *pat, size_t patlen,\n>  \t\t\t\t\tconst char *origin, int no,\n>  \t\t\t\t\tenum grep_pat_token t,\n> @@ -403,7 +407,7 @@ static void dump_grep_expression_1(struct grep_expr *x, int in)\n>  \t}\n>  }\n>  \n> -void dump_grep_expression(struct grep_opt *opt)\n> +static void dump_grep_expression(struct grep_opt *opt)\n>  {\n>  \tstruct grep_expr *x = opt->pattern_expression;\n>  \n> diff --git a/grep.h b/grep.h\n> index 00d71f7..8a28a67 100644\n> --- a/grep.h\n> +++ b/grep.h\n> @@ -159,11 +159,10 @@ struct grep_source {\n>  \n>  void grep_source_init(struct grep_source *gs, enum grep_source_type type,\n>  \t\t      const char *name, const void *identifier);\n> -int grep_source_load(struct grep_source *gs);\n>  void grep_source_clear_data(struct grep_source *gs);\n>  void grep_source_clear(struct grep_source *gs);\n>  void grep_source_load_driver(struct grep_source *gs);\n> -int grep_source_is_binary(struct grep_source *gs);\n> +\n>  \n>  int grep_source(struct grep_opt *opt, struct grep_source *gs);\n\nHeh, so I obviously didn't see this before sending the patch yesterday! :-D\n\nYes, this solves the problem addressed by yesterday's patch, so please\nignore that. However, this tickles sparse to complain as well ... ;-)\n\nNew patch on it's way.\n\n[I have a funny feeling that I'm about to download an email, in response\nto yesterday's patch, that says something like: \"does commit 07a7d656 not\nfix it for you ...\" :-P ]\n\nATB,\nRamsay Jones\n"},{"id":"199517","messageId":"505A17D5.2000406@ramsay1.demon.co.uk","threadId":"31543","inReplyTo":"5056DC28.60809@alum.mit.edu","subject":"Re: [PATCH] test-string-list.c: Fix some sparse warnings","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-09-19T19:07:01Z","receivedAt":"2012-09-19T19:07:01Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Michael Haggerty wrote:\n> On 09/15/2012 06:18 PM, Ramsay Jones wrote:\n>>\n>> In particular, sparse complains as follows:\n>>\n>>         SP test-string-list.c\n>>     test-string-list.c:10:6: warning: symbol 'parse_string_list' was not \\\n>>         declared. Should it be static?\n>>     test-string-list.c:18:6: warning: symbol 'write_list' was not \\\n>>         declared. Should it be static?\n>>     test-string-list.c:25:6: warning: symbol 'write_list_compact' was not \\\n>>         declared. Should it be static?\n>>     test-string-list.c:38:5: warning: symbol 'prefix_cb' was not \\\n>>         declared. Should it be static?\n>>\n>> In order to suppress the warnings, since the above symbols do not\n>> need more than file scope, we simply include the static modifier\n>> in their declaration.\n> \n> Thanks for fixing this.\n> \n> Is there some documentation about how to run sparse on the git codebase?\n>  I naively tried \"make sparse\" and ended up with zillions of errors like\n> \n> /usr/include/unistd.h:288:54: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:294:6: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:298:6: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:306:6: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:338:18: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:347:6: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:418:36: error: attribute '__leaf__': unknown attribute\n> /usr/include/unistd.h:423:50: error: attribute '__leaf__': unknown attribute\n\nYep, \"make sparse\" is the correct way to run sparse over git.\n\nThis looks like you are running sparse on a 64-bit system. I have heard that\nit has (or *had*) problems running on 64-bit systems. Unfortunately, I am\ncurrently confined to 32-bit. (I'm looking at getting a new laptop soon, before\nWindows 8 causes boot-time problems, so I will then have the same problem!)\n\nHow did you obtain/build/install sparse? The current release (v0.4.4) was\nreleased about Nov 2011 and I think you need a more up to date version.\ni.e. you need to build the latest, directly from the sparse repo.\n\nNote that the repo on kernel.org is currently dormant. Christopher moved the\nactive development to github: http://github.com/sparsecli/sparse\n\nIn particular, I *think* that the following commits (among others) may improve\nyour experience of running sparse on git:\n\n    b0b4886 sparse: Add 'leaf' to ignored attributes.\n    7aa79f8 Adding default for m64/m32 handle\n    2313167 sparse: Add '__vector_size__' to ignored attributes\n    0a04210 sparse: Add 'error' to ignored attributes\n\n(These are all post v0.4.4)\n\nNote that I \"make sparse\" on Linux, cygwin and MinGW. (All 32-bit, of course)\nOnly cygwin is \"sparse clean\". :-D\n\nLinux has a handfull of warnings, mainly due to the system header files\nusing features not supported by sparse; e.g. transparent unions. (It's on\nmy TODO list!). I have a few patches which I keep forgetting to push back\nupstream ...\n\nI \"ported\" sparse to MinGW about three years ago. I have yet to \"tidy up\"\nthe patches and push them upstream. (*ahem*) I have a shed-load of patches\nto fix sparse warnings on git. However, since (as far as I know) nobody can\nconfirm they actually fix anything ... ;-)\n\nHTH\n\nATB,\nRamsay Jones\n"},{"id":"199535","messageId":"7vfw6dg2q6.fsf@alter.siamese.dyndns.org","threadId":"31543","inReplyTo":"505A08A1.1080303@ramsay1.demon.co.uk","subject":"Re: [PATCH 5/7] grep.c: mark private file-scope symbols as static","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-09-19T20:46:41Z","receivedAt":"2012-09-19T20:46:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n\n> Heh, so I obviously didn't see this before sending the patch yesterday! :-D\n>\n> Yes, this solves the problem addressed by yesterday's patch, so please\n> ignore that. However, this tickles sparse to complain as well ... ;-)\n>\n> New patch on it's way.\n\nAre you sure the patch you are responding to really \"tickles\nsparse\"?\n\nYou have another grep.c patch timestamped two minutes after the\nmessage I am responding to, and as far as I can see, it is a subset\nof the patch you are responding to with the message I am responding\nto.\n"},{"id":"199575","messageId":"505AC221.8070103@alum.mit.edu","threadId":"31543","inReplyTo":"505A17D5.2000406@ramsay1.demon.co.uk","subject":"Re: [PATCH] test-string-list.c: Fix some sparse warnings","fromName":"Michael Haggerty","fromEmail":"mhagger@alum.mit.edu","sentAt":"2012-09-20T07:13:37Z","receivedAt":"2012-09-20T07:13:37Z","isPatch":true,"sender":{"key":"mhagger@alum.mit.edu","avatar":"https://avatars.githubusercontent.com/u/119718?v=4"},"body":"On 09/19/2012 09:07 PM, Ramsay Jones wrote:\n> Michael Haggerty wrote:\n>> Is there some documentation about how to run sparse on the git codebase?\n>>  I naively tried \"make sparse\" and ended up with zillions of errors like\n>>\n>> /usr/include/unistd.h:288:54: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:294:6: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:298:6: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:306:6: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:338:18: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:347:6: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:418:36: error: attribute '__leaf__': unknown attribute\n>> /usr/include/unistd.h:423:50: error: attribute '__leaf__': unknown attribute\n> \n> Yep, \"make sparse\" is the correct way to run sparse over git.\n> \n> This looks like you are running sparse on a 64-bit system. I have heard that\n> it has (or *had*) problems running on 64-bit systems. Unfortunately, I am\n> currently confined to 32-bit. (I'm looking at getting a new laptop soon, before\n> Windows 8 causes boot-time problems, so I will then have the same problem!)\n> \n> How did you obtain/build/install sparse? The current release (v0.4.4) was\n> released about Nov 2011 and I think you need a more up to date version.\n> i.e. you need to build the latest, directly from the sparse repo.\n\nYes, I'm running 64-bit Ubuntu 12.04 \"precise\".  I installed sparse from\nthe Ubuntu \"multiverse\" repository.  It is package version\n0.4.3+20110419-1 in Ubuntu's notation.\n\nThanks very much for all the info.  I hadn't heard of sparse before and\nthought that using it might help me avoid submitting patches with\nproblems like the ones you detected.  It does seem promising!  But since\nit seems a bit fiddly to get it running, and even then has some\nproblems, it doesn't sound like the simple pre-submit checklist item\nthat I had imagined.\n\nMichael\n\n-- \nMichael Haggerty\nmhagger@alum.mit.edu\nhttp://softwareswirl.blogspot.com/\n"},{"id":"199624","messageId":"505B7FE4.1050706@ramsay1.demon.co.uk","threadId":"31543","inReplyTo":"7vfw6dg2q6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 5/7] grep.c: mark private file-scope symbols as static","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2012-09-20T20:43:16Z","receivedAt":"2012-09-20T20:43:16Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Junio C Hamano wrote:\n> Ramsay Jones <ramsay@ramsay1.demon.co.uk> writes:\n> \n>> Heh, so I obviously didn't see this before sending the patch yesterday! :-D\n>>\n>> Yes, this solves the problem addressed by yesterday's patch, so please\n>> ignore that. However, this tickles sparse to complain as well ... ;-)\n>>\n>> New patch on it's way.\n> \n> Are you sure the patch you are responding to really \"tickles\n> sparse\"?\n\nYes.\n\n> You have another grep.c patch timestamped two minutes after the\n> message I am responding to, and as far as I can see, it is a subset\n> of the patch you are responding to with the message I am responding\n> to.\n\nHmm, that sentence has too many twists for me! :-D\n\nLet me see if I can clear up the misunderstanding:\n\n    - the \"patch from yesterday\" (18-09-2021) fixed a complaint from\n      sparse regarding symbol 'dump_grep_expression'. This was before\n      I had seen this patch email, or the resulting commit 07a7d656.\n      Since my \"patch from yesterday\" is a strict subset of your patch,\n      then your patch also fixes the complaint from sparse regarding\n      the 'dump_grep_expression' symbol.\n\n    - this patch (commit 07a7d656) causes sparse to complain about the\n      symbols 'grep_source_load' and 'grep_source_is_binary'. The new\n      patch from me (\"timestamped two minutes after ...\") also titled\n      \"grep.c: Fix some sparse warnings\" on 19-09-2012 at 7:04 PM, is\n      *not* a subset of commit 07a7d656. This patch addresses the new\n      sparse warnings regarding 'grep_source_load' and\n      'grep_source_is_binary'.\n\nHopefully that addresses the confusion! ;-)\n\nHTH\n\nATB,\nRamsay Jones\n"}]}