Skip to contentSkip to conversation

sparse: Fix an "symbol 'merge_file' not decared" warning

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

lore
Share & tools
lore
#0 lore raw

PATCH 5/9 sparse: Fix an "symbol 'merge_file' not decared" warning

In order to fix the warning, we add a new "merge-file.h" header containing the extern declaration of the merge_file() function, and include the header in the source files that require the declaration.

---

Note that I considered re-naming this function to merge_blobs() or something, since there is already two other static merge_file() functions in builtin/merge-index.c and merge-recursive.c.

 Makefile             |    1 +
 builtin/merge-tree.c |    3 +--
 merge-file.c         |    1 +
 merge-file.h         |    7 +++++++
 4 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 merge-file.h
Makefile +1 -0
index 79bef43..2a100b7 100644
@@ -525,6 +525,7 @@ LIB_H += list-objects.h
 LIB_H += ll-merge.h
 LIB_H += log-tree.h
 LIB_H += mailmap.h
+LIB_H += merge-file.h
 LIB_H += merge-recursive.h
 LIB_H += notes.h
 LIB_H += notes-cache.h
builtin/merge-tree.c +1 -2
index 1991742..897a563 100644
@@ -3,6 +3,7 @@
 #include "xdiff-interface.h"
 #include "blob.h"
 #include "exec_cmd.h"
+#include "merge-file.h"
 
 static const char merge_tree_usage[] = "git merge-tree <base-tree> <branch1> <branch2>";
 static int resolve_directories = 1;
@@ -54,8 +55,6 @@ static const char *explanation(struct merge_list *entry)
 	return "removed in remote";
 }
 
-extern void *merge_file(const char *, struct blob *, struct blob *, struct blob *, unsigned long *);
-
 static void *result(struct merge_list *entry, unsigned long *size)
 {
 	enum object_type type;
merge-file.c +1 -0
index f7f4533..7845528 100644
@@ -3,6 +3,7 @@
 #include "xdiff-interface.h"
 #include "ll-merge.h"
 #include "blob.h"
+#include "merge-file.h"
 
 static int fill_mmfile_blob(mmfile_t *f, struct blob *obj)
 {
merge-file.h new file +7 -0
new file mode 100644
index 0000000..9b3b83a
@@ -0,0 +1,7 @@
+#ifndef MERGE_FILE_H
+#define MERGE_FILE_H
+
+extern void *merge_file(const char *path, struct blob *base, struct blob *our,
+			struct blob *their, unsigned long *size);
+
+#endif
Signature · 1 line
1.7.4