From: Brad King Date: Wed, 18 Nov 2009 14:15:28 +0000 (-0500) Subject: Use _CrtSetReportMode only where available X-Git-Tag: v2.8.0~142 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f7c4c640728ccad8cafbdb3a9dcb3dbee68aade;p=thirdparty%2Flibarchive.git Use _CrtSetReportMode only where available We test for this function in at CMake configuration time and store the result as a HAVE__CrtSetReportMode configuration macro. We need not perform the test for an autotools build because it supports no platform that provides the function and the macro will be undefined. SVN-Revision: 1673 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5031278a9..6c6319c6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -346,6 +346,7 @@ CHECK_FUNCTION_EXISTS(SHA512_Init HAVE_SHA512) # CHECK_SYMBOL_EXISTS(CreateHardLinkA "windows.h" HAVE_CREATEHARDLINKA) CHECK_SYMBOL_EXISTS(CreateHardLinkW "windows.h" HAVE_CREATEHARDLINKW) +CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN) CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT) diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index 4d8f24b25..ea96372ad 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -572,6 +572,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_WINDOWS_H 1 +/* Define to 1 if you have _CrtSetReportMode in */ +#cmakedefine HAVE__CrtSetReportMode 1 + /* Define to 1 if you have the `wmemcmp' function. */ #cmakedefine HAVE_WMEMCMP 1 diff --git a/cpio/test/main.c b/cpio/test/main.c index 34a52a5cc..88aa064da 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -65,9 +65,6 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient * a symptom that some capability is missing from libarchive itself. */ #if defined(_WIN32) && !defined(__CYGWIN__) -#if !defined(__GNUC__) -#include -#endif #include #include #ifndef F_OK @@ -95,6 +92,10 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient #define int64_t __int64 #endif +#if defined(HAVE__CrtSetReportMode) +# include +#endif + #if defined(_WIN32) && !defined(__CYGWIN__) void *GetFunctionKernel32(const char *name) { @@ -1826,7 +1827,7 @@ main(int argc, char **argv) (void)argc; /* UNUSED */ -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__) +#if defined(HAVE__CrtSetReportMode) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); /* Disable annoying assertion message box. */ diff --git a/libarchive/test/main.c b/libarchive/test/main.c index 47b5838db..301ce55a3 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -64,9 +64,6 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.17 2008/12/21 00:13:50 ki * a symptom that some capability is missing from libarchive itself. */ #if defined(_WIN32) && !defined(__CYGWIN__) -#if !defined(__GNUC__) -#include -#endif #include #include #ifndef F_OK @@ -94,6 +91,10 @@ __FBSDID("$FreeBSD: src/lib/libarchive/test/main.c,v 1.17 2008/12/21 00:13:50 ki #define int64_t __int64 #endif +#if defined(HAVE__CrtSetReportMode) +# include +#endif + #if defined(_WIN32) && !defined(__CYGWIN__) void *GetFunctionKernel32(const char *name) { @@ -1822,7 +1823,7 @@ main(int argc, char **argv) (void)argc; /* UNUSED */ -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__) +#if defined(HAVE__CrtSetReportMode) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); /* Disable annoying assertion message box. */ diff --git a/tar/test/main.c b/tar/test/main.c index faed3ac46..faf0ca1ba 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -65,9 +65,6 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz * a symptom that some capability is missing from libarchive itself. */ #if defined(_WIN32) && !defined(__CYGWIN__) -#if !defined(__GNUC__) -#include -#endif #include #include #ifndef F_OK @@ -96,6 +93,10 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz #define int64_t __int64 #endif +#if defined(HAVE__CrtSetReportMode) +# include +#endif + #if defined(_WIN32) && !defined(__CYGWIN__) void *GetFunctionKernel32(const char *name) { @@ -1827,7 +1828,7 @@ main(int argc, char **argv) (void)argc; /* UNUSED */ -#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__GNUC__) +#if defined(HAVE__CrtSetReportMode) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); /* Disable annoying assertion message box. */