OpenDMARC icon indicating copy to clipboard operation
OpenDMARC copied to clipboard

Many occurences of -Wpointer-sign warning with clang under FreeBSD

Open thegushi opened this issue 4 years ago • 5 comments

Modern versions of clang through this warning. A full make clean/make is attached.

opendmarcbuild.txt

One example:

opendmarc-check.c:95:40: warning: passing 'char [10]' to parameter of type 'u_char *' (aka 'unsigned char *') converts between pointers to integer types with different sign [-Wpointer-sign]
        dmarc = opendmarc_policy_connect_init(LOCALHOST, FALSE);
                                              ^~~~~~~~~
opendmarc-check.c:33:19: note: expanded from macro 'LOCALHOST'
#define LOCALHOST       "127.0.0.1"
                        ^~~~~~~~~~~
./../libopendmarc/dmarc.h:113:56: note: passing argument to parameter 'ip_addr' here
DMARC_POLICY_T * opendmarc_policy_connect_init(u_char *ip_addr, int ip_type);
                                                       ^

thegushi avatar Mar 08 '21 21:03 thegushi

For reference:

FreeBSD poudriere.foo.org 12.2-STABLE FreeBSD 12.2-STABLE stable/12-n1-2655a711d GENERIC  amd64

thegushi avatar Mar 08 '21 21:03 thegushi

My C is not strong enough to know the issues this could introduce -- it's defintiely more consistent across the board, but I don't have visibility as to why there is a reason char and unsigned char were used where they were. Need advice from @mskucherawy here.

thegushi avatar Mar 12 '21 04:03 thegushi

Try this:

sed -i 's/gcc /clang /' configure.ac

hdatma avatar Mar 13 '21 10:03 hdatma

Here's the ouput from building the develop branch c73fdd3 on CentOS 8.3 with gcc9 which also shows many -Wpointer-sign warnings. opendmarc_develop_branch_on_EL8_gcc9.txt

plaimbock avatar Mar 18 '21 21:03 plaimbock

Cleaning these up is going to be work and going to require a full walk of the code. I'm targeting this for 1.5.0. 1.4.0 has active CVE's in it that make us want to get a 1.4.1 out soon. But the cleanup will happen before -next.

thegushi avatar Mar 19 '21 04:03 thegushi