Skip to content

Commit

Permalink
tools/thermal: tmon: silence 'set but not used' warnings
Browse files Browse the repository at this point in the history
gcc complains about the 'cols' variable being unused. This is
unavoidable, given the ncurses getmaxyx() macro-based API, which wants
to assign to a variable directly, even when we're not going to use it.

Warning:

    gcc -O1 -Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int -fstack-protector -D VERSION=\"1.0\"   -c -o tui.o tui.c
    tui.c: In function ‘show_dialogue’:
    tui.c:288:12: warning: variable ‘cols’ set but not used [-Wunused-but-set-variable]
      int rows, cols;
                ^

So, add a hack to get rid of that warning.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Acked-by: Jacob Pan <jacob.jun.pan@linux.intel.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
  • Loading branch information
Brian Norris authored and Zhang Rui committed Feb 28, 2015
1 parent 96a0d99 commit 986ffe0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/thermal/tmon/tui.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ void show_dialogue(void)

getmaxyx(w, rows, cols);

/* Silence compiler 'unused' warnings */
(void)cols;

werase(w);
box(w, 0, 0);
mvwprintw(w, 0, maxx/4, DIAG_TITLE);
Expand Down

0 comments on commit 986ffe0

Please sign in to comment.