From: Brian Aker Date: Mon, 11 Feb 2013 10:58:01 +0000 (-0800) Subject: Update m4 files from ddm4, and fix clang warning. X-Git-Tag: 1.0.17~6^2~12 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=23f331ecde61c5bf7a712fb0e9121f655c860d3c;p=awesomized%2Flibmemcached Update m4 files from ddm4, and fix clang warning. --- diff --git a/m4/ax_harden_compiler_flags.m4 b/m4/ax_harden_compiler_flags.m4 index b31518aa..c2a0d541 100644 --- a/m4/ax_harden_compiler_flags.m4 +++ b/m4/ax_harden_compiler_flags.m4 @@ -1,3 +1,4 @@ +# vim:expandtab:shiftwidth=2:tabstop=2:smarttab: # =========================================================================== # https://github.com/BrianAker/ddm4/ # =========================================================================== @@ -52,7 +53,7 @@ # ? _APPEND_COMPILE_FLAGS_ERROR([-Wlong-long]) -- Don't turn on for # compatibility issues memcached_stat_st -#serial 7 +#serial 8 AC_DEFUN([_WARNINGS_AS_ERRORS], [AC_CACHE_CHECK([if all warnings into errors],[ac_cv_warnings_as_errors], @@ -75,10 +76,12 @@ AC_DEFUN([_APPEND_COMPILE_FLAGS_ERROR], # Everything above this does the heavy lifting, while what follows does the specifics. AC_DEFUN([_HARDEN_LINKER_FLAGS], - [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) - #_APPEND_LINK_FLAGS_ERROR([-pie]) - AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], - [AX_APPEND_LINK_FLAGS([-Werror])]) + [ + AS_IF([test "$CC" != "clang"], + [_APPEND_LINK_FLAGS_ERROR([-z relro -z now]) +#_APPEND_LINK_FLAGS_ERROR([-pie]) + AS_IF([test "x$ac_cv_warnings_as_errors" = xyes], + [AX_APPEND_LINK_FLAGS([-Werror])])]) ]) AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], @@ -86,6 +89,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], AS_IF([test "x$ax_enable_debug" = xyes], [CFLAGS='' + _APPEND_COMPILE_FLAGS_ERROR([-H]) _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O0])], @@ -93,19 +97,26 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-O2])]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])], - [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) + [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) + _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], + [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) + _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) + + AS_IF([test "$CC" = "clang"], + [_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])]) _APPEND_COMPILE_FLAGS_ERROR([-Wall]) _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) - _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail]) _APPEND_COMPILE_FLAGS_ERROR([-std=c99]) # Anything below this comment please keep sorted. - _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1]) # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunsuffixed-float-constants]) + _APPEND_COMPILE_FLAGS_ERROR([-Wjump-misses-init]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes]) _APPEND_COMPILE_FLAGS_ERROR([-Waddress]) + _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs]) _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds]) _APPEND_COMPILE_FLAGS_ERROR([-Wbad-function-cast]) # Not in use -Wc++-compat @@ -114,6 +125,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2]) + _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k]) _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op]) _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized]) _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers]) @@ -140,10 +152,36 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1]) _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-prototypes]) _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum]) + _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines]) _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) + _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) + _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs]) _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings]) _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all]) _APPEND_COMPILE_FLAGS_ERROR([-fwrapv]) @@ -157,6 +195,7 @@ AC_DEFUN([_HARDEN_CC_COMPILER_FLAGS], [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) + #_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1]) _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) ])])])]) @@ -172,6 +211,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], AS_IF([test "x$ax_enable_debug" = xyes], [CXXFLAGS='' + _APPEND_COMPILE_FLAGS_ERROR([-H]) _APPEND_COMPILE_FLAGS_ERROR([-ggdb]) _APPEND_COMPILE_FLAGS_ERROR([-g]) _APPEND_COMPILE_FLAGS_ERROR([-O0])], @@ -179,17 +219,22 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-O2])]) AS_IF([test "x$ac_cv_vcs_checkout" = xyes], - [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check])], - [_APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) + [_APPEND_COMPILE_FLAGS_ERROR([-fstack-check]) + _APPEND_COMPILE_FLAGS_ERROR([-Wpragmas]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas])], + [_APPEND_COMPILE_FLAGS_ERROR([-Wno-unknown-pragmas]) + _APPEND_COMPILE_FLAGS_ERROR([-Wno-pragmas])]) + + AS_IF([test "$CXX" = "clang++"], + [_APPEND_COMPILE_FLAGS_ERROR([-Qunused-arguments])]) _APPEND_COMPILE_FLAGS_ERROR([-Wall]) _APPEND_COMPILE_FLAGS_ERROR([-Wextra]) - _APPEND_COMPILE_FLAGS_ERROR([-Wunknown-pragmas]) _APPEND_COMPILE_FLAGS_ERROR([-Wthis-test-should-fail]) # Anything below this comment please keep sorted. - _APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1]) # _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-format-attribute]) _APPEND_COMPILE_FLAGS_ERROR([-Wno-attributes]) + _APPEND_COMPILE_FLAGS_ERROR([-Wvarargs]) _APPEND_COMPILE_FLAGS_ERROR([-Waddress]) _APPEND_COMPILE_FLAGS_ERROR([-Warray-bounds]) _APPEND_COMPILE_FLAGS_ERROR([-Wchar-subscripts]) @@ -197,6 +242,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wctor-dtor-privacy]) _APPEND_COMPILE_FLAGS_ERROR([-Wfloat-equal]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat=2]) + _APPEND_COMPILE_FLAGS_ERROR([-Wformat-y2k]) _APPEND_COMPILE_FLAGS_ERROR([-Wmaybe-uninitialized]) _APPEND_COMPILE_FLAGS_ERROR([-Wmissing-field-initializers]) _APPEND_COMPILE_FLAGS_ERROR([-Wlogical-op]) @@ -217,11 +263,39 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], _APPEND_COMPILE_FLAGS_ERROR([-Wsign-compare]) _APPEND_COMPILE_FLAGS_ERROR([-Wstrict-overflow=1]) _APPEND_COMPILE_FLAGS_ERROR([-Wswitch-enum]) + _APPEND_COMPILE_FLAGS_ERROR([-Wtrampolines]) _APPEND_COMPILE_FLAGS_ERROR([-Wundef]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunsafe-loop-optimizations]) + _APPEND_COMPILE_FLAGS_ERROR([-funsafe-loop-optimizations]) _APPEND_COMPILE_FLAGS_ERROR([-Wc++11-compat]) + _APPEND_COMPILE_FLAGS_ERROR([-Weffc++]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=address]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=thread]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=memory]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=alignment]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bool]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=bounds]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=enum]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-cast-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=float-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=integer-divide-by-zero]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=null]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=object-size]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=return]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=shift]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=signed-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unreachable]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=unsigned-integer-overflow]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vla-bound]) + _APPEND_COMPILE_FLAGS_ERROR([-fsanitize=vptr]) + _APPEND_COMPILE_FLAGS_ERROR([-Wold-style-cast]) + _APPEND_COMPILE_FLAGS_ERROR([-Wclobbered]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-result]) _APPEND_COMPILE_FLAGS_ERROR([-Wunused-variable]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-parameter]) + _APPEND_COMPILE_FLAGS_ERROR([-Wunused-local-typedefs]) _APPEND_COMPILE_FLAGS_ERROR([-Wwrite-strings]) _APPEND_COMPILE_FLAGS_ERROR([-Wformat-security]) _APPEND_COMPILE_FLAGS_ERROR([-floop-parallelize-all]) @@ -236,6 +310,7 @@ AC_DEFUN([_HARDEN_CXX_COMPILER_FLAGS], [_APPEND_COMPILE_FLAGS_ERROR([-D_FORTIFY_SOURCE=2]) #_APPEND_COMPILE_FLAGS_ERROR([-Wstack-protector]) #_APPEND_COMPILE_FLAGS_ERROR([-fstack-protector]) + #_APPEND_COMPILE_FLAGS_ERROR([--param=ssp-buffer-size=1]) _APPEND_COMPILE_FLAGS_ERROR([-fstack-protector-all]) ])])])]) diff --git a/m4/ax_libevent.m4 b/m4/ax_libevent.m4 index 686bff23..c576bad5 100644 --- a/m4/ax_libevent.m4 +++ b/m4/ax_libevent.m4 @@ -20,7 +20,7 @@ # and this notice are preserved. This file is offered as-is, without any # warranty. -#serial 4 +#serial 5 AC_DEFUN([AX_LIBEVENT], [AC_PREREQ([2.63])dnl @@ -28,15 +28,15 @@ AC_DEFUN([AX_LIBEVENT], [AX_SAVE_FLAGS LIBS="-levent $LIBS" AC_LANG_PUSH([C]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include - ],[ + ]],[[ struct event_base *tmp_event= event_init(); event_base_free(tmp_event); - ])], + ]])], [ax_cv_libevent=yes], [ax_cv_libevent=no], [AC_MSG_WARN([test program execution failed])]) @@ -62,15 +62,15 @@ AC_DEFUN([AX_LIBEVENT2], [AX_SAVE_FLAGS LIBS="-levent $LIBS" AC_LANG_PUSH([C]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include - ],[ - struct event_base *tmp_event= event_init(); - event_base_free(tmp_event); - ])], + ]],[[ + struct event_base *___event_base= event_base_new(); + event_base_free(___event_base); + ]])], [ax_cv_libevent2=yes], [ax_cv_libevent2=no], [AC_MSG_WARN([test program execution failed])]) @@ -97,16 +97,18 @@ AC_DEFUN([AX_LIBEVENT2_EVHTTP], [AX_SAVE_FLAGS LIBS="-levent $LIBS" AC_LANG_PUSH([C]) - AC_RUN_IFELSE([AC_LANG_PROGRAM([ + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ #include #include #include #include #include - ],[ - struct event_base *libbase= event_base_new(); - struct evhttp *libsrvr= evhttp_new(libbase); - ])], + ]],[[ + struct event_base *___event_base= event_base_new(); + struct evhttp *___evhttp= evhttp_new(___event_base); + evhttp_free(___evhttp); + event_base_free(___event_base); + ]])], [ax_cv_libevent2_evhttp=yes], [ax_cv_libevent2_evhttp=no], [AC_MSG_WARN([test program execution failed])]) diff --git a/tests/mem_udp.cc b/tests/mem_udp.cc index d5924471..732773d7 100644 --- a/tests/mem_udp.cc +++ b/tests/mem_udp.cc @@ -483,7 +483,7 @@ static test_return_t udp_get_test(memcached_st *memc) size_t vlen; Expected expected_ids; get_udp_request_ids(memc, expected_ids); - test_null(memcached_get(memc, test_literal_param("foo"), &vlen, (uint32_t)0, &rc)); + test_null(memcached_get(memc, test_literal_param("foo"), &vlen, NULL, &rc)); test_compare(MEMCACHED_NOT_SUPPORTED, rc); return post_udp_op_check(memc, expected_ids);