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

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


Le 16/06/2017 à 22:38, Eero Tamminen a écrit :


That's not what GCC should see.

GCC should see that "format" is set and used *only* if "prgname" is valid:
         if (prgname)
                 format = prg_format(prgname);
...
                 if (prgname && contents[offset+1] == 'Z')
                 {
                         fwrite(contents+off_prg, offset-off_prg, 1, fp);
                         /* write only first #Z line, skip rest */
                         if (!off_prg)
                                 fprintf(fp, format, prgname);
...

                         if (prgname && !off_prg)
                         {
                                 off_prg = offset;
                                 fprintf(fp, format, prgname);
                         }

And that prg_format() function always returns a valid "format"
value (pointer to either of the two const format strings).


Hi

I agree that from the code's logic "format" will only be used when prgname is not null, but as stated I see this warning in at least 4 compilers (gcc 4.9.2, gcc 5.4.0 , mingw with gcc 6.1.0 and mingw with gcc 7.1.1)

Edit : saw your message about -O2 / -O3, but maybe we should ensure warning are removed as much as possible when doing release with -03


Nicolas



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