Hi Akim,

> it does not work with G++ in C++98 mode: _Noreturn is not supported there.

I confirm: No g++ version I tested supported _Noreturn, neither with
-std=c++98 nor with -std=c++11.

Your patch looks good.

> Using C's _Noreturn in C++98 appears to be supported by Clang

Good point! Let me adjust the 'noreturn' module accordingly:


2019-03-23  Bruno Haible  <br...@clisp.org>

        noreturn: In C++ mode with clang, use _Noreturn as fallback.
        Reported by Akim Demaille.
        * lib/noreturn.h (_GL_NORETURN_FUNC): In C++ mode with clang, when
        [[noreturn]] would not work, use _Noreturn instead.

diff --git a/lib/noreturn.h b/lib/noreturn.h
index 3ceeaf5..57e9a88 100644
--- a/lib/noreturn.h
+++ b/lib/noreturn.h
@@ -74,6 +74,9 @@
 # if (__cplusplus >= 201103 && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
      || (_MSC_VER >= 1900)
 #  define _GL_NORETURN_FUNC [[noreturn]]
+  /* clang++ supports the _Noreturn keyword, but g++ doesn't.  */
+# elif defined __clang__
+#  define _GL_NORETURN_FUNC _Noreturn
 # else
 #  define _GL_NORETURN_FUNC /* empty */
 # endif


Reply via email to