Cast "const char *" pointers to "char *" to avoid compiler warnings.

Christophe Lyon christophe.lyon@linaro.org
Mon Oct 8 13:06:00 GMT 2018


On Fri, 5 Oct 2018 at 13:18, Sebastian Huber
<sebastian.huber@embedded-brains.de> wrote:
>
> On 05/10/2018 11:32, Christophe Lyon wrote:
> > commit c6af2b7be0e94935c589307c14eeb9f53901a811
> > Author: Christophe Lyon<christophe.lyon@linaro.org>
> > Date:   Mon Oct 1 18:53:37 2018 +0000
> >
> >      Cast "const char *" pointers to "char *" to avoid compiler warnings.
> >
> >      2018-10-01  Christophe Lyon<christophe.lyon@linaro.org>
> >
> >       * newlib/libc/ctype/ctype_.c (__set_ctype): Cast "_ctype_" to "char *".
> >       * newlib/libc/locale/locale.c (__loadlocale): Cast "new_locale" to
> >       "char *".
>
> There is a __DECONST() macro in <sys/cdefs.h>. I think this better
> documents the purpose of these casts. It silences also -Wcast-qual warnings.
>

Hmmm, it seems it isn't used anywhere in the newlib sources, is it
really a good idea?
I'm not sure it will be clearer...

> --
> Sebastian Huber, embedded brains GmbH
>
> Address : Dornierstr. 4, D-82178 Puchheim, Germany
> Phone   : +49 89 189 47 41-16
> Fax     : +49 89 189 47 41-09
> E-Mail  : sebastian.huber@embedded-brains.de
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>



More information about the Newlib mailing list