On 8/28/07, seventh guardian <[EMAIL PROTECTED]> wrote:
> On 8/28/07, seventh guardian <[EMAIL PROTECTED]> wrote:
> > On 8/28/07, Dominik Vogt <[EMAIL PROTECTED]> wrote:
> > > On Tue, Aug 28, 2007 at 02:13:20PM +0100, seventh guardian wrote:
> > > > On 8/28/07, seventh guardian <[EMAIL PROTECTED]> wrote:
> > > > > OOPS:
> > > > >
> > > > > $ make CFLAGS="-g -O2 -Wall -Wpointer-arith -fno-strict-aliasing 
> > > > > -Werror"
> > > > >
> > > > > make  all-recursive
> > > > > make[1]: Entering directory `/home/renato/apps/cvs/fvwm'
> > > > > Making all in libs
> > > > > make[2]: Entering directory `/home/renato/apps/cvs/fvwm/libs'
> > > > > Flocale.c:1464: warning: comparison with string literal results in 
> > > > > unspecified b
> > > > > ehaviour
> > >
> > > > > I'm not sure of how severe this warning is.. Is it a show-stopper?
> > > >
> > > > It is a show-stopper. There were some nasty char* == "foo bar" tests.
> > > > Jeez.. I'll fix them.
> > >
> > > I think the idea is that for every string literal there is only
> > > one actual instance in the executable, so the code is safe.  But
> > > instead of using macros we should rather have
> > >
> > >   Flocale.c
> > >   ---------
> > >   static const char *fft_fallback_font = FLOCALE_FFT_FALLBACK_FONT;
> > >
> > >   ...
> > >
> > >   if (fn != fft_fallback_font)
> > >   ...
> >
> > Makes sense. I was using strcasecmp, but that should be faster.
>
> Hum but now gcc complains about the const char * vs. char *:
>
> (...)
> cc1: warnings being treated as errors
> Flocale.c: In function 'FlocaleGetFftFont':
> Flocale.c:1079: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c:1084: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c: In function 'FlocaleGetFontSet':
> Flocale.c:1129: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c: In function 'FlocaleGetFont':
> Flocale.c:1218: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c: In function 'FlocaleGetFontOrFontSet':
> Flocale.c:1302: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c:1306: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c: In function 'FlocaleLoadFont':
> Flocale.c:1404: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c:1463: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c:1509: warning: passing argument 2 of 'FlocaleGetFontSet'
> discards qualifiers from pointer target type
> Flocale.c:1511: warning: assignment discards qualifiers from pointer target 
> type
> Flocale.c:1524: warning: passing argument 2 of 'FlocaleGetFont'
> discards qualifiers from pointer target type
> Flocale.c:1526: warning: assignment discards qualifiers from pointer target 
> type
> (...)

Dumb me, that's obviously easy to fix :)

Cheers,
  Renato

Reply via email to