From eaef5482d5f32759d58a4d074cad6e70e5051f6d Mon Sep 17 00:00:00 2001 From: cancel Date: Tue, 31 Dec 2019 15:00:57 +0900 Subject: [PATCH] Add -Wshadow to tool build flags. And fixes a shadowed (but harmless) loop counter warning. --- tool | 4 +++- tui_main.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tool b/tool index 9d70071..6604b05 100755 --- a/tool +++ b/tool @@ -209,7 +209,9 @@ build_target() { local out_exe add cc_flags -std=c99 -pipe -finput-charset=UTF-8 -Wall -Wpedantic -Wextra if cc_id_and_vers_gte gcc 6.0.0 || cc_id_and_vers_gte clang 3.9.0; then - add cc_flags -Wconversion -Wstrict-prototypes -Werror=implicit-function-declaration -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion + add cc_flags -Wconversion -Wshadow -Wstrict-prototypes \ + -Werror=implicit-function-declaration -Werror=implicit-int \ + -Werror=incompatible-pointer-types -Werror=int-conversion fi if [[ $lld_detected = 1 ]]; then add cc_flags -fuse-ld=lld diff --git a/tui_main.c b/tui_main.c index 1f8f939..92583d1 100644 --- a/tui_main.c +++ b/tui_main.c @@ -588,8 +588,8 @@ void draw_oevent_list(WINDOW* win, Oevent_list const* oevent_list) { Oevent_osc_ints const* eo = &ev->osc_ints; wprintw(win, "OSC\t%c\tcount: %d ", eo->glyph, eo->count, eo->count); waddch(win, ACS_VLINE); - for (Usz i = 0; i < eo->count; ++i) { - wprintw(win, " %d", eo->numbers[i]); + for (Usz j = 0; j < eo->count; ++i) { + wprintw(win, " %d", eo->numbers[j]); } } break; case Oevent_type_udp_string: {