[MPlayer-dev-eng] [PATCH] Fix "initialization discards qualifiers" warnings in cfg-*.h
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Sat Sep 11 15:58:20 CEST 2010
On Sat, Sep 11, 2010 at 03:47:53PM +0200, Clément Bœsch wrote:
> On Sat, Sep 11, 2010 at 01:57:19PM +0200, Clément Bœsch wrote:
> > > > Well in fact I didn't realized what exactly the problem was. As I
> > > > understand it now, this is happening:
> > > >
> > > > const int a[10]; void *p = a // MPlayer case, warning
> > > > int a[10]; void *p = a // no warning
> > > > const int a[10]; void *p = &a // no warning
> > >
> > > If that's the case that AFAICT is a compiler bug.
> > >
> > > > Since the void *p has to accept const and non-const values (in MPlayer
> > > > design), their is no way to change it.
> > >
> > > There is no reason you would _have_ to use the same void *.
> > > You could have another (const) pointer in the struct just for the
> > > suboptions.
> > > I don't know how many other changes that might need though.
> >
> > In fact I think I have something better: just setting the void *p to const
> > works (gcc, clang), no warning are emitted, and binaries don't change.
> >
> > There is a second entry with the same issue (void *priv), so the patch I
> > attached also change this.
> >
> > What do you think of this workaround?
>
> The previous patch fixes the cfg-*.h warnings, but creates a few other in
> the config parser. So here is a new patch adding fixing the related
> constness issues in parser.
Neither approach is really correct, but this is probably the quickest and
least annoying way to just get rid of the warnings.
So if the other devs things that's a good way to do it I don't mind.
More information about the MPlayer-dev-eng
mailing list