Cleaning up noisy build logs

This commit is contained in:
Peter Slattery 2025-07-11 17:58:58 -07:00
parent 324a78ae1e
commit 877527e918
4 changed files with 275 additions and 273 deletions

View File

@ -155,7 +155,7 @@ api_type_match(API_Type *a, API_Type *b){
result = true; result = true;
} }
}break; }break;
case APITypeKind_Enum: case APITypeKind_Enum:
{ {
if (a->enum_type.val_count == b->enum_type.val_count && if (a->enum_type.val_count == b->enum_type.val_count &&
@ -172,7 +172,7 @@ api_type_match(API_Type *a, API_Type *b){
} }
} }
}break; }break;
case APITypeKind_Typedef: case APITypeKind_Typedef:
{ {
if (string_match(a->typedef_type.name, b->typedef_type.name) && if (string_match(a->typedef_type.name, b->typedef_type.name) &&
@ -209,9 +209,9 @@ api_get_callable_name(Arena *arena, String_Const_u8 api_name, String_Const_u8 na
function void function void
generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){ generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by)); fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
for (API_Call *call = api->first_call; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
@ -240,9 +240,9 @@ generate_api_master_list(Arena *scratch, API_Definition *api, API_Generation_Fla
function void function void
generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by)); fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
for (API_Call *call = api->first_call; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
@ -269,9 +269,9 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
} }
fprintf(out, ")\n"); fprintf(out, ")\n");
} }
fprintf(out, "\n"); fprintf(out, "\n");
for (API_Call *call = api->first_call; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
@ -296,9 +296,9 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
} }
fprintf(out, ");\n"); fprintf(out, ");\n");
} }
fprintf(out, "\n"); fprintf(out, "\n");
fprintf(out, "struct API_VTable_%.*s{\n", string_expand(api->name)); fprintf(out, "struct API_VTable_%.*s{\n", string_expand(api->name));
for (API_Call *call = api->first_call; for (API_Call *call = api->first_call;
call != 0; call != 0;
@ -311,9 +311,9 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
fprintf(out, ";\n"); fprintf(out, ";\n");
} }
fprintf(out, "};\n"); fprintf(out, "};\n");
fprintf(out, "\n"); fprintf(out, "\n");
fprintf(out, "#if defined(STATIC_LINK_API)\n"); fprintf(out, "#if defined(STATIC_LINK_API)\n");
for (API_Call *call = api->first_call; for (API_Call *call = api->first_call;
call != 0; call != 0;
@ -357,9 +357,9 @@ generate_header(Arena *scratch, API_Definition *api, API_Generation_Flag flags,
function void function void
generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by)); fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
fprintf(out, "function void\n"); fprintf(out, "function void\n");
fprintf(out, "%.*s_api_fill_vtable(API_VTable_%.*s *vtable){\n", fprintf(out, "%.*s_api_fill_vtable(API_VTable_%.*s *vtable){\n",
string_expand(api->name), string_expand(api->name),
@ -374,7 +374,7 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
} }
fprintf(out, "}\n"); fprintf(out, "}\n");
fprintf(out, "\n"); fprintf(out, "\n");
fprintf(out, "#if defined(DYNAMIC_LINK_API)\n"); fprintf(out, "#if defined(DYNAMIC_LINK_API)\n");
fprintf(out, "function void\n"); fprintf(out, "function void\n");
fprintf(out, "%.*s_api_read_vtable(API_VTable_%.*s *vtable){\n", fprintf(out, "%.*s_api_read_vtable(API_VTable_%.*s *vtable){\n",
@ -395,15 +395,15 @@ generate_cpp(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FIL
function void function void
generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){ generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag flags, FILE *out, String_Const_u8 generated_by){
fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by)); fprintf(out, "/* Generated by \"%.*s\" */\n\n", string_expand(generated_by));
fprintf(out, "function API_Definition*\n"); fprintf(out, "function API_Definition*\n");
fprintf(out, "%.*s_api_construct(Arena *arena){\n", fprintf(out, "%.*s_api_construct(Arena *arena){\n",
string_expand(api->name)); string_expand(api->name));
fprintf(out, " API_Definition *result = begin_api(arena, \"%.*s\");\n", fprintf(out, " API_Definition *result = begin_api(arena, \"%.*s\");\n",
string_expand(api->name)); string_expand(api->name));
for (API_Call *call = api->first_call; for (API_Call *call = api->first_call;
call != 0; call != 0;
call = call->next){ call = call->next){
@ -414,7 +414,7 @@ generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag fl
"string_u8_litexpr(\"\"));\n", "string_u8_litexpr(\"\"));\n",
string_expand(call->name), string_expand(call->name),
string_expand(call->return_type)); string_expand(call->return_type));
if (call->params.count == 0){ if (call->params.count == 0){
fprintf(out, " (void)call;\n"); fprintf(out, " (void)call;\n");
} }
@ -427,10 +427,10 @@ generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag fl
string_expand(param->name)); string_expand(param->name));
} }
} }
fprintf(out, " }\n"); fprintf(out, " }\n");
} }
fprintf(out, " return(result);\n"); fprintf(out, " return(result);\n");
fprintf(out, "}\n"); fprintf(out, "}\n");
} }
@ -440,15 +440,15 @@ generate_constructor(Arena *scratch, API_Definition *api, API_Generation_Flag fl
function b32 function b32
api_definition_generate_api_includes(Arena *arena, API_Definition *api, Generated_Group group, API_Generation_Flag flags, String_Const_u8 generated_by){ api_definition_generate_api_includes(Arena *arena, API_Definition *api, Generated_Group group, API_Generation_Flag flags, String_Const_u8 generated_by){
// NOTE(allen): Arrange output files // NOTE(allen): Arrange output files
String_Const_u8 path_to_self = string_u8_litexpr(__FILE__); String_Const_u8 path_to_self = string_u8_litexpr(__FILE__);
path_to_self = string_remove_last_folder(path_to_self); path_to_self = string_remove_last_folder(path_to_self);
String_Const_u8 fname_ml = {}; String_Const_u8 fname_ml = {};
String_Const_u8 fname_h = {}; String_Const_u8 fname_h = {};
String_Const_u8 fname_cpp = {}; String_Const_u8 fname_cpp = {};
String_Const_u8 fname_con = {}; String_Const_u8 fname_con = {};
String_Const_u8 root = {}; String_Const_u8 root = {};
switch (group){ switch (group){
case GeneratedGroup_Core: case GeneratedGroup_Core:
@ -460,67 +460,69 @@ api_definition_generate_api_includes(Arena *arena, API_Definition *api, Generate
root = string_u8_litexpr("custom/generated/"); root = string_u8_litexpr("custom/generated/");
}break; }break;
} }
fname_ml = push_u8_stringf(arena, "%.*s%.*s%.*s_api_master_list.h", fname_ml = push_u8_stringf(arena, "%.*s%.*s%.*s_api_master_list.h",
string_expand(path_to_self), string_expand(path_to_self),
string_expand(root), string_expand(root),
string_expand(api->name)); string_expand(api->name));
fname_h = push_u8_stringf(arena, "%.*s%.*s%.*s_api.h", fname_h = push_u8_stringf(arena, "%.*s%.*s%.*s_api.h",
string_expand(path_to_self), string_expand(path_to_self),
string_expand(root), string_expand(root),
string_expand(api->name)); string_expand(api->name));
fname_cpp = push_u8_stringf(arena, "%.*s%.*s%.*s_api.cpp", fname_cpp = push_u8_stringf(arena, "%.*s%.*s%.*s_api.cpp",
string_expand(path_to_self), string_expand(path_to_self),
string_expand(root), string_expand(root),
string_expand(api->name)); string_expand(api->name));
fname_con = push_u8_stringf(arena, "%.*s%.*s%.*s_api_constructor.cpp", fname_con = push_u8_stringf(arena, "%.*s%.*s%.*s_api_constructor.cpp",
string_expand(path_to_self), string_expand(path_to_self),
string_expand(root), string_expand(root),
string_expand(api->name)); string_expand(api->name));
FILE *out_file_ml = fopen((char*)fname_ml.str, "wb"); FILE *out_file_ml = fopen((char*)fname_ml.str, "wb");
if (out_file_ml == 0){ if (out_file_ml == 0){
printf("could not open output file: '%s'\n", fname_ml.str); printf("could not open output file: '%s'\n", fname_ml.str);
return(false); return(false);
} }
FILE *out_file_h = fopen((char*)fname_h.str, "wb"); FILE *out_file_h = fopen((char*)fname_h.str, "wb");
if (out_file_h == 0){ if (out_file_h == 0){
printf("could not open output file: '%s'\n", fname_h.str); printf("could not open output file: '%s'\n", fname_h.str);
return(false); return(false);
} }
FILE *out_file_cpp = fopen((char*)fname_cpp.str, "wb"); FILE *out_file_cpp = fopen((char*)fname_cpp.str, "wb");
if (out_file_cpp == 0){ if (out_file_cpp == 0){
printf("could not open output file: '%s'\n", fname_cpp.str); printf("could not open output file: '%s'\n", fname_cpp.str);
return(false); return(false);
} }
FILE *out_file_con = fopen((char*)fname_con.str, "wb"); FILE *out_file_con = fopen((char*)fname_con.str, "wb");
if (out_file_cpp == 0){ if (out_file_cpp == 0){
printf("could not open output file: '%s'\n", fname_con.str); printf("could not open output file: '%s'\n", fname_con.str);
return(false); return(false);
} }
#if 0
printf("%s:1:\n", fname_ml.str); printf("%s:1:\n", fname_ml.str);
printf("%s:1:\n", fname_h.str); printf("%s:1:\n", fname_h.str);
printf("%s:1:\n", fname_cpp.str); printf("%s:1:\n", fname_cpp.str);
printf("%s:1:\n", fname_con.str); printf("%s:1:\n", fname_con.str);
#endif
//////////////////////////////// ////////////////////////////////
// NOTE(allen): Generate output // NOTE(allen): Generate output
generate_api_master_list(arena, api, flags, out_file_ml, generated_by); generate_api_master_list(arena, api, flags, out_file_ml, generated_by);
generate_header(arena, api, flags, out_file_h, generated_by); generate_header(arena, api, flags, out_file_h, generated_by);
generate_cpp(arena, api, flags, out_file_cpp, generated_by); generate_cpp(arena, api, flags, out_file_cpp, generated_by);
generate_constructor(arena, api, flags, out_file_con, generated_by); generate_constructor(arena, api, flags, out_file_con, generated_by);
//////////////////////////////// ////////////////////////////////
fclose(out_file_ml); fclose(out_file_ml);
fclose(out_file_h); fclose(out_file_h);
fclose(out_file_cpp); fclose(out_file_cpp);
@ -587,7 +589,7 @@ api_definition_check(Arena *arena, API_Definition *correct, API_Definition *remo
b32 report_missing = HasFlag(flags, APICheck_ReportMissingAPI); b32 report_missing = HasFlag(flags, APICheck_ReportMissingAPI);
b32 report_extra = HasFlag(flags, APICheck_ReportExtraAPI); b32 report_extra = HasFlag(flags, APICheck_ReportExtraAPI);
b32 report_mismatch = HasFlag(flags, APICheck_ReportMismatchAPI); b32 report_mismatch = HasFlag(flags, APICheck_ReportMismatchAPI);
b32 iterate_correct = (report_missing || report_mismatch); b32 iterate_correct = (report_missing || report_mismatch);
if (iterate_correct){ if (iterate_correct){
for (API_Call *call = correct->first_call; for (API_Call *call = correct->first_call;
@ -605,7 +607,7 @@ api_definition_check(Arena *arena, API_Definition *correct, API_Definition *remo
} }
} }
} }
b32 iterate_remote = (report_extra); b32 iterate_remote = (report_extra);
if (iterate_remote){ if (iterate_remote){
for (API_Call *call = remote->first_call; for (API_Call *call = remote->first_call;
@ -625,7 +627,7 @@ function void
api_list_check(Arena *arena, API_Definition_List *correct, API_Definition_List *remote, API_Check_Flag flags, List_String_Const_u8 *error_list){ api_list_check(Arena *arena, API_Definition_List *correct, API_Definition_List *remote, API_Check_Flag flags, List_String_Const_u8 *error_list){
b32 report_missing = HasFlag(flags, APICheck_ReportMissingAPI); b32 report_missing = HasFlag(flags, APICheck_ReportMissingAPI);
b32 report_extra = HasFlag(flags, APICheck_ReportExtraAPI); b32 report_extra = HasFlag(flags, APICheck_ReportExtraAPI);
b32 iterate_correct = (report_missing); b32 iterate_correct = (report_missing);
if (iterate_correct){ if (iterate_correct){
for (API_Definition *api = correct->first; for (API_Definition *api = correct->first;
@ -638,7 +640,7 @@ api_list_check(Arena *arena, API_Definition_List *correct, API_Definition_List *
} }
} }
} }
b32 iterate_remote = (report_extra); b32 iterate_remote = (report_extra);
if (iterate_remote){ if (iterate_remote){
for (API_Definition *api = remote->first; for (API_Definition *api = remote->first;
@ -652,7 +654,7 @@ api_list_check(Arena *arena, API_Definition_List *correct, API_Definition_List *
} }
} }
} }
for (API_Definition *api = correct->first; for (API_Definition *api = correct->first;
api != 0; api != 0;
api = api->next){ api = api->next){

View File

@ -28,7 +28,7 @@ struct Event_Code_List{
Event_Code *first; Event_Code *first;
Event_Code *last; Event_Code *last;
i32 count; i32 count;
String_Const_u8 code_prefix; String_Const_u8 code_prefix;
String_Const_u8 name_table; String_Const_u8 name_table;
}; };
@ -39,7 +39,7 @@ function void
generate_codes(Arena *scratch, Event_Code_List *list, FILE *out){ generate_codes(Arena *scratch, Event_Code_List *list, FILE *out){
String_Const_u8 code_prefix = list->code_prefix; String_Const_u8 code_prefix = list->code_prefix;
String_Const_u8 name_table = list->name_table; String_Const_u8 name_table = list->name_table;
fprintf(out, "enum{\n"); fprintf(out, "enum{\n");
i32 counter = 1; i32 counter = 1;
for (Event_Code *code = list->first; for (Event_Code *code = list->first;
@ -51,7 +51,7 @@ generate_codes(Arena *scratch, Event_Code_List *list, FILE *out){
} }
fprintf(out, " %.*s_COUNT = %d,\n", string_expand(code_prefix), counter); fprintf(out, " %.*s_COUNT = %d,\n", string_expand(code_prefix), counter);
fprintf(out, "};\n"); fprintf(out, "};\n");
fprintf(out, "global char* %.*s[%.*s_COUNT] = {\n", fprintf(out, "global char* %.*s[%.*s_COUNT] = {\n",
string_expand(name_table), string_expand(code_prefix)); string_expand(name_table), string_expand(code_prefix));
fprintf(out, " \"None\",\n"); fprintf(out, " \"None\",\n");
@ -70,7 +70,7 @@ function Event_Code*
add_code(Arena *arena, Event_Code_List *list, String_Const_u8 name){ add_code(Arena *arena, Event_Code_List *list, String_Const_u8 name){
Event_Code *code = push_array(arena, Event_Code, 1); Event_Code *code = push_array(arena, Event_Code, 1);
sll_queue_push(list->first, list->last, code); sll_queue_push(list->first, list->last, code);
list->count; list->count += 1;
code->name = push_string_copy(arena, name); code->name = push_string_copy(arena, name);
return(code); return(code);
} }
@ -171,30 +171,30 @@ make_core_list(Arena *arena){
int int
main(void){ main(void){
Arena arena = make_arena_malloc(); Arena arena = make_arena_malloc();
Event_Code_List key_list = make_key_list(&arena); Event_Code_List key_list = make_key_list(&arena);
Event_Code_List mouse_list = make_mouse_list(&arena); Event_Code_List mouse_list = make_mouse_list(&arena);
Event_Code_List core_list = make_core_list(&arena); Event_Code_List core_list = make_core_list(&arena);
String_Const_u8 path_to_self = string_u8_litexpr(__FILE__); String_Const_u8 path_to_self = string_u8_litexpr(__FILE__);
path_to_self = string_remove_last_folder(path_to_self); path_to_self = string_remove_last_folder(path_to_self);
String_Const_u8 file_name = String_Const_u8 file_name =
push_u8_stringf(&arena, "%.*scustom/generated/4coder_event_codes.h", push_u8_stringf(&arena, "%.*scustom/generated/4coder_event_codes.h",
string_expand(path_to_self)); string_expand(path_to_self));
FILE *out = fopen((char*)file_name.str, "wb"); FILE *out = fopen((char*)file_name.str, "wb");
if (out == 0){ if (out == 0){
printf("could not open output file '%s'\n", file_name.str); printf("could not open output file '%s'\n", file_name.str);
exit(1); exit(1);
} }
fprintf(out, "/* Generated by: " __FILE__ ); fprintf(out, "/* Generated by: " __FILE__ );
fprintf(out, " */\n" ); fprintf(out, " */\n" );
generate_codes(&arena, &key_list, out); generate_codes(&arena, &key_list, out);
generate_codes(&arena, &mouse_list, out); generate_codes(&arena, &mouse_list, out);
generate_codes(&arena, &core_list, out); generate_codes(&arena, &core_list, out);
fclose(out); fclose(out);
return(0); return(0);
} }

View File

@ -35,8 +35,8 @@ debug=-g
opts="-Wno-macro-redefined -Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=0" opts="-Wno-macro-redefined -Wno-write-strings -Wno-null-dereference -Wno-comment -Wno-switch -Wno-missing-declarations -Wno-logical-op-parentheses -g -DOS_LINUX=1 -DOS_WINDOWS=0 -DOS_MAC=0"
pushd $dst pushd $dst > /dev/null
g++ -I"$CUSTOM_ROOT" $opts $full_target -o one_time g++ -I"$CUSTOM_ROOT" $opts $full_target -o one_time
popd popd > /dev/null

File diff suppressed because it is too large Load Diff