On 7/27/20 12:03 AM, Florian Weimer wrote:
The compiler is correct for [[noreturn]]:
| The first declaration of a function shall specify the noreturn
| attribute if any declaration of that function specifies the noreturn
| attribute.
<http://eel.is/c++draft/dcl.attr.noreturn#:attribute,noreturn>
This is a C program not a C++ program, so we should be looking at the draft for
the next C standard not the draft for the next C++ standard.
That being said, this is a murky area here (not yet standardized), and you're
right that the test should be fixed. After all, the test is supposed to be about
DFAs not _Noreturn. So I installed the attached.
Despite the Subject: line, the actual problem was an excess _Noreturn, not a
missing _Noreturn.
>From 5a68b3ffd9f676668d917f06df93ca486c0f6b3e Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
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 <egg...@cs.ucla.edu>
+
+ 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 <egg...@cs.ucla.edu>
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 <dfa.h>
#include <localeinfo.h>
-#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