Add extern specifier for inline functions inside C source files

This commit is contained in:
Phil Chang 2026-01-02 21:10:17 +09:00
parent 1e2135e153
commit 8d911452bc
3 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@
#include <intrin.h>
#endif
PK_INLINE int c11__bit_length(unsigned long x) {
extern PK_INLINE int c11__bit_length(unsigned long x) {
#if(defined(__clang__) || defined(__GNUC__))
return x == 0 ? 0 : (int)sizeof(unsigned long) * 8 - __builtin_clzl(x);
#elif defined(_MSC_VER)

View File

@ -11,7 +11,7 @@ py_ItemRef pk_tpfindname(py_TypeInfo* ti, py_Name name) {
return NULL;
}
PK_INLINE py_TypeInfo* pk_typeinfo(py_Type type) {
extern PK_INLINE py_TypeInfo* pk_typeinfo(py_Type type) {
#ifndef NDEBUG
int length = pk_current_vm->types.length;
if(type <= 0 || type >= length) {

View File

@ -2,16 +2,16 @@
#include "pocketpy/pocketpy.h"
#include <assert.h>
PK_INLINE void* PyObject__userdata(PyObject* self) {
extern PK_INLINE void* PyObject__userdata(PyObject* self) {
return self->flex + PK_OBJ_SLOTS_SIZE(self->slots);
}
PK_INLINE NameDict* PyObject__dict(PyObject* self) {
extern PK_INLINE NameDict* PyObject__dict(PyObject* self) {
assert(self->slots == -1);
return (NameDict*)(self->flex);
}
PK_INLINE py_TValue* PyObject__slots(PyObject* self) {
extern PK_INLINE py_TValue* PyObject__slots(PyObject* self) {
assert(self->slots >= 0);
return (py_TValue*)(self->flex);
}