Fix warning about getVertexTypeDescription reaching its end (#14806)

This commit is contained in:
1F616EMO~nya 2024-08-12 21:34:25 +08:00 committed by GitHub
parent 85e717fcd1
commit 53a50e0b0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 0 deletions

View File

@ -107,6 +107,7 @@ static const VertexType &getVertexTypeDescription(E_VERTEX_TYPE type)
return vtTangents;
default:
assert(false);
CODE_UNREACHABLE();
}
}

View File

@ -10,6 +10,22 @@
#include "ILogger.h"
#include "ITimer.h"
// CODE_UNREACHABLE(): Invokes undefined behavior for unreachable code optimization
#if defined(__cpp_lib_unreachable)
#include <utility>
#define CODE_UNREACHABLE() std::unreachable()
#elif defined(__has_builtin)
#if __has_builtin(__builtin_unreachable)
#define CODE_UNREACHABLE() __builtin_unreachable()
#endif
#elif defined(_MSC_VER)
#define CODE_UNREACHABLE() __assume(false)
#endif
#ifndef CODE_UNREACHABLE
#define CODE_UNREACHABLE() (void)0
#endif
namespace irr
{