diff --git a/include/pocketpy/common/utils.hpp b/include/pocketpy/common/utils.hpp index 45a663ae..708c9818 100644 --- a/include/pocketpy/common/utils.hpp +++ b/include/pocketpy/common/utils.hpp @@ -25,4 +25,10 @@ inline const char* kPlatformStrings[] = { "unknown" // 6 }; +#ifdef _MSC_VER +#define PK_UNREACHABLE() __assume(0); +#else +#define PK_UNREACHABLE() __builtin_unreachable(); +#endif + } // namespace pkpy diff --git a/include/pocketpy/config.h b/include/pocketpy/config.h index c126bcad..1d9c5f51 100644 --- a/include/pocketpy/config.h +++ b/include/pocketpy/config.h @@ -68,15 +68,3 @@ #define PK_PLATFORM_SEP '/' #endif -#ifdef _MSC_VER -#pragma warning (disable:4267) -#pragma warning (disable:4100) -#pragma warning (disable:4244) -#pragma warning (disable:4996) -#endif - -#ifdef _MSC_VER -#define PK_UNREACHABLE() __assume(0); -#else -#define PK_UNREACHABLE() __builtin_unreachable(); -#endif diff --git a/src/interpreter/ceval.cpp b/src/interpreter/ceval.cpp index a1c0edbf..61f35f0c 100644 --- a/src/interpreter/ceval.cpp +++ b/src/interpreter/ceval.cpp @@ -1043,11 +1043,11 @@ __NEXT_STEP: *p = VAR(CAST(i64, *p) - 1); } DISPATCH() /*****************************************/ - default: PK_UNREACHABLE(); + default: PK_UNREACHABLE() } } /**********************************************************************/ - PK_UNREACHABLE(); + PK_UNREACHABLE() }catch(InternalException internal){ __internal_exception = internal; if(internal.type == InternalExceptionType::Unhandled){ diff --git a/src/interpreter/vm.cpp b/src/interpreter/vm.cpp index a7c15a9b..8d2096ec 100644 --- a/src/interpreter/vm.cpp +++ b/src/interpreter/vm.cpp @@ -1101,7 +1101,7 @@ PyVar VM::vectorcall(int ARGC, int KWARGC, bool op_call){ callstack.popx(), ArgsView(__vectorcall_buffer, __vectorcall_buffer + co->nlocals) ); - default: PK_UNREACHABLE(); + default: PK_UNREACHABLE() }; // simple or normal