{"thread":{"id":"8519","subject":"[RFC][PATCH 03/10] Sparse: fix some \"symbol not declared\" warnings (Part 1)","startedAt":"2007-06-08T22:12:40Z","lastAt":"2007-06-08T22:12:40Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"44398","messageId":"4669D458.9080403@ramsay1.demon.co.uk","threadId":"8519","inReplyTo":null,"subject":"[RFC][PATCH 03/10] Sparse: fix some \"symbol not declared\" warnings (Part 1)","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2007-06-08T22:12:40Z","receivedAt":"2007-06-08T22:12:40Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe complete warning message reads something like:\n\n    symbol 'whatever' was not declared. Should be static?\n\nIn this commit, the answer is no; the various cmd_something()\nfunctions have been correctly declared in \"builtin.h\". However,\nthe header file has not been included in the source, which\nelicits the above warning from sparse.\n\nAlso, cmd_for_each_ref(), cmd_fsck() and cmd_merge_file() required\nsome tweaks to their declaration, in order to conform to the\ncorrect prototype.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n builtin-bundle.c         |    1 +\n builtin-checkout-index.c |    1 +\n builtin-fetch--tool.c    |    1 +\n builtin-for-each-ref.c   |    3 ++-\n builtin-fsck.c           |    3 ++-\n builtin-gc.c             |    1 +\n builtin-merge-base.c     |    1 +\n builtin-merge-file.c     |    7 ++++---\n builtin-pack-refs.c      |    1 +\n builtin-rerere.c         |    1 +\n builtin-runstatus.c      |    1 +\n builtin-show-ref.c       |    1 +\n 12 files changed, 17 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin-bundle.c b/builtin-bundle.c\nindex 306ad29..375e3ef 100644\n--- a/builtin-bundle.c\n+++ b/builtin-bundle.c\n@@ -5,6 +5,7 @@\n #include \"revision.h\"\n #include \"list-objects.h\"\n #include \"run-command.h\"\n+#include \"builtin.h\"\n \n /*\n  * Basic handler for bundle files to connect repositories via sneakernet.\ndiff --git a/builtin-checkout-index.c b/builtin-checkout-index.c\nindex 8460f97..3a0c0ac 100644\n--- a/builtin-checkout-index.c\n+++ b/builtin-checkout-index.c\n@@ -40,6 +40,7 @@\n #include \"strbuf.h\"\n #include \"quote.h\"\n #include \"cache-tree.h\"\n+#include \"builtin.h\"\n \n #define CHECKOUT_ALL 4\n static int line_termination = '\\n';\ndiff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c\nindex 12adb38..a1d51d0 100644\n--- a/builtin-fetch--tool.c\n+++ b/builtin-fetch--tool.c\n@@ -1,6 +1,7 @@\n #include \"cache.h\"\n #include \"refs.h\"\n #include \"commit.h\"\n+#include \"builtin.h\"\n \n #define CHUNK_SIZE 1024\n \ndiff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c\nindex 2b21842..3ca77b5 100644\n--- a/builtin-for-each-ref.c\n+++ b/builtin-for-each-ref.c\n@@ -6,6 +6,7 @@\n #include \"tree.h\"\n #include \"blob.h\"\n #include \"quote.h\"\n+#include \"builtin.h\"\n \n /* Quoting styles */\n #define QUOTE_NONE 0\n@@ -796,7 +797,7 @@ static struct ref_sort *default_sort(void)\n \treturn sort;\n }\n \n-int cmd_for_each_ref(int ac, const char **av, char *prefix)\n+int cmd_for_each_ref(int ac, const char **av, const char *prefix)\n {\n \tint i, num_refs;\n \tconst char *format = NULL;\ndiff --git a/builtin-fsck.c b/builtin-fsck.c\nindex 44ce629..776a435 100644\n--- a/builtin-fsck.c\n+++ b/builtin-fsck.c\n@@ -7,6 +7,7 @@\n #include \"pack.h\"\n #include \"cache-tree.h\"\n #include \"tree-walk.h\"\n+#include \"builtin.h\"\n \n #define REACHABLE 0x0001\n #define SEEN      0x0002\n@@ -607,7 +608,7 @@ static const char fsck_usage[] =\n \"git-fsck [--tags] [--root] [[--unreachable] [--cache] [--full] \"\n \"[--strict] <head-sha1>*]\";\n \n-int cmd_fsck(int argc, char **argv, const char *prefix)\n+int cmd_fsck(int argc, const char **argv, const char *prefix)\n {\n \tint i, heads;\n \ndiff --git a/builtin-gc.c b/builtin-gc.c\nindex 3b1f8c2..2ca5e77 100644\n--- a/builtin-gc.c\n+++ b/builtin-gc.c\n@@ -12,6 +12,7 @@\n \n #include \"cache.h\"\n #include \"run-command.h\"\n+#include \"builtin.h\"\n \n #define FAILED_RUN \"failed to run %s\"\n \ndiff --git a/builtin-merge-base.c b/builtin-merge-base.c\nindex e35d362..f026e5a 100644\n--- a/builtin-merge-base.c\n+++ b/builtin-merge-base.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"commit.h\"\n+#include \"builtin.h\"\n \n static int show_merge_base(struct commit *rev1, struct commit *rev2, int show_all)\n {\ndiff --git a/builtin-merge-file.c b/builtin-merge-file.c\nindex 9135773..a3830c3 100644\n--- a/builtin-merge-file.c\n+++ b/builtin-merge-file.c\n@@ -1,13 +1,14 @@\n #include \"cache.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n+#include \"builtin.h\"\n \n static const char merge_file_usage[] =\n \"git merge-file [-p | --stdout] [-q | --quiet] [-L name1 [-L orig [-L name2]]] file1 orig_file file2\";\n \n-int cmd_merge_file(int argc, char **argv, char **envp)\n+int cmd_merge_file(int argc, const char **argv, const char *prefix)\n {\n-\tchar *names[3];\n+\tconst char *names[3];\n \tmmfile_t mmfs[3];\n \tmmbuffer_t result = {NULL, 0};\n \txpparam_t xpp = {XDF_NEED_MINIMAL};\n@@ -47,7 +48,7 @@ int cmd_merge_file(int argc, char **argv, char **envp)\n \t\tfree(mmfs[i].ptr);\n \n \tif (ret >= 0) {\n-\t\tchar *filename = argv[1];\n+\t\tconst char *filename = argv[1];\n \t\tFILE *f = to_stdout ? stdout : fopen(filename, \"wb\");\n \n \t\tif (!f)\ndiff --git a/builtin-pack-refs.c b/builtin-pack-refs.c\nindex d080e30..1a7d131 100644\n--- a/builtin-pack-refs.c\n+++ b/builtin-pack-refs.c\n@@ -2,6 +2,7 @@\n #include \"refs.h\"\n #include \"object.h\"\n #include \"tag.h\"\n+#include \"builtin.h\"\n \n static const char builtin_pack_refs_usage[] =\n \"git-pack-refs [--all] [--prune | --no-prune]\";\ndiff --git a/builtin-rerere.c b/builtin-rerere.c\nindex 8c2c8bd..c4d4178 100644\n--- a/builtin-rerere.c\n+++ b/builtin-rerere.c\n@@ -2,6 +2,7 @@\n #include \"path-list.h\"\n #include \"xdiff/xdiff.h\"\n #include \"xdiff-interface.h\"\n+#include \"builtin.h\"\n \n #include <time.h>\n \ndiff --git a/builtin-runstatus.c b/builtin-runstatus.c\nindex 4b489b1..d7b04cb 100644\n--- a/builtin-runstatus.c\n+++ b/builtin-runstatus.c\n@@ -1,5 +1,6 @@\n #include \"cache.h\"\n #include \"wt-status.h\"\n+#include \"builtin.h\"\n \n extern int wt_status_use_color;\n \ndiff --git a/builtin-show-ref.c b/builtin-show-ref.c\nindex 9463ff0..f70e9a2 100644\n--- a/builtin-show-ref.c\n+++ b/builtin-show-ref.c\n@@ -3,6 +3,7 @@\n #include \"object.h\"\n #include \"tag.h\"\n #include \"path-list.h\"\n+#include \"builtin.h\"\n \n static const char show_ref_usage[] = \"git show-ref [-q|--quiet] [--verify] [-h|--head] [-d|--dereference] [-s|--hash[=<length>]] [--abbrev[=<length>]] [--tags] [--heads] [--] [pattern*] < ref-list\";\n \n-- \n1.5.2\n"}]}