Move new / delete kernel_cpp.h -> kernel_cpp.cpp

new and delete may not be defined as inline, as Clang loudly complains.
The same is true for static.
This commit is contained in:
Jonathan Schleifer 2015-11-07 18:16:23 +01:00
parent b310316956
commit 71e0324992
No known key found for this signature in database
GPG Key ID: 33E61C63EB4AE7B5
2 changed files with 57 additions and 59 deletions

View File

@ -22,65 +22,6 @@ extern const nothrow_t std::nothrow;
typedef struct {} mynothrow_t; typedef struct {} mynothrow_t;
extern const mynothrow_t mynothrow; extern const mynothrow_t mynothrow;
inline void *
operator new(size_t size) throw (std::bad_alloc)
{
// we don't actually throw any exceptions, but we have to
// keep the prototype as specified in <new>, or else GCC 3
// won't like us
return malloc(size);
}
inline void *
operator new[](size_t size) throw (std::bad_alloc)
{
return malloc(size);
}
inline void *
operator new(size_t size, const std::nothrow_t &) throw ()
{
return malloc(size);
}
inline void *
operator new[](size_t size, const std::nothrow_t &) throw ()
{
return malloc(size);
}
inline void *
operator new(size_t size, const mynothrow_t &) throw ()
{
return malloc(size);
}
inline void *
operator new[](size_t size, const mynothrow_t &) throw ()
{
return malloc(size);
}
inline void
operator delete(void *ptr) throw ()
{
free(ptr);
}
inline void
operator delete[](void *ptr) throw ()
{
free(ptr);
}
#endif // #if _KERNEL_MODE #endif // #if _KERNEL_MODE
#endif // __cplusplus #endif // __cplusplus

View File

@ -73,6 +73,63 @@ __cxa_finalize(void* dsoHandle)
// full C++ support in the kernel // full C++ support in the kernel
#if (defined(_KERNEL_MODE) || defined(_LOADER_MODE)) #if (defined(_KERNEL_MODE) || defined(_LOADER_MODE))
void *
operator new(size_t size) throw (std::bad_alloc)
{
// we don't actually throw any exceptions, but we have to
// keep the prototype as specified in <new>, or else GCC 3
// won't like us
return malloc(size);
}
void *
operator new[](size_t size) throw (std::bad_alloc)
{
return malloc(size);
}
void *
operator new(size_t size, const std::nothrow_t &) throw ()
{
return malloc(size);
}
void *
operator new[](size_t size, const std::nothrow_t &) throw ()
{
return malloc(size);
}
void *
operator new(size_t size, const mynothrow_t &) throw ()
{
return malloc(size);
}
void *
operator new[](size_t size, const mynothrow_t &) throw ()
{
return malloc(size);
}
void
operator delete(void *ptr) throw ()
{
free(ptr);
}
void
operator delete[](void *ptr) throw ()
{
free(ptr);
}
#ifndef _BOOT_MODE #ifndef _BOOT_MODE