check_cxx_compiler_flag(-fsanitize=address HAVE_ASAN)
cmake_pop_check_state()
if(HAVE_ASAN)
+ add_compile_definitions(HAVE_ASAN)
add_compile_options(-fsanitize=address)
add_link_options(-lasan)
+ check_flag(-fsanitize-recover=address IGNORE)
endif()
endif()
check_cxx_compiler_flag(-fsanitize=undefined HAVE_UBSAN)
cmake_pop_check_state()
if(HAVE_UBSAN)
+ add_compile_definitions(HAVE_UBSAN)
add_compile_options(-fsanitize=undefined)
add_link_options(-lubsan)
+ check_flag(-fsanitize-recover=undefined IGNORE)
endif()
endif()
endif()
check_decl(MSG_NOSIGNAL sys/socket.h)
check_decl(rcvtimeo sys/socket.h)
check_decl(sndtimeo sys/socket.h)
+check_decl(setenv stdlib.h)
check_decl(strerror string.h)
check_decl(strerror_r string.h)
check_compiles(HAVE_STRERROR_R_CHAR_P "char x, y = *strerror_r(0,&x,1);" string.h)
In which case, the hash table should have hashsize(10) elements.
*/
+#if HAVE_ASAN
+__attribute__((no_sanitize("address")))
+#endif
uint32_t hashkit_jenkins(const char *key, size_t length, void *)
{
uint32_t a,b,c; /* internal state */
#cmakedefine HAVE_POLL_H 1
#cmakedefine HAVE_RCVTIMEO 1
#cmakedefine HAVE_SASL_SASL_H 1
+#cmakedefine HAVE_SETENV 1
#cmakedefine HAVE_SHARED_ENABLED 1
#cmakedefine HAVE_SNDTIMEO 1
#cmakedefine HAVE_STDDEF_H 1
class Malloced {
T *ptr;
public:
+ explicit
Malloced(T *ptr_)
: ptr{ptr_}
{}
auto operator *() {
return ptr;
}
+ auto operator ->() {
+ return ptr;
+ }
};
-#define CATCH_CONFIG_MAIN
+#define CATCH_CONFIG_RUNNER
#include "lib/catch.hpp"
+#include <cstdlib>
+
+int main(int argc, char *argv[]) {
+#if HAVE_ASAN
+# if HAVE_SETENV
+ setenv("ASAN_OPTIONS", "halt_on_error=0", 0);
+# else
+ char env[] = "ASAN_OPTIONS=halt_on_error=0";
+ putenv(env);
+# endif
+#endif
+ return Catch::Session().run(argc, argv);
+}