>From 5a68b3ffd9f676668d917f06df93ca486c0f6b3e Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 27 Jul 2020 12:57:45 -0700 Subject: [PATCH] dfa-tests: port to MSVC Problem reported by Gisle Vanem in: https://lists.gnu.org/r/bug-gnulib/2020-07/msg00159.html Also, remove an unnecessary dependency on getprogname. * modules/dfa-tests (Depends-on): Remove getprogname. * tests/test-dfa-match-aux.c: Do not include getprogname.h. (exit_status): New static var. (dfawarn): Set it instead of exiting. Do not declare as _Noreturn, to pacify MSVC. (main): Return exit_status. --- ChangeLog | 13 +++++++++++++ modules/dfa-tests | 1 - tests/test-dfa-match-aux.c | 10 +++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 63138b822..d3297232f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2020-07-27 Paul Eggert + + dfa-tests: port to MSVC + Problem reported by Gisle Vanem in: + https://lists.gnu.org/r/bug-gnulib/2020-07/msg00159.html + Also, remove an unnecessary dependency on getprogname. + * modules/dfa-tests (Depends-on): Remove getprogname. + * tests/test-dfa-match-aux.c: Do not include getprogname.h. + (exit_status): New static var. + (dfawarn): Set it instead of exiting. + Do not declare as _Noreturn, to pacify MSVC. + (main): Return exit_status. + 2020-07-26 Paul Eggert argz: pacify MSVC diff --git a/modules/dfa-tests b/modules/dfa-tests index 4c447c28e..2775ccbbf 100644 --- a/modules/dfa-tests +++ b/modules/dfa-tests @@ -4,7 +4,6 @@ tests/test-dfa-match-aux.c tests/test-dfa-invalid-char-class.sh Depends-on: -getprogname stdio stdlib string diff --git a/tests/test-dfa-match-aux.c b/tests/test-dfa-match-aux.c index e0c5f3df4..21aa61308 100644 --- a/tests/test-dfa-match-aux.c +++ b/tests/test-dfa-match-aux.c @@ -26,8 +26,6 @@ #include #include -#include "getprogname.h" - _Noreturn void dfaerror (char const *mesg) { @@ -35,11 +33,13 @@ dfaerror (char const *mesg) exit (EXIT_FAILURE); } -_Noreturn void +static int exit_status = EXIT_SUCCESS; + +void dfawarn (char const *mesg) { printf ("dfawarn: %s\n", mesg); - exit (EXIT_FAILURE); + exit_status = EXIT_FAILURE; } int @@ -69,5 +69,5 @@ main (int argc, char **argv) if (p != NULL) printf ("%zd\n", p - beg); - exit (EXIT_SUCCESS); + exit (exit_status); } -- 2.17.1