[xml] warning: cast from 'unsigned char *' to 'unsigned short *'



Hi Everyone,

I'm testing on OSX 10.12, which is a modern version of OS X. It has a
modern version of Clang.

Clang is producing some noise:

$ make
...
libtool: compile:  /usr/bin/cc -DHAVE_CONFIG_H -I. -I./include
-I/usr/local/include -DNDEBUG -fexceptions -pedantic -Wall -Wextra
-Wshadow -Wpointer-arith -Wcast-align -Wwrite-strings
-Waggregate-return -Wstrict-prototypes -Wmissing-prototypes
-Wnested-externs -Winline -Wredundant-decls -Wno-long-long
-Wno-format-extra-args -D_REENTRANT -g2 -O2 -fno-common -march=native
-fPIC -pthread -MT encoding.lo -MD -MP -MF .deps/encoding.Tpo -c
encoding.c  -fno-common -DPIC -o .libs/encoding.o
encoding.c:500:26: warning: cast from 'const unsigned char *' to
      'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* in = (unsigned short*) inb;
                         ^~~~~~~~~~~~~~~~~~~~~
encoding.c:582:27: warning: cast from 'unsigned char *' to 'unsigned short *'
      increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* out = (unsigned short*) outb;
                          ^~~~~~~~~~~~~~~~~~~~~~
encoding.c:738:26: warning: cast from 'const unsigned char *' to
      'unsigned short *' increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* in = (unsigned short*) inb;
                         ^~~~~~~~~~~~~~~~~~~~~
encoding.c:824:27: warning: cast from 'unsigned char *' to 'unsigned short *'
      increases required alignment from 1 to 2 [-Wcast-align]
    unsigned short* out = (unsigned short*) outb;
                          ^~~~~~~~~~~~~~~~~~~~~~
mv -f .deps/entities.Tpo .deps/entities.Plo

If the buffers are aligned, then you can use the following to squash
the warning:

    unsigned short* in = (unsigned short*)(void*) inb

I can upload config.log if needed.

Jeff


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]