xboard-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XBoard-devel] gcc warnings


From: Byrial Jensen
Subject: Re: [XBoard-devel] gcc warnings
Date: Mon, 16 Apr 2012 15:25:58 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120411 Thunderbird/11.0.1

Den 16-04-2012 15:43, h.g. muller skrev:

I am absolutely fine with the other warnings. Although I sometimes encounter an annoying one about library functions declared with 'warn-unused-result' (or something like that). If I am not interested in the result, I don't think the code would improve very much by fooling it into thinking I am. And not being interested in the result is often a sign of laziness or it not being clear beforehand how to solve possible error conditions. In that case patching it up by casting to (void) or some other trick only serves to hide permananetly what could be a genuine problem, so that you now know for sure it will be never fixed.

Warnings like:

backend.c:12321:2: advarsel: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]

wont be turned off by casting to void. (just see in backend.c:12321). Beside fgets() also calls of pipe(), system(), getcwd(), chdir(), nice() give this warning. Either the return codes should be really checked or the warning can be turned off with "-Wno-unused-result".

What IMO should be checked and fixed is the "may be used uninitialized" warnings:

backend.c: In function 'LeftClick':
backend.c:7306:8: warning: 'saveAnimate' may be used uninitialized in this function [-Wuninitialized]

book.c: In function 'entry_from_file':
book.c:391:19: warning: 'r' may be used uninitialized in this function [-Wuninitialized]
book.c:400:12: note: 'r' was declared here

menus.c: In function 'MenuNameToItem':
menus.c:886:50: warning: 'i' may be used uninitialized in this function [-Wuninitialized]

xoptions.c: In function 'GenericPopUp':
xoptions.c:994:62: warning: 'box' may be used uninitialized in this function [-Wuninitialized] xoptions.c:897:8: warning: 'forelast' may be used uninitialized in this function [-Wuninitialized] xoptions.c:995:46: warning: 'oldForm' may be used uninitialized in this function [-Wuninitialized]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]