[PATCH] libiberty: {count,dup,write}argv: constify argv input slightly

Mike Frysinger vapier@gentoo.org
Tue Jan 5 20:20:00 GMT 2016


On 05 Jan 2016 07:32, Ian Lance Taylor wrote:
> On Sat, Jan 2, 2016 at 10:39 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> > Would be more useful if we could use "const char * const *", but there's
> > a long standing bug where gcc warns about incompatible pointers when you
> > try to pass in "char **".
> 
> That's not a bug.  It's how C works.  http://c-faq.com/ansi/constmismatch.html

i'm referring to the bugs filed/discussing the issue in the gcc tracker.
i'm aware of the (crap) standards.

> > We can at least constify the array itself as
> > gcc will not warn in that case.
> >
> > include/:
> > 2016-01-03  Mike Frysinger  <vapier@gentoo.org>
> >
> >         * libiberty.h (dupargv): Change arg to char * const *.
> >         (writeargv, countargv): Likewise.
> >
> > libiberty/:
> > 2016-01-03  Mike Frysinger  <vapier@gentoo.org>
> >
> >         * argv.c (dupargv): Change arg to char * const *.  Update comment.
> >         (writeargv, countargv): Likewise.
> >         * functions.texi (dupargv, writeargv, countargv): Likewise.
> 
> This is OK if it bootstraps.  Thanks.

i've been testing this in gdb because gcc doesn't actually use dupargv or
countargv.  it does use writeargv in all of three places.

that said, it does bootstrap
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160105/dace1763/attachment.sig>


More information about the Gcc-patches mailing list