configure check for cast to please lint.

git-svn-id: file:///svn/unbound/trunk@213 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2007-04-03 09:17:20 +00:00
parent 5bba40f64a
commit b777a38e0d
4 changed files with 31 additions and 2 deletions

View file

@ -313,6 +313,29 @@ AC_INCLUDES_DEFAULT
#endif
])
# Check the type of struct msghdr msg_iovlen.
AC_MSG_CHECKING([sign of struct msghdr.msg_iovlen])
AC_RUN_IFELSE([
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
int main()
{
struct msghdr h;
h.msg_iovlen = -1;
if(10/h.msg_iovlen == 0) return 0; /* unsigned */
return 1; /* signed */
}
], [
# if compiled and exit status 0
cv_msgiovlen_type="unsigned" ], [
# not compiled or bad exit status
cv_msgiovlen_type="int" ],
# when cross compiling
[ cv_msgiovlen_type="int" ])
AC_MSG_RESULT($cv_msgiovlen_type)
AC_DEFINE_UNQUOTED([TYPE_MSGIOVLEN], $cv_msgiovlen_type, [Define to 'int' or type of struct msghdr.msg_iovlen.])
# Checks for libraries.
AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname],
[enable SSL (will check /usr/local/ssl

View file

@ -1,3 +1,9 @@
3 April 2007: Wouter
- detect sign of msghdr.msg_iovlen so that the cast to that type
in netevent (which is there to please lint) can be correct.
The type on several OSes ranges from int, int32, uint32, size_t.
Detects unsigned or signed using math trick.
2 April 2007: Wouter
- check sizes of udp received messages, not too short.
- review changes. Some memmoves can be memcpys: 4byte aligned.

View file

@ -123,7 +123,7 @@ for((i=0; i<${#hostname[*]}; i=$i+1)); do
SVN=yes
IP6=yes
FIXCONFIGURE=no
RUN_TEST=yes
RUN_TEST=no
LDNS=
LIBEVENT=
eval ${vars[$i]}

View file

@ -790,7 +790,7 @@ comm_point_send_reply_iov(struct comm_reply* repinfo, struct iovec* iov,
hdr.msg_name = &repinfo->addr;
hdr.msg_namelen = repinfo->addrlen;
hdr.msg_iov = iov + 1;
hdr.msg_iovlen = (typeof(hdr.msg_iovlen))(iovlen - 1);
hdr.msg_iovlen = (TYPE_MSGIOVLEN)(iovlen - 1);
hdr.msg_control = NULL;
hdr.msg_controllen = 0;
hdr.msg_flags = 0;