update gen_src.cpp

This commit is contained in:
ed
2024-12-15 10:35:10 -05:00
parent 94b1acf2b6
commit aa8bc79d34
2 changed files with 48 additions and 5 deletions
+17 -2
View File
@@ -159,8 +159,23 @@ int gen_main()
gen::init(& ctx); gen::init(& ctx);
log_fmt("Generating code for Odin's src\n"); log_fmt("Generating code for Odin's src\n");
Str str_GB_STATIC_ASSERT = txt("GB_STATIC_ASSERT("); register_macros( args(
_ctx->PreprocessorDefines.append( cache_str(str_GB_STATIC_ASSERT) ); (Macro {txt("GB_STATIC_ASSERT"), MT_Statement, MF_Functional }),
(Macro {txt("TOKEN_KIND"), MT_Expression, MF_Functional }),
(Macro {txt("TOKEN_KINDS"), MT_Statement, MF_Null }),
(Macro {txt("PARSER_MAX_FIX_COUNT"), MT_Expression, MF_Null }),
(Macro {txt("AST_KINDS"), MT_Statement, MF_Null }),
(Macro {txt("AST_KIND"), MT_Expression, MF_Functional }),
(Macro {txt("ast_node"), MT_Expression, MF_Functional }),
(Macro {txt("case_ast_node"), MT_Expression, MF_Functional }),
(Macro {txt("case_end"), MT_Expression, MF_Null }),
(Macro {txt("TYPE_KIND"), MT_Expression, MF_Functional }),
(Macro {txt("TYPE_KINDS"), MT_Statement, MF_Null }),
(Macro {txt("FAILURE_SIZE"), MT_Expression, MF_Null }),
(Macro {txt("FAILURE_ALIGNMENT"), MT_Expression, MF_Null }),
(Macro {txt("_ARRAY_FIELD_CASE_IF"), MT_Statement, MF_Functional }),
(Macro {txt("_ARRAY_FIELD_CASE"), MT_Expression, MF_Functional })
));
// Remove TOKEN_KINDS usage in tokenizer.cpp // Remove TOKEN_KINDS usage in tokenizer.cpp
// Note this doesn't account for an already swapped file. Make sure to discard changes or shut this path off if already generated. // Note this doesn't account for an already swapped file. Make sure to discard changes or shut this path off if already generated.
+31 -3
View File
@@ -4560,6 +4560,9 @@ enum Specifier : u32
Spec_Global, Spec_Global,
Spec_Inline, Spec_Inline,
Spec_Internal_Linkage, Spec_Internal_Linkage,
Spec_GB_Global,
Spec_GB_Inline,
Spec_GB_Internal_Linkage,
Spec_Local_Persist, Spec_Local_Persist,
Spec_Mutable, Spec_Mutable,
Spec_NeverInline, Spec_NeverInline,
@@ -4582,7 +4585,7 @@ enum Specifier : u32
inline Str spec_to_str( Specifier type ) inline Str spec_to_str( Specifier type )
{ {
local_persist Str lookup[26] = { local_persist Str lookup[] = {
{ "INVALID", sizeof( "INVALID" ) - 1 }, { "INVALID", sizeof( "INVALID" ) - 1 },
{ "consteval", sizeof( "consteval" ) - 1 }, { "consteval", sizeof( "consteval" ) - 1 },
{ "constexpr", sizeof( "constexpr" ) - 1 }, { "constexpr", sizeof( "constexpr" ) - 1 },
@@ -4593,6 +4596,9 @@ inline Str spec_to_str( Specifier type )
{ "global", sizeof( "global" ) - 1 }, { "global", sizeof( "global" ) - 1 },
{ "inline", sizeof( "inline" ) - 1 }, { "inline", sizeof( "inline" ) - 1 },
{ "internal", sizeof( "internal" ) - 1 }, { "internal", sizeof( "internal" ) - 1 },
{ "gb_global", sizeof( "gb_global" ) - 1 },
{ "gb_inline", sizeof( "gb_inline" ) - 1 },
{ "gb_internal", sizeof( "gb_internal" ) - 1 },
{ "local_persist", sizeof( "local_persist" ) - 1 }, { "local_persist", sizeof( "local_persist" ) - 1 },
{ "mutable", sizeof( "mutable" ) - 1 }, { "mutable", sizeof( "mutable" ) - 1 },
{ "neverinline", sizeof( "neverinline" ) - 1 }, { "neverinline", sizeof( "neverinline" ) - 1 },
@@ -4724,6 +4730,9 @@ enum TokType : u32
Tok_Spec_Global, Tok_Spec_Global,
Tok_Spec_Inline, Tok_Spec_Inline,
Tok_Spec_Internal_Linkage, Tok_Spec_Internal_Linkage,
Tok_Spec_GB_Global,
Tok_Spec_GB_Inline,
Tok_Spec_GB_Internal_Linkage,
Tok_Spec_LocalPersist, Tok_Spec_LocalPersist,
Tok_Spec_Mutable, Tok_Spec_Mutable,
Tok_Spec_NeverInline, Tok_Spec_NeverInline,
@@ -4829,6 +4838,9 @@ inline Str toktype_to_str( TokType type )
{ "global", sizeof( "global" ) - 1 }, { "global", sizeof( "global" ) - 1 },
{ "inline", sizeof( "inline" ) - 1 }, { "inline", sizeof( "inline" ) - 1 },
{ "internal", sizeof( "internal" ) - 1 }, { "internal", sizeof( "internal" ) - 1 },
{ "gb_global", sizeof( "gb_global" ) - 1 },
{ "gb_inline", sizeof( "gb_inline" ) - 1 },
{ "gb_internal", sizeof( "gb_internal" ) - 1 },
{ "local_persist", sizeof( "local_persist" ) - 1 }, { "local_persist", sizeof( "local_persist" ) - 1 },
{ "mutable", sizeof( "mutable" ) - 1 }, { "mutable", sizeof( "mutable" ) - 1 },
{ "neverinline", sizeof( "neverinline" ) - 1 }, { "neverinline", sizeof( "neverinline" ) - 1 },
@@ -20340,6 +20352,7 @@ case Tok_Spec_Constinit: \
case Tok_Spec_Explicit: \ case Tok_Spec_Explicit: \
case Tok_Spec_ForceInline: \ case Tok_Spec_ForceInline: \
case Tok_Spec_Inline: \ case Tok_Spec_Inline: \
case Tok_Spec_GB_Inline: \
case Tok_Spec_Mutable: \ case Tok_Spec_Mutable: \
case Tok_Spec_NeverInline: \ case Tok_Spec_NeverInline: \
case Tok_Spec_Static: \ case Tok_Spec_Static: \
@@ -20351,6 +20364,7 @@ case Spec_Constexpr: \
case Spec_Constinit: \ case Spec_Constinit: \
case Spec_Explicit: \ case Spec_Explicit: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Inline: \
case Spec_ForceInline: \ case Spec_ForceInline: \
case Spec_Mutable: \ case Spec_Mutable: \
case Spec_NeverInline: \ case Spec_NeverInline: \
@@ -20367,6 +20381,9 @@ case Tok_Spec_ForceInline: \
case Tok_Spec_Global: \ case Tok_Spec_Global: \
case Tok_Spec_Inline: \ case Tok_Spec_Inline: \
case Tok_Spec_Internal_Linkage: \ case Tok_Spec_Internal_Linkage: \
case Tok_Spec_GB_Global: \
case Tok_Spec_GB_Inline: \
case Tok_Spec_GB_Internal_Linkage: \
case Tok_Spec_NeverInline: \ case Tok_Spec_NeverInline: \
case Tok_Spec_Static case Tok_Spec_Static
@@ -20375,9 +20392,12 @@ case Spec_Constexpr: \
case Spec_Constinit: \ case Spec_Constinit: \
case Spec_ForceInline: \ case Spec_ForceInline: \
case Spec_Global: \ case Spec_Global: \
case Spec_External_Linkage: \
case Spec_Internal_Linkage: \ case Spec_Internal_Linkage: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Global: \
case Spec_GB_Internal_Linkage: \
case Spec_GB_Inline: \
case Spec_External_Linkage: \
case Spec_Mutable: \ case Spec_Mutable: \
case Spec_NeverInline: \ case Spec_NeverInline: \
case Spec_Static: \ case Spec_Static: \
@@ -20386,6 +20406,7 @@ case Spec_Volatile
#define GEN_PARSER_FRIEND_ALLOWED_SPECIFIERS_CASES \ #define GEN_PARSER_FRIEND_ALLOWED_SPECIFIERS_CASES \
case Spec_Const: \ case Spec_Const: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Inline: \
case Spec_ForceInline case Spec_ForceInline
#define GEN_PARSER_FUNCTION_ALLOWED_SPECIFIERS_CASES \ #define GEN_PARSER_FUNCTION_ALLOWED_SPECIFIERS_CASES \
@@ -20393,9 +20414,11 @@ case Spec_Const: \
case Spec_Consteval: \ case Spec_Consteval: \
case Spec_Constexpr: \ case Spec_Constexpr: \
case Spec_External_Linkage: \ case Spec_External_Linkage: \
case Spec_Internal_Linkage: \
case Spec_ForceInline: \ case Spec_ForceInline: \
case Spec_Internal_Linkage: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Internal_Linkage: \
case Spec_GB_Inline: \
case Spec_NeverInline: \ case Spec_NeverInline: \
case Spec_Static case Spec_Static
@@ -20404,6 +20427,7 @@ case Spec_Const: \
case Spec_Constexpr: \ case Spec_Constexpr: \
case Spec_ForceInline: \ case Spec_ForceInline: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Inline: \
case Spec_NeverInline: \ case Spec_NeverInline: \
case Spec_Static case Spec_Static
@@ -20414,6 +20438,8 @@ case Spec_Constinit: \
case Spec_External_Linkage: \ case Spec_External_Linkage: \
case Spec_Global: \ case Spec_Global: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Global: \
case Spec_GB_Inline: \
case Spec_ForceInline: \ case Spec_ForceInline: \
case Spec_Local_Persist: \ case Spec_Local_Persist: \
case Spec_Mutable: \ case Spec_Mutable: \
@@ -20428,6 +20454,8 @@ case Spec_Constinit: \
case Spec_External_Linkage: \ case Spec_External_Linkage: \
case Spec_Global: \ case Spec_Global: \
case Spec_Inline: \ case Spec_Inline: \
case Spec_GB_Global: \
case Spec_GB_Inline: \
case Spec_Local_Persist: \ case Spec_Local_Persist: \
case Spec_Mutable: \ case Spec_Mutable: \
case Spec_Static: \ case Spec_Static: \