mirror of
https://github.com/Ed94/gencpp.git
synced 2025-07-06 13:45:44 -07:00
Added support for predefining preprocessor defines before parsing strings of code.
This prevents issues for preprocessor defines not getting treated properly for specific circumstances (such as macro wrappers for specifiers).
This commit is contained in:
@ -289,6 +289,9 @@ void init()
|
||||
GEN_FATAL( "gen::init: Failed to initialize the StringCache");
|
||||
}
|
||||
|
||||
// Preprocessor Defines
|
||||
PreprocessorDefines = Array<StringCached>::init_reserve( GlobalAllocator, kilobytes(1) );
|
||||
|
||||
define_constants();
|
||||
parser::init();
|
||||
}
|
||||
@ -332,6 +335,8 @@ void deinit()
|
||||
}
|
||||
while ( left--, left );
|
||||
|
||||
PreprocessorDefines.free();
|
||||
|
||||
Global_AllocatorBuckets.free();
|
||||
parser::deinit();
|
||||
}
|
||||
@ -418,18 +423,18 @@ Code make_code()
|
||||
}
|
||||
|
||||
Code result { rcast( AST*, alloc( * allocator, sizeof(AST) )) };
|
||||
// mem_set( result.ast, 0, sizeof(AST) );
|
||||
result->Type = ECode::Invalid;
|
||||
mem_set( result.ast, 0, sizeof(AST) );
|
||||
// result->Type = ECode::Invalid;
|
||||
|
||||
result->Content = { nullptr };
|
||||
result->Prev = { nullptr };
|
||||
result->Next = { nullptr };
|
||||
result->Token = nullptr;
|
||||
result->Parent = { nullptr };
|
||||
result->Name = { nullptr };
|
||||
result->Type = ECode::Invalid;
|
||||
result->ModuleFlags = ModuleFlag::Invalid;
|
||||
result->NumEntries = 0;
|
||||
// result->Content = { nullptr };
|
||||
// result->Prev = { nullptr };
|
||||
// result->Next = { nullptr };
|
||||
// result->Token = nullptr;
|
||||
// result->Parent = { nullptr };
|
||||
// result->Name = { nullptr };
|
||||
// result->Type = ECode::Invalid;
|
||||
// result->ModuleFlags = ModuleFlag::Invalid;
|
||||
// result->NumEntries = 0;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user