From 794695401746fa65aafe20c77aae361c5e8b74ff Mon Sep 17 00:00:00 2001 From: Ed_ Date: Sun, 15 Dec 2024 01:55:22 -0500 Subject: [PATCH] fixing post-gen c-library compiler errors (still quite a few togo --- base/components/code_serialization.cpp | 2 +- base/components/parser.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/base/components/code_serialization.cpp b/base/components/code_serialization.cpp index c9678a1..94e601a 100644 --- a/base/components/code_serialization.cpp +++ b/base/components/code_serialization.cpp @@ -250,7 +250,7 @@ void define_to_strbuilder_ref(CodeDefine define, StrBuilder* result ) { GEN_ASSERT(define); GEN_ASSERT(define->Body); - GEN_ASSERT(define->Body->Content); + GEN_ASSERT(define->Body->Content.Ptr && define->Body->Content.Len > 0); if (define->Params) { StrBuilder params_builder = define_params_to_strbuilder(define->Params); strbuilder_append_fmt( result, "#define %S(%S) %S", define->Name, strbuilder_to_str(params_builder), define->Body->Content ); diff --git a/base/components/parser.cpp b/base/components/parser.cpp index 40a5713..f1c5634 100644 --- a/base/components/parser.cpp +++ b/base/components/parser.cpp @@ -1327,9 +1327,9 @@ CodeDefine parser_parse_define() params = (CodeDefineParams) make_code(); params->Type = CT_Parameters_Define; params->Name = currtok.Text; + params->NumEntries ++; define->Params = params; - eat( Tok_Preprocess_Define_Param ); // #define ( } @@ -4964,12 +4964,13 @@ CodeTypedef parser_parse_typedef() // valid_macro |= macro && macro_expects_body(* macro)); // } + Code macro; if ( valid_macro ) #endif { type = cast(Code, t_empty); - Code macro = parse_simple_preprocess(currtok.Type); name = currtok; + Code macro = parse_simple_preprocess(currtok.Type); name.Text.Len = macro->Content.Len; _ctx->parser.Scope->Name = name.Text; // typedef