Skip to contentSkip to conversation

Fix two unused variable warnings in gcc 4.6

PATCH In review Dan McGee 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Dan McGee

author
#0 lore raw

PATCH 1/1 Fix two unused variable warnings in gcc 4.6

Seen with -Wunused-but-set-variable.

---
 http-fetch.c      |    3 +--
 merge-recursive.c |    4 ----
 2 files changed, 1 insertions(+), 6 deletions(-)
http-fetch.c +1 -2
index 923904f..3af4c71 100644
@@ -8,7 +8,6 @@ static const char http_fetch_usage[] = "git http-fetch "
 
 int main(int argc, const char **argv)
 {
-	const char *prefix;
 	struct walker *walker;
 	int commits_on_stdin = 0;
 	int commits;
@@ -60,7 +59,7 @@ int main(int argc, const char **argv)
 	if (argv[arg])
 		str_end_url_with_slash(argv[arg], &url);
 
-	prefix = setup_git_directory();
+	setup_git_directory();
 
 	git_config(git_default_config, NULL);
 
merge-recursive.c +0 -4
index 8e82a8b..af13150 100644
@@ -356,7 +356,6 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
 	 */
 	const char *last_file = NULL;
 	int last_len = 0;
-	struct stage_data *last_e;
 	int i;
 
 	for (i = 0; i < entries->nr; i++) {
@@ -386,7 +385,6 @@ static void make_room_for_directories_of_df_conflicts(struct merge_options *o,
 		if (S_ISREG(e->stages[2].mode) || S_ISLNK(e->stages[2].mode)) {
 			last_file = path;
 			last_len = len;
-			last_e = e;
 		} else {
 			last_file = NULL;
 		}
@@ -961,7 +959,6 @@ static int process_renames(struct merge_options *o,
 	}
 
 	for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
-		char *src;
 		struct string_list *renames1, *renames2Dst;
 		struct rename *ren1 = NULL, *ren2 = NULL;
 		const char *branch1, *branch2;
@@ -996,7 +993,6 @@ static int process_renames(struct merge_options *o,
 			ren2 = ren1;
 			ren1 = tmp;
 		}
-		src = ren1->pair->one->path;
 
 		ren1->dst_entry->processed = 1;
 		ren1->src_entry->processed = 1;
Signature · 1 line
1.7.4.1
#1 lore raw
Quoted 34 lines · Dan McGee
http-fetch.c +0 -0
index 923904f..3af4c71 100644
@@ -8,7 +8,6 @@ static const char http_fetch_usage[] = "git http- 

fetch "

int main(int argc, const char **argv)
{

http-fetch.c +0 -1
-	const char *prefix;
	struct walker *walker;
	int commits_on_stdin = 0;
	int commits;
merge-recursive.c +0 -1
index 8e82a8b..af13150 100644
@@ -356,7 +356,6 @@ static void  
 make_room_for_directories_of_df_conflicts(struct merge_options *o,
 	 */
 	const char *last_file = NULL;
 	int last_len = 0;
-	struct stage_data *last_e;
 	int i;
 
	for (i = 0; i < entries->nr; i++) {
merge-recursive.c +0 -1
@@ -961,7 +959,6 @@ static int process_renames(struct merge_options  
 *o,
 	}
 
 	for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
-		char *src;
 		struct string_list *renames1, *renames2Dst;
 		struct rename *ren1 = NULL, *ren2 = NULL;
Quoted 1 line
		const char *branch1, *branch2;

Looks like three unused variables, not two.

Josh

author
#2 lore raw
Quoted 30 lines · Joshua Juran
Quoted 28 lines · Dan McGee
http-fetch.c +0 -1
index 923904f..3af4c71 100644
@@ -8,7 +8,6 @@ static const char http_fetch_usage[] = "git http-fetch "
 
 int main(int argc, const char **argv)
 {
-       const char *prefix;
        struct walker *walker;
        int commits_on_stdin = 0;
        int commits;
merge-recursive.c +0 -1
index 8e82a8b..af13150 100644
@@ -356,7 +356,6 @@ static void
 make_room_for_directories_of_df_conflicts(struct merge_options *o,
         */
        const char *last_file = NULL;
        int last_len = 0;
-       struct stage_data *last_e;
        int i;
 

       for (i = 0; i < entries->nr; i++) {

merge-recursive.c +0 -0
@@ -961,7 +959,6 @@ static int process_renames(struct merge_options *o,
        }
 
Quoted 7 lines

merge-recursive.c static int process_renames(struct merge_options *o, · line 964

Quoted 5 lines
merge-recursive.c +0 -1
        for (i = 0, j = 0; i < a_renames->nr || j < b_renames->nr;) {
-               char *src;
                struct string_list *renames1, *renames2Dst;
                struct rename *ren1 = NULL, *ren2 = NULL;
                const char *branch1, *branch2;

Looks like three unused variables, not two.

You are correct, my lack of caffeine can be blamed for the misleading message. I didn't think it was important enough to resubmit for that though.

-Dan