lkml.org 
[lkml]   [2015]   [Feb]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 8/8] tools/thermal: tmon: silence 'set but not used' warnings
Date
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>
---
This patch is ugly and of little value IMO, but it does squash the warning.
Take it or leave it.

tools/thermal/tmon/tui.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/tools/thermal/tmon/tui.c b/tools/thermal/tmon/tui.c
index 36e1f86c8452..b5d1c6b22dd3 100644
--- a/tools/thermal/tmon/tui.c
+++ b/tools/thermal/tmon/tui.c
@@ -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);
--
1.9.1


\
 
 \ /
  Last update: 2015-02-18 03:41    [W:0.086 / U:1.260 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site