[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Missing '_Noreturn'
From: |
Paul Eggert |
Subject: |
Re: Missing '_Noreturn' |
Date: |
Sun, 26 Jul 2020 15:41:51 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
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)
{