[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: undefined behaviour findings in bitset

From: Bruno Haible
Subject: Re: undefined behaviour findings in bitset
Date: Sat, 23 Mar 2019 19:54:08 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-141-generic; KDE/5.18.0; x86_64; ; )

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  <address@hidden>

        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

[Prev in Thread] Current Thread [Next in Thread]