mirror of
https://github.com/SpartanJ/eepp.git
synced 2026-10-03 03:31:04 +03:00
Fixed both CI issues.
- MSVC:
- Removed lambda-based eeNew expansion in favor of typed MemoryManager::trackNew().
- Added macro expansion indirection.
- Enabled MSVC’s conforming preprocessor with /Zc:preprocessor across Premake 4/5 static libraries, shared libraries, and executables.
- Verified generated VS2022 projects contain the flag, including eterm-static and eepp-maps-static.
- Added explicit standard-library includes to memorymanagerglobal.cpp.
- Linux/macOS release tests:
- MemoryManager.tracesPlainNew is now compiled only with EE_MEMORY_MANAGER, since global tracing is intentionally debug-only.
Added new plan to improve PropertyIdSet.
This commit is contained in:
@@ -6,9 +6,7 @@
|
||||
#include <cstring>
|
||||
#include <eepp/config.hpp>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
namespace EE {
|
||||
|
||||
@@ -73,12 +71,9 @@ class EE_API MemoryManager {
|
||||
|
||||
static void freeGlobal( void* ptr ) noexcept;
|
||||
|
||||
template <typename Factory>
|
||||
static auto create( Factory&& factory, const char* file, int line ) -> decltype( factory() ) {
|
||||
auto* pointer = std::forward<Factory>( factory )();
|
||||
using Type = typename std::remove_pointer<decltype( pointer )>::type;
|
||||
return static_cast<Type*>(
|
||||
addPointer( AllocatedPointer( pointer, file, line, sizeof( Type ) ) ) );
|
||||
template <typename T> static T* trackNew( T* pointer, const char* file, int line ) {
|
||||
return static_cast<T*>(
|
||||
addPointer( AllocatedPointer( pointer, file, line, sizeof( T ) ) ) );
|
||||
}
|
||||
|
||||
static size_t getPeakMemoryUsage();
|
||||
@@ -95,14 +90,17 @@ class EE_API MemoryManager {
|
||||
|
||||
#ifdef EE_MEMORY_MANAGER
|
||||
#define eeNewExpression( constructor ) \
|
||||
EE::MemoryManager::create( [&]() { return new constructor; }, __FILE__, __LINE__ )
|
||||
EE::MemoryManager::trackNew( new constructor, __FILE__, __LINE__ )
|
||||
|
||||
#define eeNewLegacy( classType, constructor ) \
|
||||
EE::MemoryManager::create( [&]() { return new classType constructor; }, __FILE__, __LINE__ )
|
||||
EE::MemoryManager::trackNew( new classType constructor, __FILE__, __LINE__ )
|
||||
|
||||
#define eeNewSelect( _1, _2, NAME, ... ) NAME
|
||||
|
||||
#define eeNew( ... ) eeNewSelect( __VA_ARGS__, eeNewLegacy, eeNewExpression )( __VA_ARGS__ )
|
||||
#define eeNewExpand( expression ) expression
|
||||
|
||||
#define eeNew( ... ) \
|
||||
eeNewExpand( eeNewSelect( __VA_ARGS__, eeNewLegacy, eeNewExpression )( __VA_ARGS__ ) )
|
||||
|
||||
#define eeNewTracked( classType, constructor ) \
|
||||
(classType*)EE::MemoryManager::addPointer( EE::AllocatedPointer( \
|
||||
@@ -168,7 +166,10 @@ class EE_API MemoryManager {
|
||||
|
||||
#define eeNewSelect( _1, _2, NAME, ... ) NAME
|
||||
|
||||
#define eeNew( ... ) eeNewSelect( __VA_ARGS__, eeNewLegacy, eeNewExpression )( __VA_ARGS__ )
|
||||
#define eeNewExpand( expression ) expression
|
||||
|
||||
#define eeNew( ... ) \
|
||||
eeNewExpand( eeNewSelect( __VA_ARGS__, eeNewLegacy, eeNewExpression )( __VA_ARGS__ ) )
|
||||
|
||||
#define eeNewInPlace( place, classType, constructor ) new place classType constructor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user