Skip to content

Fix #8920 - m4/1.4.19: Runtime assertion windows pops up on MSVC in Debug mode #8984

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 7, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 3 additions & 0 deletions recipes/m4/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ def _configure_autotools(self):
elif self.settings.compiler == "clang":
if tools.Version(self.version) < "1.4.19":
autotools.flags.extend(["-rtlib=compiler-rt", "-Wno-unused-command-line-argument"])
if self.settings.os == 'Windows':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comparing compiler might be a better condition here, but that's fine as well

conf_args.extend(["ac_cv_func__set_invalid_parameter_handler=yes"])

autotools.configure(args=conf_args, configure_dir=self._source_subfolder, build=build_canonical_name, host=host_canonical_name)
return autotools

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
+# 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
+ _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 ();