From 601c1029cea62fa0722c976f7096c89abd6c4795 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Wed, 8 Jan 2025 16:58:39 +0800 Subject: [PATCH] move `static_assert` --- include/pocketpy/objects/base.h | 10 ---------- src/public/internal.c | 5 +++++ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/include/pocketpy/objects/base.h b/include/pocketpy/objects/base.h index 740ae22f..3df4fc0e 100644 --- a/include/pocketpy/objects/base.h +++ b/include/pocketpy/objects/base.h @@ -1,10 +1,5 @@ #pragma once -#include -#include -#include - -#include "pocketpy/common/utils.h" #include "pocketpy/pocketpy.h" typedef struct PyObject PyObject; @@ -26,8 +21,3 @@ typedef struct py_TValue { c11_vec2i _vec2i; }; } py_TValue; - -// 16 bytes to make py_arg() macro work -static_assert(sizeof(py_CFunction) <= 8, "sizeof(py_CFunction) > 8"); -static_assert(sizeof(py_TValue) == 16, "sizeof(py_TValue) != 16"); -static_assert(offsetof(py_TValue, extra) == 4, "offsetof(py_TValue, extra) != 4"); \ No newline at end of file diff --git a/src/public/internal.c b/src/public/internal.c index 66c35074..538e8f91 100644 --- a/src/public/internal.c +++ b/src/public/internal.c @@ -22,6 +22,11 @@ void py_initialize() { bool is_little_endian = *(char*)&x == 1; if(!is_little_endian) c11__abort("is_little_endian != true"); + // check py_TValue; 16 bytes to make py_arg() macro work + static_assert(sizeof(py_CFunction) <= 8, "sizeof(py_CFunction) > 8"); + static_assert(sizeof(py_TValue) == 16, "sizeof(py_TValue) != 16"); + static_assert(offsetof(py_TValue, extra) == 4, "offsetof(py_TValue, extra) != 4"); + MemoryPools__initialize(); py_Name__initialize();