mirror of
https://github.com/Ed94/Odin.git
synced 2026-06-13 01:21:38 -07:00
Adjusted gencpp for odin's codebase
This commit is contained in:
+47
-35
@@ -82,8 +82,8 @@ global CodeSpecifiers spec_constexpr;
|
||||
global CodeSpecifiers spec_constinit;
|
||||
global CodeSpecifiers spec_extern_linkage;
|
||||
global CodeSpecifiers spec_final;
|
||||
global CodeSpecifiers spec_FORCEINLINE;
|
||||
global CodeSpecifiers spec_global;
|
||||
global CodeSpecifiers spec_gb_inline;
|
||||
global CodeSpecifiers spec_gb_global;
|
||||
global CodeSpecifiers spec_inline;
|
||||
global CodeSpecifiers spec_internal_linkage;
|
||||
global CodeSpecifiers spec_local_persist;
|
||||
@@ -97,7 +97,7 @@ global CodeSpecifiers spec_ref;
|
||||
global CodeSpecifiers spec_register;
|
||||
global CodeSpecifiers spec_rvalue;
|
||||
global CodeSpecifiers spec_static_member;
|
||||
global CodeSpecifiers spec_thread_local;
|
||||
global CodeSpecifiers spec_gb_thread_local;
|
||||
global CodeSpecifiers spec_virtual;
|
||||
global CodeSpecifiers spec_volatile;
|
||||
|
||||
@@ -1522,6 +1522,13 @@ void CodeBody::to_string( String& result )
|
||||
while ( left-- )
|
||||
{
|
||||
result.append_fmt( "%S", curr.to_string() );
|
||||
|
||||
if (left > 1) switch (ast->Type)
|
||||
{
|
||||
case ECode::Enum_Body:
|
||||
case ECode::Union_Body:
|
||||
result.append("\n");
|
||||
}
|
||||
++curr;
|
||||
}
|
||||
}
|
||||
@@ -2717,7 +2724,7 @@ void CodeVar::to_string( String& result )
|
||||
|
||||
result.append( ast->Name );
|
||||
|
||||
if ( ast->ValueType->ArrExpr )
|
||||
if ( ast->ValueType && ast->ValueType->ArrExpr )
|
||||
{
|
||||
result.append_fmt( "[ %S ]", ast->ValueType->ArrExpr.to_string() );
|
||||
|
||||
@@ -2995,13 +3002,9 @@ internal void define_constants()
|
||||
spec_##Type_ = def_specifiers( num_args( __VA_ARGS__ ), __VA_ARGS__ ); \
|
||||
spec_##Type_.set_global();
|
||||
|
||||
#pragma push_macro( "FORCEINLINE" )
|
||||
#pragma push_macro( "global" )
|
||||
#pragma push_macro( "internal" )
|
||||
#pragma push_macro( "local_persist" )
|
||||
#pragma push_macro( "neverinline" )
|
||||
#undef FORCEINLINE
|
||||
#undef global
|
||||
#undef internal
|
||||
#undef local_persist
|
||||
#undef neverinline
|
||||
@@ -3011,8 +3014,8 @@ internal void define_constants()
|
||||
def_constant_spec( constinit, ESpecifier::Constinit );
|
||||
def_constant_spec( extern_linkage, ESpecifier::External_Linkage );
|
||||
def_constant_spec( final, ESpecifier::Final );
|
||||
def_constant_spec( FORCEINLINE, ESpecifier::ForceInline );
|
||||
def_constant_spec( global, ESpecifier::Global );
|
||||
def_constant_spec( gb_inline, ESpecifier::gb_inline );
|
||||
def_constant_spec( gb_global, ESpecifier::gb_global );
|
||||
def_constant_spec( inline, ESpecifier::Inline );
|
||||
def_constant_spec( internal_linkage, ESpecifier::Internal_Linkage );
|
||||
def_constant_spec( local_persist, ESpecifier::Local_Persist );
|
||||
@@ -3025,15 +3028,13 @@ internal void define_constants()
|
||||
def_constant_spec( register, ESpecifier::Register );
|
||||
def_constant_spec( rvalue, ESpecifier::RValue );
|
||||
def_constant_spec( static_member, ESpecifier::Static );
|
||||
def_constant_spec( thread_local, ESpecifier::Thread_Local );
|
||||
def_constant_spec( gb_thread_local, ESpecifier::gb_thread_local );
|
||||
def_constant_spec( virtual, ESpecifier::Virtual );
|
||||
def_constant_spec( volatile, ESpecifier::Volatile )
|
||||
|
||||
spec_local_persist = def_specifiers( 1, ESpecifier::Local_Persist );
|
||||
spec_local_persist.set_global();
|
||||
|
||||
#pragma pop_macro( "FORCEINLINE" )
|
||||
#pragma pop_macro( "global" )
|
||||
#pragma pop_macro( "internal" )
|
||||
#pragma pop_macro( "local_persist" )
|
||||
#pragma pop_macro( "neverinline" )
|
||||
@@ -5736,8 +5737,8 @@ namespace parser
|
||||
Spec_Explicit,
|
||||
Spec_Extern,
|
||||
Spec_Final,
|
||||
Spec_ForceInline,
|
||||
Spec_Global,
|
||||
Spec_gb_inline,
|
||||
Spec_gb_global,
|
||||
Spec_Inline,
|
||||
Spec_Internal_Linkage,
|
||||
Spec_LocalPersist,
|
||||
@@ -5745,7 +5746,7 @@ namespace parser
|
||||
Spec_NeverInline,
|
||||
Spec_Override,
|
||||
Spec_Static,
|
||||
Spec_ThreadLocal,
|
||||
Spec_gb_thread_local,
|
||||
Spec_Volatile,
|
||||
Spec_Virtual,
|
||||
Star,
|
||||
@@ -5840,8 +5841,8 @@ namespace parser
|
||||
{ sizeof( "explicit" ), "explicit" },
|
||||
{ sizeof( "extern" ), "extern" },
|
||||
{ sizeof( "final" ), "final" },
|
||||
{ sizeof( "FORCEINLINE" ), "FORCEINLINE" },
|
||||
{ sizeof( "global" ), "global" },
|
||||
{ sizeof( "gb_inline" ), "gb_inline" },
|
||||
{ sizeof( "gb_global" ), "gb_global" },
|
||||
{ sizeof( "inline" ), "inline" },
|
||||
{ sizeof( "internal" ), "internal" },
|
||||
{ sizeof( "local_persist" ), "local_persist" },
|
||||
@@ -5849,7 +5850,7 @@ namespace parser
|
||||
{ sizeof( "neverinline" ), "neverinline" },
|
||||
{ sizeof( "override" ), "override" },
|
||||
{ sizeof( "static" ), "static" },
|
||||
{ sizeof( "thread_local" ), "thread_local" },
|
||||
{ sizeof( "gb_thread_local" ), "gb_thread_local" },
|
||||
{ sizeof( "volatile" ), "volatile" },
|
||||
{ sizeof( "virtual" ), "virtual" },
|
||||
{ sizeof( "*" ), "*" },
|
||||
@@ -8081,7 +8082,7 @@ namespace parser
|
||||
case TokType::Spec_Constexpr :
|
||||
case TokType::Spec_Constinit :
|
||||
case TokType::Spec_Explicit :
|
||||
case TokType::Spec_ForceInline :
|
||||
case TokType::Spec_gb_inline :
|
||||
case TokType::Spec_Inline :
|
||||
case TokType::Spec_Mutable :
|
||||
case TokType::Spec_NeverInline :
|
||||
@@ -8104,7 +8105,7 @@ namespace parser
|
||||
case ESpecifier::Constinit :
|
||||
case ESpecifier::Explicit :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::gb_inline :
|
||||
case ESpecifier::Mutable :
|
||||
case ESpecifier::NeverInline :
|
||||
case ESpecifier::Static :
|
||||
@@ -8462,8 +8463,12 @@ namespace parser
|
||||
}
|
||||
|
||||
s32 level = 0;
|
||||
while ( left && currtok.Type != TokType::Statement_End && ( currtok.Type != TokType::Comma || level > 0 ) )
|
||||
while ( left && currtok.Type != TokType::Statement_End && (currtok.Type != TokType::Comma || level > 0 ) )
|
||||
{
|
||||
if (currtok.Type == TokType::BraceCurly_Open )
|
||||
level++;
|
||||
if (currtok.Type == TokType::BraceCurly_Close )
|
||||
level--;
|
||||
if ( currtok.Type == TokType::Capture_Start )
|
||||
level++;
|
||||
else if ( currtok.Type == TokType::Capture_End )
|
||||
@@ -8838,12 +8843,13 @@ namespace parser
|
||||
case TokType::Spec_Constexpr :
|
||||
case TokType::Spec_Constinit :
|
||||
case TokType::Spec_Extern :
|
||||
case TokType::Spec_ForceInline :
|
||||
case TokType::Spec_Global :
|
||||
case TokType::Spec_gb_inline :
|
||||
case TokType::Spec_gb_global :
|
||||
case TokType::Spec_Inline :
|
||||
case TokType::Spec_Internal_Linkage :
|
||||
case TokType::Spec_NeverInline :
|
||||
case TokType::Spec_Static :
|
||||
case TokType::Spec_gb_thread_local :
|
||||
{
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
@@ -8858,8 +8864,8 @@ namespace parser
|
||||
{
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::Constinit :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::Global :
|
||||
case ESpecifier::gb_inline :
|
||||
case ESpecifier::gb_global :
|
||||
case ESpecifier::External_Linkage :
|
||||
case ESpecifier::Internal_Linkage :
|
||||
case ESpecifier::Inline :
|
||||
@@ -8867,6 +8873,7 @@ namespace parser
|
||||
case ESpecifier::NeverInline :
|
||||
case ESpecifier::Static :
|
||||
case ESpecifier::Volatile :
|
||||
case ESpecifier::gb_thread_local :
|
||||
break;
|
||||
|
||||
case ESpecifier::Consteval :
|
||||
@@ -10304,6 +10311,8 @@ namespace parser
|
||||
break;
|
||||
}
|
||||
|
||||
eat(currtok.Type);
|
||||
|
||||
if ( specifiers )
|
||||
specifiers.append( spec );
|
||||
else
|
||||
@@ -10914,7 +10923,7 @@ namespace parser
|
||||
case ESpecifier::Consteval :
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::External_Linkage :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::gb_inline :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::NeverInline :
|
||||
case ESpecifier::Static :
|
||||
@@ -11022,7 +11031,7 @@ namespace parser
|
||||
{
|
||||
case ESpecifier::Const :
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::gb_inline :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::NeverInline :
|
||||
case ESpecifier::Static :
|
||||
@@ -11270,13 +11279,13 @@ namespace parser
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::Constinit :
|
||||
case ESpecifier::External_Linkage :
|
||||
case ESpecifier::Global :
|
||||
case ESpecifier::gb_global :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::gb_inline :
|
||||
case ESpecifier::Local_Persist :
|
||||
case ESpecifier::Mutable :
|
||||
case ESpecifier::Static :
|
||||
case ESpecifier::Thread_Local :
|
||||
case ESpecifier::gb_thread_local :
|
||||
case ESpecifier::Volatile :
|
||||
break;
|
||||
|
||||
@@ -11436,10 +11445,13 @@ namespace parser
|
||||
else if ( currtok.Type == TokType::Decl_Class || currtok.Type == TokType::Decl_Enum || currtok.Type == TokType::Decl_Struct
|
||||
|| currtok.Type == TokType::Decl_Union )
|
||||
{
|
||||
Token fwd_key = currtok;
|
||||
eat( currtok.Type );
|
||||
// <Attributes> <Specifiers> <class, enum, struct, union>
|
||||
|
||||
name = parse_identifier();
|
||||
name = parse_identifier();
|
||||
fwd_key.Length = sptr(name.Text + name.Length) - sptr(fwd_key.Text);
|
||||
name = fwd_key;
|
||||
|
||||
// name.Length = ( ( sptr )currtok.Text + currtok.Length ) - ( sptr )name.Text;
|
||||
// eat( TokType::Identifier );
|
||||
@@ -12273,12 +12285,12 @@ else if ( currtok.Type == TokType::DeclType )
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::Constinit :
|
||||
case ESpecifier::External_Linkage :
|
||||
case ESpecifier::Global :
|
||||
case ESpecifier::gb_global :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::Local_Persist :
|
||||
case ESpecifier::Mutable :
|
||||
case ESpecifier::Static :
|
||||
case ESpecifier::Thread_Local :
|
||||
case ESpecifier::gb_thread_local :
|
||||
case ESpecifier::Volatile :
|
||||
break;
|
||||
|
||||
@@ -12367,7 +12379,7 @@ CodeConstructor parse_constructor( StrC def )
|
||||
case ESpecifier::Constexpr :
|
||||
case ESpecifier::Explicit :
|
||||
case ESpecifier::Inline :
|
||||
case ESpecifier::ForceInline :
|
||||
case ESpecifier::gb_inline :
|
||||
case ESpecifier::NeverInline :
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user