IgnoredReturnValues
The return value of some functions should always be used. For example, it is dangerous to not check the return value of a write() or a system() call, and it is close to useless to call strtoul() without using the return value. Nonetheless, we do have such occurences in Wine, and we should eliminate them.
How To Find Them
To find them, you need to give $CFLAGS at least -O1 -Wp,-D_FORTIFY_SOURCE=1, but preferably -O2 -Wp,-D_FORTIFY_SOURCE=2.
Listing Organization
For simplifying the process of finding them, the list is split between those issued during the invocation of make depend and those issued during the invocation of make.
make depend
During make depend, there are 37 ignored return values which should be used as of Nov 4 2005:
- libs/wine/debug.c:175: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- libs/wpp/ppl.l:721: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- libs/wpp/ppl.l:1402: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:100: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/fnt2fon.c:105: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/fnt2fon.c:107: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/fnt2fon.c:108: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/fnt2fon.c:110: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/fnt2fon.c:166: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:167: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:170: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:175: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:183: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:188: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:199: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:206: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:209: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:211: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:218: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:232: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:237: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:238: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/fnt2fon.c:243: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:249: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/fnt2fon.c:265: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/makedep.c:496: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
- tools/sfnt2fnt.c:270: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/sfnt2fnt.c:271: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/sfnt2fnt.c:272: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/widl/parser.l:164: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/winedump/output.c:498: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- tools/winedump/pe.c:858: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/winedump/pe.c:881: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/winedump/pe.c:898: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/winedump/pe.c:924: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- tools/wrc/parser.y:2326: warning: ignoring return value of 'fread', declared with attribute warn_unused_result
- tools/wrc/parser.l:596: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
make
During make, there are 90 ignored return values which should be used as of Nov 4 2005:
- loader/kthread.c:518: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- loader/kthread.c:525: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- loader/kthread.c:533: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/wined3d/surface.c:1241: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- dlls/wined3d/surface.c:1243: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- dlls/ddraw/ddraw_utils.c:907: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- dlls/ddraw/ddraw_utils.c:946: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:1858: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2186: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2187: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2194: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2208: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2321: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2322: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2331: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:2361: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/x11drv/xfont.c:3009: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/kernel/console.c:199: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/kernel/oldconfig.c:370: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result
- dlls/kernel/oldconfig.c:390: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result
- dlls/kernel/oldconfig.c:416: warning: ignoring return value of 'fgets', declared with attribute warn_unused_result
- dlls/kernel/oldconfig.c:417: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/kernel/process.c:867: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
- dlls/kernel/process.c:1337: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
- dlls/kernel/process.c:1341: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/kernel/process.c:1503: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
- dlls/kernel/process.c:1514: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/kernel/process.c:1586: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/kernel/pthread.c:142: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/kernel/pthread.c:349: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/gdi/printdrv.c:509: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/twain/ds_ctrl.c:632: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/twain/ds_ctrl.c:673: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/twain/dsm_ctrl.c:306: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/wineps/ppd.c:600: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/wineps/ppd.c:612: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/wineps/ppd.c:718: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/wineps/ppd.c:743: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/crypt32/encode.c:1163: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/dbghelp/elf_module.c:204: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/dinput/effect_linuxinput.c:749: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/dmscript/script.c:495: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:118: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:122: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:126: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:603: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:607: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:611: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:664: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:697: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/iphlpapi/ipstats.c:738: warning: ignoring return value of 'strtoul', declared with attribute warn_unused_result
- dlls/ntdll/debugtools.c:156: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/ntdll/directory.c:1174: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
- dlls/ntdll/directory.c:1681: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/ntdll/directory.c:1766: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
- dlls/ntdll/server.c:876: warning: ignoring return value of 'chdir', declared with attribute warn_unused_result
- dlls/ntdll/virtual.c:732: warning: ignoring return value of 'pread', declared with attribute warn_unused_result
- dlls/secur32/dispatcher.c:106: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/secur32/dispatcher.c:214: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/secur32/dispatcher.c:215: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/winmm/winealsa/audio.c:1739: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/winmm/winealsa/audio.c:1770: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/winmm/wineoss/audio.c:1259: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/winmm/wineoss/audio.c:1290: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/winmm/wineoss/audio.c:2442: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/winmm/wineoss/audio.c:2614: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- dlls/winmm/wineoss/dscapture.c:453: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/winmm/wineoss/dscapture.c:680: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/wininet/ftp.c:2899: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/wininet/ftp.c:2910: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- dlls/winspool/info.c:5097: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/winspool/info.c:5273: warning: ignoring return value of 'system', declared with attribute warn_unused_result
- dlls/winspool/info.c:5278: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- dlls/winspool/info.c:5319: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- programs/winedbg/gdbproxy.c:1949: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- programs/winedbg/gdbproxy.c:2009: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- programs/winedbg/debug.l:119: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- programs/winedbg/debug.l:120: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- programs/winedbg/debug.l:218: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- programs/winefile/winefile.c:2356: warning: ignoring return value of 'getcwd', declared with attribute warn_unused_result
- programs/winhelp/macro.lex.l:91: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- server/fd.c:1358: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
- server/file.c:323: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
- server/registry.c:1186: warning: ignoring return value of 'sscanf', declared with attribute warn_unused_result
- server/registry.c:1578: warning: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
- server/request.c:751: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- server/signal.c:126: warning: ignoring return value of 'write', declared with attribute warn_unused_result
- server/signal.c:158: warning: ignoring return value of 'read', declared with attribute warn_unused_result
- server/unicode.c:41: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
- server/unicode.c:67: warning: ignoring return value of 'fwrite', declared with attribute warn_unused_result
Status
This project was suggested by VincentBeron. For more information, contact him directly or the wine-devel mailing list.
Workers: VincentBeron.
