Merge pull request #1996 from ethomson/warnings Clean up warnings
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
diff --git a/deps/regex/regex.c b/deps/regex/regex.c
index f9a8c9b..225a001 100644
--- a/deps/regex/regex.c
+++ b/deps/regex/regex.c
@@ -67,10 +67,17 @@
#include "regex_internal.h"
#include "regex_internal.c"
+
#ifdef GAWK
-#define bool int
-#define true (1)
-#define false (0)
+# define bool int
+
+# ifndef true
+# define true (1)
+# endif
+
+# ifndef false
+# define false (0)
+# endif
#endif
#include "regcomp.c"
#include "regexec.c"
diff --git a/src/buffer.h b/src/buffer.h
index 4ca9d4d..c88af6f 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -7,10 +7,11 @@
#ifndef INCLUDE_buffer_h__
#define INCLUDE_buffer_h__
+#include <stdarg.h>
+
#include "common.h"
#include "git2/strarray.h"
#include "git2/buffer.h"
-#include <stdarg.h>
/* typedef struct {
* char *ptr;
diff --git a/src/common.h b/src/common.h
index 159d31b..a188878 100644
--- a/src/common.h
+++ b/src/common.h
@@ -42,6 +42,8 @@
# endif
#define GIT_STDLIB_CALL
+# include <arpa/inet.h>
+
#endif
#include "git2/types.h"
diff --git a/src/merge.c b/src/merge.c
index ef138c2..45387d4 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -2306,8 +2306,8 @@ done:
int git_merge__indexes(git_repository *repo, git_index *index_new)
{
- git_index *index_repo;
- unsigned int index_repo_caps;
+ git_index *index_repo = NULL;
+ unsigned int index_repo_caps = 0;
git_vector paths = GIT_VECTOR_INIT;
size_t index_conflicts = 0, wd_conflicts = 0, conflicts, i;
char *path;
diff --git a/src/revert.c b/src/revert.c
index 7ed04fe..6cfd591 100644
--- a/src/revert.c
+++ b/src/revert.c
@@ -20,15 +20,12 @@
static int write_revert_head(
git_repository *repo,
- const git_commit *commit,
const char *commit_oidstr)
{
git_filebuf file = GIT_FILEBUF_INIT;
git_buf file_path = GIT_BUF_INIT;
int error = 0;
- assert(repo && commit);
-
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_REVERT_HEAD_FILE)) >= 0 &&
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) >= 0 &&
(error = git_filebuf_printf(&file, "%s\n", commit_oidstr)) >= 0)
@@ -44,7 +41,6 @@ static int write_revert_head(
static int write_merge_msg(
git_repository *repo,
- const git_commit *commit,
const char *commit_oidstr,
const char *commit_msgline)
{
@@ -52,8 +48,6 @@ static int write_merge_msg(
git_buf file_path = GIT_BUF_INIT;
int error = 0;
- assert(repo && commit);
-
if ((error = git_buf_joinpath(&file_path, repo->path_repository, GIT_MERGE_MSG_FILE)) < 0 ||
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_FORCE, GIT_REVERT_FILE_MODE)) < 0 ||
(error = git_filebuf_printf(&file, "Revert \"%s\"\n\nThis reverts commit %s.\n",
@@ -198,8 +192,8 @@ int git_revert(
if ((error = git_buf_printf(&their_label, "parent of %.7s... %s", commit_oidstr, commit_msg)) < 0 ||
(error = revert_normalize_opts(repo, &opts, given_opts, git_buf_cstr(&their_label))) < 0 ||
- (error = write_revert_head(repo, commit, commit_oidstr)) < 0 ||
- (error = write_merge_msg(repo, commit, commit_oidstr, commit_msg)) < 0 ||
+ (error = write_revert_head(repo, commit_oidstr)) < 0 ||
+ (error = write_merge_msg(repo, commit_oidstr, commit_msg)) < 0 ||
(error = git_repository_head(&our_ref, repo)) < 0 ||
(error = git_reference_peel((git_object **)&our_commit, our_ref, GIT_OBJ_COMMIT)) < 0 ||
(error = git_revert_commit(&index_new, repo, commit, our_commit, opts.mainline, &opts.merge_tree_opts)) < 0 ||
diff --git a/src/win32/precompiled.h b/src/win32/precompiled.h
index cbfe988..33ce106 100644
--- a/src/win32/precompiled.h
+++ b/src/win32/precompiled.h
@@ -1,6 +1,3 @@
-#include "git2.h"
-#include "common.h"
-
#include <assert.h>
#include <errno.h>
#include <limits.h>
@@ -9,6 +6,7 @@
#include <string.h>
#include <fcntl.h>
#include <time.h>
+#include <stdarg.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -20,3 +18,6 @@
#ifdef GIT_THREADS
#include "win32/pthread.h"
#endif
+
+#include "git2.h"
+#include "common.h"
diff --git a/tests/blame/harder.c b/tests/blame/harder.c
index 7c4dd4f..e777417 100644
--- a/tests/blame/harder.c
+++ b/tests/blame/harder.c
@@ -36,6 +36,8 @@ void test_blame_harder__m(void)
/* TODO */
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
+ GIT_UNUSED(opts);
+
opts.flags = GIT_BLAME_TRACK_COPIES_SAME_FILE;
}
@@ -44,6 +46,8 @@ void test_blame_harder__c(void)
{
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
+ GIT_UNUSED(opts);
+
/* Attribute the first hunk in b.txt to (E), since it was cut/pasted from
* a.txt in (D).
*/
@@ -54,6 +58,8 @@ void test_blame_harder__cc(void)
{
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
+ GIT_UNUSED(opts);
+
/* Attribute the second hunk in b.txt to (E), since it was copy/pasted from
* a.txt in (C).
*/
@@ -63,6 +69,8 @@ void test_blame_harder__cc(void)
void test_blame_harder__ccc(void)
{
git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
+
+ GIT_UNUSED(opts);
/* Attribute the third hunk in b.txt to (E). This hunk was deleted from
* a.txt in (D), but reintroduced in (B).
diff --git a/tests/merge/merge_helpers.c b/tests/merge/merge_helpers.c
index 7ca1e65..5660179 100644
--- a/tests/merge/merge_helpers.c
+++ b/tests/merge/merge_helpers.c
@@ -60,7 +60,6 @@ int merge_commits_from_branches(
git_commit *our_commit, *their_commit;
git_oid our_oid, their_oid;
git_buf branch_buf = GIT_BUF_INIT;
- int error;
git_buf_printf(&branch_buf, "%s%s", GIT_REFS_HEADS_DIR, ours_name);
cl_git_pass(git_reference_name_to_id(&our_oid, repo, branch_buf.ptr));
diff --git a/tests/merge/trees/commits.c b/tests/merge/trees/commits.c
index 92680c3..f8f4fba 100644
--- a/tests/merge/trees/commits.c
+++ b/tests/merge/trees/commits.c
@@ -29,28 +29,6 @@ void test_merge_trees_commits__cleanup(void)
cl_git_sandbox_cleanup();
}
-static void merge_commits(
- git_index **out,
- git_repository *repo,
- const char *our_oidstr,
- const char *their_oidstr,
- const git_merge_tree_opts *opts)
-{
- git_oid our_oid, their_oid;
- git_commit *our_commit, *their_commit;
-
- cl_git_pass(git_oid_fromstr(&our_oid, our_oidstr));
- cl_git_pass(git_oid_fromstr(&their_oid, their_oidstr));
-
- cl_git_pass(git_commit_lookup(&our_commit, repo, &our_oid));
- cl_git_pass(git_commit_lookup(&their_commit, repo, &their_oid));
-
- cl_git_pass(git_merge_commits(out, repo, our_commit, their_commit, opts));
-
- git_commit_free(our_commit);
- git_commit_free(their_commit);
-}
-
void test_merge_trees_commits__automerge(void)
{
git_index *index;
diff --git a/tests/refs/branches/create.c b/tests/refs/branches/create.c
index 693a592..e4ad668 100644
--- a/tests/refs/branches/create.c
+++ b/tests/refs/branches/create.c
@@ -73,4 +73,5 @@ void test_refs_branches_create__creating_a_branch_with_an_invalid_name_returns_E
cl_assert_equal_i(GIT_EINVALIDSPEC,
git_branch_create(&branch, repo, "inv@{id", target, 0));
-}
\ No newline at end of file
+}
+