From: Bruno Haible <bruno@clisp.org> Date: Tue, 30 Apr 2024 11:14:31 +0000 (+0200) Subject: *printf: Avoid a dialog during 'configure' with MSVC in debug mode. X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=704ccd7be0311b317c1ef6907b9afe9ededd91a1;p=gnulib.git *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. --- diff --git a/ChangeLog b/ChangeLog index 5cd01d60d0..13ee25473c 100644 --- 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. diff --git a/m4/printf.m4 b/m4/printf.m4 index 0cb14d6f00..220f37cb5e 100644 --- a/m4/printf.m4 +++ b/m4/printf.m4 @@ -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)