Re: gcc warnings
Byrial Jensen <[email protected]>
| Newsgroups | gmane.comp.gnu.xboard.devel |
|---|---|
| Message-ID | <[email protected]> |
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]