Re: [hatari-devel] Re: Feature request: allow to specify "-d" with autostart

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 13/06/2017 à 22:45, Eero Tamminen a écrit :
Hi,

On 06/13/2017 04:52 PM, Nicolas Pomarède wrote:
Le 07/06/2017 à 22:57, Eero Tamminen a écrit :
Commited the change.

I noticed a small warning while updating sources :

/home/npomarede/src/hatari-int/src/inffile.c: In function
'INF_CreateOverride':
/home/npomarede/src/hatari-int/src/inffile.c:746:5: attention : 'format'
may be used uninitialized in this function [-Wmaybe-uninitialized]
     fprintf(fp, format, prgname);
     ^
/home/npomarede/src/hatari-int/src/inffile.c:677:14: note: 'format' was
declared here
  const char *format, *infname, *prgname;
              ^

'format' will be filled if prgname is not null, which might always be
the case ?

Yes, it's always valid when it's used, and I don't see this warning.
I think your compiler is buggy.

I have this warning with 2 versions of gcc : 4.9.2 and 5.4.0 . I don't think they're buggy ?

The warning can be seen also in antartica.no daily builds, using mingw 7.1.1 :

http://antarctica.no/~hatari/latest/windows/make-win32-release.8a5e30eb9796.log

Anyway, when looking at the code, I don't see how gcc could guess that prgname is necessarily not null and that prg_format should be called ?

        if (prgname)
                format = prg_format(prgname);

If prgname is always valid, why this test ?




Could change the code to remove this warning if possible ?

Feel free to initialize "format" to NULL if it bothers you.


     - Eero






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/