About pointer signedness warnings

Tito farmatito at tiscali.it
Wed Dec 14 13:22:40 UTC 2005


Hi,
just today I've seen a thread on kerneltrap about dropping gcc 2.95,
where  was also mentioned a flag (probably for gcc 4.x.x only)
to remove  warnings about pointer signedness:

 # disable pointer signedness warnings in gcc 4.0

 CFLAGS += $(call cc-option,-Wno-pointer-sign,)

I just tested this for fun by adding it to the C EXTRA FLAGS in make menuconfig
and the warnings in a make allyesconfig were reduced from:

root at localhost:/dev/pts/0:/root/Desktop/busybox# make 1> /dev/null
/root/Desktop/busybox/coreutils/install.c: In function 'install_main':
/root/Desktop/busybox/coreutils/install.c:120: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/coreutils/install.c:121: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/coreutils/install.c:122: warning: pointer targets in passing argument 2 of 'copy_file' differ in signedness
/root/Desktop/busybox/coreutils/install.c:125: warning: pointer targets in passing argument 1 of 'chmod' differ in signedness
/root/Desktop/busybox/coreutils/install.c:131: warning: pointer targets in passing argument 1 of 'lchown' differ in signedness
/root/Desktop/busybox/coreutils/od.c: In function 'od_main':
/root/Desktop/busybox/coreutils/od.c:175: warning: pointer targets in passing argument 3 of 'getopt' differ in signedness
/root/Desktop/busybox/coreutils/od.c:178: warning: pointer targets in passing argument 1 of 'strchr' differ in signedness
/root/Desktop/busybox/coreutils/od.c:178: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/coreutils/tr.c: In function 'expand':
/root/Desktop/busybox/coreutils/tr.c:144: warning: pointer targets in passing argument 1 of 'strcat' differ in signedness
/root/Desktop/busybox/coreutils/tr.c:146: warning: pointer targets in passing argument 1 of 'strcat' differ in signedness
/root/Desktop/busybox/coreutils/tr.c:159: warning: pointer targets in passing argument 1 of 'strcat' differ in signedness
/root/Desktop/busybox/coreutils/tr.c: In function 'tr_main':
/root/Desktop/busybox/coreutils/tr.c:217: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/coreutils/tr.c:246: warning: pointer targets in passing argument 2 of 'expand' differ in signedness
/root/Desktop/busybox/coreutils/tr.c:248: warning: pointer targets in passing argument 1 of 'complement' differ in signedness
/root/Desktop/busybox/coreutils/tr.c:252: warning: pointer targets in passing argument 2 of 'expand' differ in signedness
/root/Desktop/busybox/coreutils/tr.c:253: warning: pointer targets in passing argument 1 of 'map' differ in signedness
/root/Desktop/busybox/coreutils/tr.c:253: warning: pointer targets in passing argument 3 of 'map' differ in signedness
/root/Desktop/busybox/coreutils/uudecode.c: In function 'read_base64':
/root/Desktop/busybox/coreutils/uudecode.c:101: warning: comparison is always false due to limited range of data type
/root/Desktop/busybox/coreutils/uuencode.c: In function 'uuencode_main':
/root/Desktop/busybox/coreutils/uuencode.c:133: warning: pointer targets in passing argument 1 of 'uuencode' differ in signedness
/root/Desktop/busybox/console-tools/loadfont.c: In function 'loadnewfont':
/root/Desktop/busybox/console-tools/loadfont.c:190: warning: pointer targets in passing argument 2 of 'do_loadtable' differ in signedness
/root/Desktop/busybox/editors/patch.c: In function 'extract_filename':
/root/Desktop/busybox/editors/patch.c:82: warning: pointer targets in return differ in signedness
/root/Desktop/busybox/editors/patch.c: In function 'patch_main':
/root/Desktop/busybox/editors/patch.c:134: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/editors/patch.c:143: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'vi_main':
/root/Desktop/busybox/editors/vi.c:350: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'colon':
/root/Desktop/busybox/editors/vi.c:732: warning: pointer targets in assignment differ in signedness
/root/Desktop/busybox/editors/vi.c:766: warning: pointer targets in passing argument 1 of 'system' differ in signedness
/root/Desktop/busybox/editors/vi.c:790: warning: pointer targets in passing argument 1 of 'bb_strlen' differ in signedness
/root/Desktop/busybox/editors/vi.c:793: warning: pointer targets in passing argument 1 of 'bb_strlen' differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'get_input_line':
/root/Desktop/busybox/editors/vi.c:2401: warning: pointer targets in passing argument 1 of 'write1' differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'file_size':
/root/Desktop/busybox/editors/vi.c:2434: warning: pointer targets in passing argument 1 of 'bb_strlen' differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'place_cursor':
/root/Desktop/busybox/editors/vi.c:2590: warning: pointer targets in passing argument 2 of 'strncat' differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'show_status_line':
/root/Desktop/busybox/editors/vi.c:2679: warning: pointer targets in passing argument 1 of 'bufsum' differ in signedness
/root/Desktop/busybox/editors/vi.c:2684: warning: pointer targets in passing argument 1 of 'write1' differ in signedness
/root/Desktop/busybox/editors/vi.c:2687: warning: pointer targets in passing argument 1 of 'bb_strlen' differ in signedness
/root/Desktop/busybox/editors/vi.c: In function 'refresh':
/root/Desktop/busybox/editors/vi.c:2941: warning: pointer targets in initialization differ in signedness
/root/Desktop/busybox/networking/arping.c: In function 'arping_main':
/root/Desktop/busybox/networking/arping.c:421: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
/root/Desktop/busybox/networking/arping.c:442: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
/root/Desktop/busybox/networking/arping.c:488: warning: pointer targets in passing argument 6 of 'recvfrom' differ in signedness
/root/Desktop/busybox/networking/arping.c:496: warning: pointer targets in passing argument 1 of 'recv_pack' differ in signedness
/root/Desktop/busybox/networking/interface.c: In function 'UNSPEC_sprint':
/root/Desktop/busybox/networking/interface.c:504: warning: pointer targets in passing argument 1 of 'UNSPEC_print' differ in signedness
/root/Desktop/busybox/networking/interface.c: In function 'ife_print':
/root/Desktop/busybox/networking/interface.c:1836: warning: pointer targets in passing argument 1 of 'hw->print' differ in signedness
/root/Desktop/busybox/networking/telnet.c: In function 'handlenetoutput':
/root/Desktop/busybox/networking/telnet.c:207: warning: pointer targets in initialization differ in signedness
/root/Desktop/busybox/networking/telnetd.c: In function 'remove_iacs':
/root/Desktop/busybox/networking/telnetd.c:134: warning: pointer targets in initialization differ in signedness
/root/Desktop/busybox/networking/traceroute.c:296: warning: 'align' attribute directive ignored
/root/Desktop/busybox/networking/wget.c: In function 'wget_main':
/root/Desktop/busybox/networking/wget.c:335: warning: pointer targets in passing argument 1 of 'base64enc' differ in signedness
/root/Desktop/busybox/networking/wget.c:339: warning: pointer targets in passing argument 1 of 'base64enc' differ in signedness
/root/Desktop/busybox/networking/zcip.c: In function 'zcip_main':
/root/Desktop/busybox/networking/zcip.c:346: warning: pointer targets in passing argument 1 of 'seed48' differ in signedness
/root/Desktop/busybox/networking/libiproute/ipaddress.c: In function 'ipaddr_list_or_flush':
/root/Desktop/busybox/networking/libiproute/ipaddress.c:460: warning: pointer targets in passing argument 1 of 'rtnl_rtscope_a2n' differ in signedness
/root/Desktop/busybox/networking/libiproute/ipaddress.c: In function 'ipaddr_modify':
/root/Desktop/busybox/networking/libiproute/ipaddress.c:719: warning: pointer targets in passing argument 1 of 'rtnl_rtscope_a2n' differ in signedness
/root/Desktop/busybox/networking/libiproute/iplink.c: In function 'get_address':
/root/Desktop/busybox/networking/libiproute/iplink.c:197: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
/root/Desktop/busybox/networking/libiproute/iplink.c: In function 'parse_address':
/root/Desktop/busybox/networking/libiproute/iplink.c:214: warning: pointer targets in passing argument 1 of 'll_addr_a2n' differ in signedness
/root/Desktop/busybox/networking/libiproute/iproute.c: In function 'iproute_modify':
/root/Desktop/busybox/networking/libiproute/iproute.c:350: warning: pointer targets in passing argument 1 of 'rtnl_rtprot_a2n' differ in signedness
/root/Desktop/busybox/networking/libiproute/iproute.c: In function 'iproute_list_or_flush':
/root/Desktop/busybox/networking/libiproute/iproute.c:497: warning: pointer targets in passing argument 1 of 'rtnl_rtprot_a2n' differ in signedness
/root/Desktop/busybox/networking/libiproute/libnetlink.c: In function 'rtnl_open':
/root/Desktop/busybox/networking/libiproute/libnetlink.c:52: warning: pointer targets in passing argument 3 of 'getsockname' differ in signedness
/root/Desktop/busybox/networking/libiproute/utils.c: In function 'get_prefix_1':
/root/Desktop/busybox/networking/libiproute/utils.c:197: warning: pointer targets in passing argument 1 of 'get_integer' differ in signedness
/root/Desktop/busybox/networking/udhcp/packet.c: In function 'udhcp_get_packet':
/root/Desktop/busybox/networking/udhcp/packet.c:73: warning: pointer targets in passing argument 1 of 'strncmp' differ in signedness
/root/Desktop/busybox/networking/udhcp/dhcpc.c: In function 'udhcpc_main':
/root/Desktop/busybox/networking/udhcp/dhcpc.c:235: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/networking/udhcp/dhcpc.c:247: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/networking/udhcp/dhcpc.c:262: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/networking/udhcp/dhcpc.c:279: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/networking/udhcp/serverpacket.c: In function 'add_bootp_options':
/root/Desktop/busybox/networking/udhcp/serverpacket.c:101: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/networking/udhcp/serverpacket.c:103: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/shell/ash.c: In function 'readtoken1':
/root/Desktop/busybox/shell/ash.c:10622: warning: 'saveprompt' may be used uninitialized in this function
/root/Desktop/busybox/shell/ash.c:10197: warning: 'prevsyntax' may be used uninitialized in this function
/root/Desktop/busybox/shell/hush.c: In function 'update_ifs_map':
/root/Desktop/busybox/shell/hush.c:2647: warning: pointer targets in passing argument 1 of 'mapset' differ in signedness
/root/Desktop/busybox/shell/hush.c:2648: warning: pointer targets in passing argument 1 of 'mapset' differ in signedness
/root/Desktop/busybox/shell/hush.c:2649: warning: pointer targets in passing argument 1 of 'mapset' differ in signedness
/root/Desktop/busybox/shell/hush.c: In function 'parse_stream_outer':
/root/Desktop/busybox/shell/hush.c:2664: warning: pointer targets in passing argument 1 of 'mapset' differ in signedness
/root/Desktop/busybox/shell/lash.c: In function 'busy_loop':
/root/Desktop/busybox/shell/lash.c:1456: warning: 'inbg' may be used uninitialized in this function
/root/Desktop/busybox/util-linux/fdisk.c: In function 'sgi_list_table':
/root/Desktop/busybox/util-linux/fdisk.c:1914: warning: pointer targets in initialization differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'sgi_check_bootfile':
/root/Desktop/busybox/util-linux/fdisk.c:1959: warning: pointer targets in passing argument 2 of 'strncmp' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'sgi_get_bootfile':
/root/Desktop/busybox/util-linux/fdisk.c:1970: warning: pointer targets in return differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'create_sgiinfo':
/root/Desktop/busybox/util-linux/fdisk.c:1996: warning: pointer targets in passing argument 1 of 'strncpy' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'sgi_write_table':
/root/Desktop/busybox/util-linux/fdisk.c:2013: warning: pointer targets in passing argument 1 of 'strncmp' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'create_sgilabel':
/root/Desktop/busybox/util-linux/fdisk.c:2395: warning: pointer targets in passing argument 1 of 'strcpy' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'fill_sgiinfo':
/root/Desktop/busybox/util-linux/fdisk.c:2457: warning: pointer targets in passing argument 1 of 'strcpy' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c:2458: warning: pointer targets in passing argument 1 of 'strcpy' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c:2460: warning: pointer targets in passing argument 1 of 'strcpy' differ in signedness
/root/Desktop/busybox/util-linux/fdisk.c: In function 'get_partition_table_geometry':
/root/Desktop/busybox/util-linux/fdisk.c:3943: warning: pointer targets in passing argument 1 of 'valid_part_table_flag' differ in signedness
/root/Desktop/busybox/util-linux/mkswap.c: In function 'page_ok':
/root/Desktop/busybox/util-linux/mkswap.c:179: warning: pointer targets in passing argument 1 of 'bit_set' differ in signedness
/root/Desktop/busybox/util-linux/mkswap.c: In function 'page_bad':
/root/Desktop/busybox/util-linux/mkswap.c:185: warning: pointer targets in passing argument 1 of 'bit_test_and_clear' differ in signedness
/root/Desktop/busybox/util-linux/mkswap.c: In function 'mkswap_main':
/root/Desktop/busybox/util-linux/mkswap.c:389: warning: pointer targets in passing argument 1 of 'bit_test_and_clear' differ in signedness
/root/Desktop/busybox/e2fsprogs/blkid/probe.c: In function 'probe_swap1':
/root/Desktop/busybox/e2fsprogs/blkid/probe.c:344: warning: pointer targets in passing argument 3 of 'blkid_set_tag' differ in signedness
/root/Desktop/busybox/e2fsprogs/blkid/probe.c: In function 'probe_ocfs':
/root/Desktop/busybox/e2fsprogs/blkid/probe.c:418: warning: pointer targets in passing argument 3 of 'blkid_set_tag' differ in signedness
/root/Desktop/busybox/e2fsprogs/blkid/probe.c:419: warning: pointer targets in passing argument 3 of 'blkid_set_tag' differ in signedness
/root/Desktop/busybox/e2fsprogs/blkid/probe.c: In function 'probe_ocfs2':
/root/Desktop/busybox/e2fsprogs/blkid/probe.c:434: warning: pointer targets in passing argument 3 of 'blkid_set_tag' differ in signedness
/root/Desktop/busybox/e2fsprogs/ext2fs/ext2fs_inline.c: In function 'ext2fs_find_first_bit_set':
/root/Desktop/busybox/e2fsprogs/ext2fs/ext2fs_inline.c:181: warning: pointer targets in initialization differ in signedness
/root/Desktop/busybox/e2fsprogs/mke2fs.c: In function 'PRS':
/root/Desktop/busybox/e2fsprogs/mke2fs.c:881: warning: pointer targets in passing argument 2 of 'safe_strtoi' differ in signedness


to:

root at localhost:/dev/pts/0:/root/Desktop/busybox# make 1> /dev/null
/root/Desktop/busybox/coreutils/uudecode.c: In function 'read_base64':
/root/Desktop/busybox/coreutils/uudecode.c:101: warning: comparison is always false due to limited range of data type
/root/Desktop/busybox/networking/traceroute.c:296: warning: 'align' attribute directive ignored
/root/Desktop/busybox/shell/ash.c: In function 'readtoken1':
/root/Desktop/busybox/shell/ash.c:10622: warning: 'saveprompt' may be used uninitialized in this function
/root/Desktop/busybox/shell/ash.c:10197: warning: 'prevsyntax' may be used uninitialized in this function
/root/Desktop/busybox/shell/lash.c: In function 'busy_loop':
/root/Desktop/busybox/shell/lash.c:1456: warning: 'inbg' may be used uninitialized in this function

So maybe this could be a solution to turn down the warnings noise.
Just a thought, more experienced people should decide if and where to add  this to the Makefiles.

Ciao,
Tito



More information about the busybox mailing list