]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: expected: Adapt type to GCC's requirements.
authorArthur Cohen <arthur.cohen@embecosm.com>
Wed, 28 Jun 2023 14:21:05 +0000 (16:21 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:49:34 +0000 (18:49 +0100)
Disable exceptions and remove inclusion of poisoned headers.

gcc/rust/ChangeLog:

* util/expected.h: Adapt class to GCC requirements.

gcc/rust/util/expected.h

index cbefafc9481bad76cee95f51d2ee6ea329625ad6..a7ddd55a88d93a53b55068793c3f0aad50db1fe5 100644 (file)
@@ -1,3 +1,4 @@
+// clang-format off
 ///
 // expected - An implementation of std::expected with extensions
 // Written in 2017 by Sy Brand (tartanllama@gmail.com, @TartanLlama)
 #define TL_EXPECTED_VERSION_MINOR 1
 #define TL_EXPECTED_VERSION_PATCH 0
 
-#include <exception>
-#include <functional>
-#include <type_traits>
-#include <utility>
+#include "rust-system.h"
 
 #if defined(__EXCEPTIONS) || defined(_CPPUNWIND)
 #define TL_EXPECTED_EXCEPTIONS_ENABLED
@@ -215,9 +213,7 @@ template <typename E>
 #else
   (void)e;
 #ifdef _MSC_VER
-  __assume(0);
-#else
-  __builtin_unreachable();
+  gcc_unreachable();
 #endif
 #endif
 }