From 34b6dbb743654fdb6edccf101c4da7e671b7a92d Mon Sep 17 00:00:00 2001 From: Sam Varshavchik Date: Mon, 17 May 2021 22:48:17 -0400 Subject: Tolerate -Wall and -Werror Fixes to configure scripts and code so that it compiles (hopefully correctly) with -Wall and -Werror. Remove support for ancient BSD stricmp and strnicmp functions. AC_CHECK_FUNC does not work for strcasecmp and strncasecmp under -Wall, it's simpler to remove it. --- rfc1035/configure.ac | 26 ++++++++++++-------------- rfc1035/rfc1035str.c | 18 ++++++------------ 2 files changed, 18 insertions(+), 26 deletions(-) (limited to 'rfc1035') diff --git a/rfc1035/configure.ac b/rfc1035/configure.ac index 5748f05..ca692c9 100644 --- a/rfc1035/configure.ac +++ b/rfc1035/configure.ac @@ -32,7 +32,7 @@ then fi dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(sys/types.h sys/time.h unistd.h arpa/inet.h netinet/in.h) +AC_CHECK_HEADERS(sys/types.h sys/time.h unistd.h arpa/inet.h netinet/in.h strings.h) USENSL=no saveLIBS="$LIBS" @@ -89,7 +89,7 @@ AC_ARG_WITH(int32, #include #endif ],[ - uint32_t i=0; + (void)(uint32_t)0; ], [ AC_MSG_RESULT(yes) ; int32="uint32_t"], [ AC_MSG_RESULT(no) @@ -100,7 +100,7 @@ AC_ARG_WITH(int32, #include #endif ],[ - u_int32_t i=0; + (void)(u_int32_t)0; ], [AC_MSG_RESULT(yes); int32="u_int32_t"],[ AC_MSG_RESULT(no) @@ -140,7 +140,7 @@ AC_ARG_WITH(int16, #include #endif ],[ - uint16_t i=0; + (void)(uint16_t)0; ], [ AC_MSG_RESULT(yes) ; int16="uint16_t"], [ AC_MSG_RESULT(no) @@ -151,7 +151,7 @@ AC_ARG_WITH(int16, #include #endif ],[ - u_int16_t i=0; + (void)(u_int16_t)0; ], [AC_MSG_RESULT(yes); int16="u_int16_t"],[ AC_MSG_RESULT(no) @@ -206,8 +206,6 @@ fi dnl Checks for library functions. -AC_CHECK_FUNCS(strcasecmp) - dnl Other checks if test "$GCC" = "yes" @@ -229,10 +227,10 @@ AC_TRY_COMPILE( [ #include ], [ -struct in6_addr in6a; -struct sockaddr_in6 sain6; -struct sockaddr_storage soas; -int x=PF_INET6; + (void)(sizeof(struct in6_addr)+ + sizeof(struct sockaddr_in6)+ + sizeof(struct sockaddr_storage)+ + PF_INET6); ], rfc1035_cv_hasipv6structs=yes, rfc1035_cv_hasipv6structs=no ) @@ -346,17 +344,17 @@ then fi AC_CACHE_CHECK([for alloca], - rfc1035_cv_alloca, + [rfc1035_cv_alloca], AC_TRY_COMPILE( [ #include #include ], [ -char *p=(char *)alloca(10); +(void)(char *)alloca(10); ], rfc1035_cv_alloca=yes, - rfc1035_cv_alloca,=no ) + rfc1035_cv_alloca=no ) ) ipv6=0 diff --git a/rfc1035/rfc1035str.c b/rfc1035/rfc1035str.c index 4335369..a010250 100644 --- a/rfc1035/rfc1035str.c +++ b/rfc1035/rfc1035str.c @@ -52,12 +52,6 @@ static struct { const char *name; int num; } typetab[]={ {"UNIMPLEMENTED", 4}, {"REFUSED", 5}}; -#if HAVE_STRCASECMP -#define COMPARE(a,b) strcasecmp((a), (b)) -#else -#define COMPARE(a,b) stricmp((a), (b)) -#endif - void rfc1035_type_itostr(int n, void (*func)(const char *, void *), void *arg) { unsigned i; @@ -82,7 +76,7 @@ int rfc1035_type_strtoi(const char *n) unsigned i; for (i=0; i