Unreachable.h 398 B

12345678910111213141516171819202122
  1. // Copyright 2024 Dolphin Emulator Project
  2. // SPDX-License-Identifier: GPL-2.0-or-later
  3. #pragma once
  4. #include "Common/CommonFuncs.h"
  5. namespace Common
  6. {
  7. // TODO C++23: Replace with std::unreachable.
  8. [[noreturn]] inline void Unreachable()
  9. {
  10. #ifdef _DEBUG
  11. Crash();
  12. #elif defined(_MSC_VER) && !defined(__clang__)
  13. __assume(false);
  14. #else
  15. __builtin_unreachable();
  16. #endif
  17. }
  18. } // namespace Common