Skip to content

Commit d9165be

Browse files
rscharfegitster
authored andcommitted
range-diff: avoid compiler warning when char is unsigned
Since 2b15969 (range-diff: let '--abbrev' option takes effect, 2023-02-20), GCC 11.3 on Ubuntu 22.04 on aarch64 warns (and errors out if the make variable DEVELOPER is set): range-diff.c: In function ‘output_pair_header’: range-diff.c:388:20: error: comparison is always false due to limited range of data type [-Werror=type-limits] 388 | if (abbrev < 0) | ^ cc1: all warnings being treated as errors That's because char is unsigned on that platform. Use int instead, just like in struct diff_options, to copy the value faithfully. Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2b15969 commit d9165be

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

range-diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ static void output_pair_header(struct diff_options *diffopt,
383383
const char *color_new = diff_get_color_opt(diffopt, DIFF_FILE_NEW);
384384
const char *color_commit = diff_get_color_opt(diffopt, DIFF_COMMIT);
385385
const char *color;
386-
char abbrev = diffopt->abbrev;
386+
int abbrev = diffopt->abbrev;
387387

388388
if (abbrev < 0)
389389
abbrev = DEFAULT_ABBREV;

0 commit comments

Comments
 (0)