]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use _CrtSetReportMode only where available
authorBrad King <brad.king@kitware.com>
Wed, 18 Nov 2009 14:15:28 +0000 (09:15 -0500)
committerBrad King <brad.king@kitware.com>
Wed, 18 Nov 2009 14:15:28 +0000 (09:15 -0500)
We test for this function in <crtdbg.h> 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

CMakeLists.txt
build/cmake/config.h.in
cpio/test/main.c
libarchive/test/main.c
tar/test/main.c

index 5031278a9a16898ff13dab3c4219d73f71175500..6c6319c6e9eb0dd9e28fe0f1e1e2e99a80c2dca2 100644 (file)
@@ -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)
index 4d8f24b25c285579e73cf525fc3f0bf5be45127e..ea96372adc2883dd7842f064fbd5f8b0b1b35fb0 100644 (file)
 /* Define to 1 if you have the <windows.h> header file. */
 #cmakedefine HAVE_WINDOWS_H 1
 
+/* Define to 1 if you have _CrtSetReportMode in <crtdbg.h>  */
+#cmakedefine HAVE__CrtSetReportMode 1
+
 /* Define to 1 if you have the `wmemcmp' function. */
 #cmakedefine HAVE_WMEMCMP 1
 
index 34a52a5cc987e6a0192a466a73a5a155ca04844e..88aa064dacda390e5dba473ba74dd61f05e7d482 100644 (file)
@@ -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 <crtdbg.h>
-#endif
 #include <io.h>
 #include <windows.h>
 #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 <crtdbg.h>
+#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. */
index 47b5838dbef09ccd2a82fc7fc453e52677ef8e51..301ce55a305a7193751d62bea0d1639fd15368ff 100644 (file)
@@ -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 <crtdbg.h>
-#endif
 #include <io.h>
 #include <windows.h>
 #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 <crtdbg.h>
+#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. */
index faed3ac46c8c272f5dec9439fe69c963f0082917..faf0ca1bab3759a2cc52870f91cb633a59c6b361 100644 (file)
@@ -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 <crtdbg.h>
-#endif
 #include <io.h>
 #include <windows.h>
 #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 <crtdbg.h>
+#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. */