From: Christian Weisgerber Subject: Fix llvm 13 warning/error To: gameoftrees@openbsd.org Date: Wed, 27 Oct 2021 13:23:50 +0200 LLVM 13 complains about two variables that are set but never read: -------------------> cc -O2 -pipe -O0 -g -Werror -Wall -Wstrict-prototypes -Wunused-variable -MD -MP -I/home/naddy/got/got/../include -I/home/naddy/got/got/../lib -DGOT_LIBEXECDIR=/home/naddy/bin -DGOT_VERSION=0.64-current -c /home/naddy/got/got/../lib/blame.c /home/naddy/got/got/../lib/blame.c:127:16: error: variable 'left_start' set but not used [-Werror,-Wunused-but-set-variable] unsigned int left_start, left_count; ^ /home/naddy/got/got/../lib/blame.c:128:16: error: variable 'right_start' set but not used [-Werror,-Wunused-but-set-variable] unsigned int right_start, right_count; ^ 2 errors generated. *** Error 1 in got (:87 'blame.o') <------------------- I think we can simply delete those variables and the function calls that assign values to them. Or does diff_chunk_get_*_start() have any side effects that we need? The regression tests don't show any problems. diff refs/heads/main refs/heads/llvm13 blob - 783c434b33577727fafbf7589d751e7601a9dcf7 blob + d2db8c1e2cd6a46130821551a293b51fa2c841b9 --- lib/blame.c +++ lib/blame.c @@ -124,8 +124,7 @@ blame_changes(struct got_blame *blame, struct diff_res for (i = 0; i < diff_result->chunks.len && blame->nannotated < blame->nlines; i++) { struct diff_chunk *c = diff_chunk_get(diff_result, i); - unsigned int left_start, left_count; - unsigned int right_start, right_count; + unsigned int left_count, right_count; int j; /* @@ -134,9 +133,7 @@ blame_changes(struct got_blame *blame, struct diff_res * that chunk ranges never exceed the number of lines * in the left/right input files. */ - left_start = diff_chunk_get_left_start(c, diff_result, 0); left_count = diff_chunk_get_left_count(c); - right_start = diff_chunk_get_right_start(c, diff_result, 0); right_count = diff_chunk_get_right_count(c); if (left_count == right_count) { -- Christian "naddy" Weisgerber naddy@mips.inka.de