]> Savannah Git Hosting - gnulib.git/commitdiff
*printf: Avoid a dialog during 'configure' with MSVC in debug mode.
authorBruno Haible <bruno@clisp.org>
Tue, 30 Apr 2024 11:14:31 +0000 (13:14 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 30 Apr 2024 11:15:10 +0000 (13:15 +0200)
Suggested by Paul Harris <harris.pc@gmail.com> in
<https://lists.gnu.org/archive/html/bug-gettext/2024-04/msg00005.html>.

* m4/printf.m4 (gl_PRINTF_DIRECTIVE_N): In the test program, include
<crtdbg.h> and disable the MSVC reporting for assertion failures.

ChangeLog
m4/printf.m4

index 5cd01d60d0bed63e89c1077595159363dbf1f8ea..13ee25473c592ccf3ccfde2579efdc9645a632b1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-04-30  Bruno Haible  <bruno@clisp.org>
+
+       *printf: Avoid a dialog during 'configure' with MSVC in debug mode.
+       Suggested by Paul Harris <harris.pc@gmail.com> in
+       <https://lists.gnu.org/archive/html/bug-gettext/2024-04/msg00005.html>.
+       * m4/printf.m4 (gl_PRINTF_DIRECTIVE_N): In the test program, include
+       <crtdbg.h> and disable the MSVC reporting for assertion failures.
+
 2024-04-30  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Remove remaining unused instance variables.
index 0cb14d6f0052dbd5fbaf262cd891299caff5bc42..220f37cb5e3d23af20863490c5c43a9a67ad3223 100644 (file)
@@ -1,5 +1,5 @@
 # printf.m4
-# serial 91
+# serial 92
 dnl Copyright (C) 2003, 2007-2024 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -896,6 +896,7 @@ AC_DEFUN([gl_PRINTF_DIRECTIVE_N],
 #include <stdlib.h>
 #include <string.h>
 #ifdef _MSC_VER
+#include <crtdbg.h>
 #include <inttypes.h>
 /* See page about "Parameter Validation" on msdn.microsoft.com.
    <https://docs.microsoft.com/en-us/cpp/c-runtime-library/parameter-validation>
@@ -922,6 +923,9 @@ int main ()
   int count = -1;
 #ifdef _MSC_VER
   _set_invalid_parameter_handler (invalid_parameter_handler);
+  /* Also avoid an Abort/Retry/Ignore dialog in debug builds.
+     <https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/crtsetreportmode>  */
+  _CrtSetReportMode (_CRT_ASSERT, 0);
 #endif
   signal (SIGABRT, abort_handler);
   /* Copy the format string.  Some systems (glibc with _FORTIFY_SOURCE=2)