Skip to content

Commit

Permalink
conan-io#8920 - Add a patch to call _CrtSetReportMode early in main
Browse files Browse the repository at this point in the history
  • Loading branch information
jmarrec committed Jan 19, 2022
1 parent 94e1299 commit 9c7fa44
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions recipes/m4/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ patches:
base_path: "source_subfolder"
- patch_file: "patches/1.4.19-0002-ar-lib.patch"
base_path: "source_subfolder"
- patch_file: "patches/1.4.19-0003-msvc-debug-assertion.patch"
base_path: "source_subfolder"
"1.4.18":
- patch_file: "patches/1.4.18-0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch"
base_path: "source_subfolder"
Expand Down
31 changes: 31 additions & 0 deletions recipes/m4/all/patches/1.4.19-0003-msvc-debug-assertion.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
diff --git a/src/m4.c b/src/m4.c
index 2bd57750..ca3ded62 100644
--- a/src/m4.c
+++ b/src/m4.c
@@ -36,6 +36,10 @@
# include "assert.h"
#endif

+#ifdef WIN32_NATIVE
+# include <crtdbg.h>
+#endif
+
/* TRANSLATORS: This is a non-ASCII name: The first name is (with
Unicode escapes) "Ren\u00e9" or (with HTML entities) "Ren&eacute;". */
#define AUTHORS proper_name_utf8 ("Rene' Seindal", "Ren\xC3\xA9 Seindal")
@@ -423,6 +427,15 @@ main (int argc, char *const *argv)
textdomain (PACKAGE);
atexit (close_stdin);

+#ifdef WIN32_NATIVE
+ _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE);
+ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+#endif
+
include_init ();
debug_init ();

0 comments on commit 9c7fa44

Please sign in to comment.