On 7/26/20 3:10 PM, Gisle Vanem wrote:
Here's an error though:
test-dfa-match-aux.c
test-dfa-match-aux.c(39): error C2381: 'dfawarn': redefinition;
'__declspec(noreturn)' or '[[noreturn]]' differs
lib\dfa.h(125): note: see declaration of 'dfawarn'
That's a bug in MSVC. _Noreturn and 'inline' are not part of a function's type,
so the definition of a function can say '_Noreturn' even though its declaration
does not. (Admittedly it's bad style.)
-extern void dfawarn (const char *);
+extern _Noreturn void dfawarn (const char *);
That can't be right, as dfawarn typically does return.
Does the following work around the compiler bug? If not we can use stronger
medicine.
diff --git a/tests/test-dfa-match-aux.c b/tests/test-dfa-match-aux.c
index e0c5f3df4..167b0ef8b 100644
--- a/tests/test-dfa-match-aux.c
+++ b/tests/test-dfa-match-aux.c
@@ -28,6 +28,9 @@
#include "getprogname.h"
+_Noreturn void dfaerror (char const *);
+_Noreturn void dfawarn (char const *);
+
_Noreturn void
dfaerror (char const *mesg)
{