Fix -Wunused-but-set-variable warnings As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Use GIT_UNUSED or remove actually unused variables to prevent those 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
diff --git a/src/refs.c b/src/refs.c
index 17ec291..e5fc79d 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -684,7 +684,7 @@ static int packed_loadloose(git_repository *repository)
/* Remove any loose references from the cache */
{
- const void *_unused;
+ const void *GIT_UNUSED(_unused);
git_reference *reference;
GIT_HASHTABLE_FOREACH(repository->references.loose_cache, _unused, reference,
@@ -868,7 +868,7 @@ static int packed_write(git_repository *repo)
/* Load all the packfile into a vector */
{
git_reference *reference;
- const void *_unused;
+ const void *GIT_UNUSED(_unused);
GIT_HASHTABLE_FOREACH(repo->references.packfile, _unused, reference,
git_vector_insert(&packing_list, reference); /* cannot fail: vector already has the right size */
@@ -1518,7 +1518,7 @@ int git_reference_listcb(git_repository *repo, unsigned int list_flags, int (*ca
/* list all the packed references first */
if (list_flags & GIT_REF_PACKED) {
const char *ref_name;
- void *_unused;
+ void *GIT_UNUSED(_unused);
if ((error = packed_load(repo)) < GIT_SUCCESS)
return error;
@@ -1597,7 +1597,7 @@ int git_repository__refcache_init(git_refcache *refs)
void git_repository__refcache_free(git_refcache *refs)
{
git_reference *reference;
- const void *_unused;
+ const void *GIT_UNUSED(_unused);
assert(refs);
diff --git a/src/repository.c b/src/repository.c
index c428b00..8cc2644 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -58,7 +58,6 @@ static int assign_repository_dirs(
const char *git_work_tree)
{
char path_aux[GIT_PATH_MAX];
- size_t git_dir_path_len;
int error = GIT_SUCCESS;
assert(repo);
@@ -70,8 +69,6 @@ static int assign_repository_dirs(
if (error < GIT_SUCCESS)
return error;
- git_dir_path_len = strlen(path_aux);
-
/* store GIT_DIR */
repo->path_repository = git__strdup(path_aux);
if (repo->path_repository == NULL)
diff --git a/src/revwalk.c b/src/revwalk.c
index b62b099..7879848 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -483,7 +483,7 @@ int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
void git_revwalk_free(git_revwalk *walk)
{
unsigned int i;
- const void *_unused;
+ const void *GIT_UNUSED(_unused);
commit_object *commit;
if (walk == NULL)
@@ -558,7 +558,7 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
void git_revwalk_reset(git_revwalk *walk)
{
- const void *_unused;
+ const void *GIT_UNUSED(_unused);
commit_object *commit;
assert(walk);
diff --git a/tests/t07-hashtable.c b/tests/t07-hashtable.c
index 5971369..0b362ca 100644
--- a/tests/t07-hashtable.c
+++ b/tests/t07-hashtable.c
@@ -155,7 +155,7 @@ BEGIN_TEST(tableit0, "iterate through all the contents of the table")
const int objects_n = 32;
int i;
table_item *objects, *ob;
- const void *_unused;
+ const void *GIT_UNUSED(_unused);
git_hashtable *table = NULL;