Fri 16 Aug 2013 04:34:34 AM UTC, original submission:
While building avrdude 6.0rc1 under CentOS 6.4, I encountered the following warnings. I posted these to the avrdude-dev mailing list, and Joerg responded. I have included some of Joerg's response.
gcc -DHAVE_CONFIG_H -I. -DCONFIG_DIR=\"/usr/local/etc\" -Wall -Wno-pointer-sign -g -O2 -MT libavrdude_a-avr.o -MD -MP -MF .deps/libavrdude_a-avr.Tpo -c -o lib avrdude_a-avr.o `test -f 'avr.c' || echo './'`avr.c
avr.c: In function 'avr_tpi_program_enable':
avr.c:131: warning: passing argument 2 of 'pgm->cmd_tpi' discards qualifiers from pointer target type
avr.c:131: note: expected 'unsigned char ' but argument is of type 'const unsigned char '
Joerg> This means argument 2 of the cmd_tpi method should be made expect a pointer to const. Not a big deal, but a number of files have to be changed.
gcc -DHAVE_CONFIG_H -I. -DCONFIG_DIR=\"/usr/local/etc\" -Wall -Wno-pointer-sign -g -O2 -MT libavrdude_a-fileio.o -MD -MP -MF .deps/libavrdude_afileio.Tpo -c -o libavrdude_a-fileio.o `test -f 'fileio.c' || echo './'`fileio.c
fileio.c: In function 'elf2b':
fileio.c:947: warning: 'elf_getshstrndx' is deprecated (declared at /usr/include/libelf.h:281)
Joerg> I already changed that (replaced by elf_getshdrstrndx()).
fileio.c:967: warning: format '%d' expects type 'int', but argument 4 has type 'size_t'
fileio.c:1027: warning: cast from pointer to integer of different size
fileio.c:1027: warning: format '%d' expects type 'int', but argument 5 has type 'size_t'
fileio.c:1057: warning: format '%d' expects type 'int', but argument 3 has type 'size_t'
Joerg> That's difficult. C99 declares a new printf() format for size_t ("z"), but last time we've been there, Cygwin didn't have it.
gcc -DHAVE_CONFIG_H -I. -DCONFIG_DIR=\"/usr/local/etc\" -Wall -Wno-pointer-sign -g -O2 -MT libavrdude_a-jtag3.o -MD -MP -MF .deps/libavrdude_a-jtag3.Tpo -c -o libavrdude_a-jtag3.o `test -f 'jtag3.c' || echo './'`jtag3.c
jtag3.c: In function 'jtag3_initialize':
jtag3.c:850: warning: 'flashsize' may be used uninitialized in this function
Joerg> Should not trigger in practice, but the compiler cannot know this. (It would remain uninitialized indeed if someone created a config entry that has no "flash" section.)
gcc -DHAVE_CONFIG_H -I. -DCONFIG_DIR=\"/usr/local/etc\" -Wall -Wno-pointer-sign -g -O2 -MT libavrdude_a-pickit2.o -MD -MP -MF .deps/libavrdude_a-pickit2.Tpo -c -o libavrdude_a-pickit2.o `test -f 'pickit2.c' || echo './'`pickit2.c
pickit2.c: In function 'usb_open_device':
pickit2.c:1170: warning: cast from pointer to integer of different size
Joerg> It should probably print the pointer using the %p format.
Here are the versions of the compiler and two of the related libraries.
$ rpm -q gcc
gcc-4.4.7-3.el6.x86_64
$ rpm -q elfutils-libelf
elfutils-libelf-0.152-1.el6.x86_64
$ rpm -q libusb
libusb-0.1.12-23.el6.x86_64
|