From 083296bc27be80a9ef4e6c9ae998ad8c961480e5 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Tue, 13 Mar 2012 06:40:56 +0100 Subject: [PATCH 1/2] Don't do clang version detection when disabling some flags When clang 2.9 was around we hoped they'd introduce support for the normalized=id and override-init warnings by 3.0, but they haven't. We should only add the version detection back in when clang actually supports those warnings. --- configure.in | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/configure.in b/configure.in index 8739dd90..13a4ef28 100644 --- a/configure.in +++ b/configure.in @@ -680,11 +680,6 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then #error #endif])], have_clang=yes, have_clang=no) - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [ -#if !defined(__clang__) || (__clang_major__ > 2) || (__clang_major__ == 2 && __clang_minor__ > 9) -#error -#endif])], have_clang29orlower=yes, have_clang29orlower=no) - CFLAGS="$CFLAGS -W -Wfloat-equal -Wundef -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes -Wwrite-strings -Wredundant-decls -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wbad-function-cast -Wswitch-enum -Werror" CFLAGS="$CFLAGS -Wno-unused-parameter -Wstrict-aliasing" @@ -699,10 +694,8 @@ if test x$enable_gcc_warnings = xyes && test "$GCC" = "yes"; then CFLAGS="$CFLAGS -Waddress" fi - if test x$have_gcc42 = xyes && test x$have_clang29orlower = xno; then + if test x$have_gcc42 = xyes && test x$have_clang = xno; then # These warnings break gcc 4.0.2 and clang, but work on gcc 4.2 - # We only disable these for clang 2.9 and lower, in case they are - # supported in later versions. CFLAGS="$CFLAGS -Wnormalized=id -Woverride-init" fi From c2c7b39d0dbf934d183db48a44c8d16965a35026 Mon Sep 17 00:00:00 2001 From: Sebastian Hahn Date: Tue, 13 Mar 2012 08:33:06 +0100 Subject: [PATCH 2/2] Properly zero the kevent in kq_setup_kevent() Detected by clang --- kqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kqueue.c b/kqueue.c index 8276f047..51984a4e 100644 --- a/kqueue.c +++ b/kqueue.c @@ -176,7 +176,7 @@ kq_sighandler(int sig) static void kq_setup_kevent(struct kevent *out, evutil_socket_t fd, int filter, short change) { - memset(out, 0, sizeof(out)); + memset(out, 0, sizeof(struct kevent)); out->ident = fd; out->filter = filter;