Skip to contentSkip to conversation

Sparse: fix "'merge_file' not declared" warning

RFC PATCH In review Ramsay Jones 1 participant 1 message Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC PATCH 7/10 Sparse: fix "'merge_file' not declared" warning

Add a declaration for merge_file() to a new "merge-file.h" header file, and add the appropriate include directives.

---

There are two other (static) definitions of a merge_file() function, one in merge-recursive.c, which could probably be renamed merge_filespec() and one in merge-index.c, which could be renamed merge_path(). Maybe the the function in merge-file.c should be called merge_blob() ... (and then change the file names too!)

 Makefile     |    3 ++-
 merge-file.c |    1 +
 merge-file.h |    8 ++++++++
 merge-tree.c |    3 +--
 4 files changed, 12 insertions(+), 3 deletions(-)
 create mode 100644 merge-file.h
Makefile +2 -1
index 29243c6..19b6da1 100644
@@ -296,7 +296,8 @@ LIB_H = \
 	diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
 	run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 	tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
-	utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h mailmap.h
+	utf8.h reflog-walk.h patch-ids.h attr.h decorate.h progress.h \
+	mailmap.h merge-file.h
 
 DIFF_OBJS = \
 	diff.o diff-lib.o diffcore-break.o diffcore-order.o \
merge-file.c +1 -0
index 748d15c..7bfefe7 100644
@@ -2,6 +2,7 @@
 #include "run-command.h"
 #include "xdiff-interface.h"
 #include "blob.h"
+#include "merge-file.h"
 
 static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
 {
merge-file.h new file +8 -0
new file mode 100644
index 0000000..a503c90
@@ -0,0 +1,8 @@
+#ifndef MERGE_FILE_H
+#define MERGE_FILE_H
+
+#include "blob.h"
+
+extern void *merge_file(struct blob *, struct blob *, struct blob *, unsigned long *);
+
+#endif
merge-tree.c +1 -2
index 3b8d9e6..93c8f54 100644
@@ -2,6 +2,7 @@
 #include "tree-walk.h"
 #include "xdiff-interface.h"
 #include "blob.h"
+#include "merge-file.h"
 
 static const char merge_tree_usage[] = "git-merge-tree <base-tree> <branch1> <branch2>";
 static int resolve_directories = 1;
@@ -53,8 +54,6 @@ static const char *explanation(struct merge_list *entry)
 	return "removed in remote";
 }
 
-extern void *merge_file(struct blob *, struct blob *, struct blob *, unsigned long *);
-
 static void *result(struct merge_list *entry, unsigned long *size)
 {
 	enum object_type type;
Signature · 1 line
1.5.2