[hatari-devel] LLVM static analyzer output
Eero Tamminen
eerot at users.berlios.de
Sun May 22 18:54:52 CEST 2011
Hi,
On sunnuntai 22 toukokuu 2011, Nicolas Pomarède wrote:
> debug/debugui.c: In function 'DebugUI_SetOptions':
> debug/debugui.c:344:32: attention : to be safe all intermediate pointers
> in cast from 'char **' to 'const char **' must be 'const' qualified
> [-Wcast-qual]
>
> main.c: In function 'main':
> main.c:739:33: attention : to be safe all intermediate pointers in cast
> from 'char **' to 'const char **' must be 'const' qualified [-Wcast-qual]
I'll look at these a bit later.
> cfgopts.c: In function 'update_config':
> cfgopts.c:280:21: attention : variable 'next' set but not used
> [-Wunused-but-set-variable]
>
> -> don't store the result of strtok ?
1) it doesn't use the strtok result for anything.
2) it's calling it wrong (with the string pointer instead of NULL
as further calls to strtok() should do)
Besides fixing this, I'll soon commit some other changes
to this file.
> file.c: In function 'File_Open':
> file.c:524:14: attention : variable 'rd' set but not used
> [-Wunused-but-set-variable]
> file.c:524:6: attention : variable 'wr' set but not used
> [-Wunused-but-set-variable]
>
> -> only used in assert ; any way to remove the warning ?
Hatari asserts aren't in performance critical parts so I think
it would be best to have them enabled also for CMake release config
(remove -DNDEBUG). Could you do that?
> ide.c: In function 'ide_atapi_cmd':
> ide.c:1754:20: attention : variable 'start_track' set but not used
> [-Wunused-but-set-variable]
> ide.c:1754:15: attention : variable 'msf' set but not used
> [-Wunused-but-set-variable]
These variables are used by commented out FIXME code.
> In file included from screen.c:1266:0:
> convert/med640x16_spec.c: In function
> 'Line_ConvertMediumRes_640x16Bit_Spec':
> convert/med640x16_spec.c:41:19: attention : variable 'edx' set but not
> used [-Wunused-but-set-variable]
> In file included from screen.c:1273:0:
> convert/med640x32_spec.c: In function
> 'Line_ConvertMediumRes_640x32Bit_Spec':
> convert/med640x32_spec.c:41:19: attention : variable 'edx' set but not
> used [-Wunused-but-set-variable]
>
> -> leave it this way to keep the same logic in all convert/*c files
>
> video.c: In function 'Video_DrawScreen':
> video.c:2526:7: attention : variable 'bScreenChanged' set but not used
> [-Wunused-but-set-variable]
>
> -> we don't use the return result of the functions ; remove
> bScreenChanged ?
I think this is left-over from the days when video frame recording
supported optionally saving only changed parts of the screen.
I.e. feel free to remove it. :-)
Btw. I commited a change to video.c which sets some variables
static that aren't used outside of it (and weren't in video.h).
- Eero
More information about the hatari-devel
mailing list