From fbba79ee4a364b1738b267f7c362cce5c49c8887 Mon Sep 17 00:00:00 2001 From: doyle Date: Fri, 3 May 2019 20:23:14 +1000 Subject: [PATCH] Change inspect function macro to DQN_INSPECT_FUNCTION --- Code/DqnInspect.h | 52 +++++----- Data/DqnInspect_TestData.h | 6 +- Data/DqnInspect_TestDataGenerated.cpp | 132 ++++++++++++++++---------- 3 files changed, 110 insertions(+), 80 deletions(-) diff --git a/Code/DqnInspect.h b/Code/DqnInspect.h index a609451..ab5819a 100644 --- a/Code/DqnInspect.h +++ b/Code/DqnInspect.h @@ -53,7 +53,7 @@ #define DQN_INSPECT #define DQN_INSPECT_META(...) -#define DQN_INSPECT_GENERATE_PROTOTYPE(...) +#define DQN_INSPECT_FUNCTION(...) struct DqnInspectMetadata { @@ -446,7 +446,7 @@ Slice Asprintf(MemArena *arena, char const *fmt, ...) X(Ampersand, "&") \ X(VarArgs, "Variable Args (...)") \ X(InspectCode, "DQN_INSPECT") \ - X(InspectGeneratePrototype, "DQN_INSPECT_GENERATE_PROTOTYPE") \ + X(InspectFunction, "DQN_INSPECT_FUNCTION") \ X(Hash, "#") #define X(decl, str) decl, @@ -908,7 +908,7 @@ enum struct ParsedCodeType Invalid, Struct, Enum, - FunctionPrototype, + Function, }; struct ParsedEnum @@ -925,7 +925,7 @@ struct ParsedStruct }; -struct ParsedFunctionPrototype +struct ParsedFunction { Slice return_type; Slice name; @@ -940,7 +940,7 @@ struct ParsedCode union { ParsedEnum parsed_enum; - ParsedFunctionPrototype parsed_func_prototype; + ParsedFunction parsed_func; ParsedStruct parsed_struct; }; }; @@ -1122,11 +1122,11 @@ b32 ParseCPPStruct(CPPTokeniser *tokeniser, ParsedStruct *parsed_struct) return true; } -b32 ParseCPPInspectPrototype(CPPTokeniser *tokeniser, ParsedFunctionPrototype *parsed_func) +b32 ParseCPPInspectFunction(CPPTokeniser *tokeniser, ParsedFunction *parsed_func) { *parsed_func = {}; CPPToken token = CPPTokeniser_NextToken(tokeniser); - if (!ExpectToken(token, CPPTokenType::InspectGeneratePrototype)) + if (!ExpectToken(token, CPPTokenType::InspectFunction)) return false; struct FunctionDefaultParam @@ -1295,7 +1295,7 @@ enum struct InspectMode { All, Code, - GenerateProtypes + Function }; char *EnumOrStructOrFunctionLexer(CPPTokeniser *tokeniser, char *ptr, b32 lexing_function) @@ -1503,8 +1503,8 @@ int main(int argc, char *argv[]) usize starting_arg_index = 1; char const *mode_str = argv[1]; InspectMode mode = InspectMode::All; - if (strcmp(mode_str, "code") == 0) mode = InspectMode::Code; - else if (strcmp(mode_str, "generate_prototypes") == 0) mode = InspectMode::GenerateProtypes; + if (strcmp(mode_str, "code") == 0) mode = InspectMode::Code; + else if (strcmp(mode_str, "function") == 0) mode = InspectMode::Function; if (mode != InspectMode::All) starting_arg_index++; @@ -1582,10 +1582,10 @@ int main(int argc, char *argv[]) tokeniser.tokens_max = 16384; tokeniser.tokens = MEM_ARENA_ALLOC_ARRAY(&global_main_arena, CPPToken, tokeniser.tokens_max); - Slice const INSPECT_PROTOTYPE = SLICE_LITERAL("DQN_INSPECT_GENERATE_PROTOTYPE"); - Slice const INSPECT_PREFIX = SLICE_LITERAL("DQN_INSPECT"); - char *file_buf_end = file_buf + file_size; - Slice buffer = Slice(file_buf, static_cast(file_size)); + Slice const INSPECT_FUNCTION = SLICE_LITERAL("DQN_INSPECT_FUNCTION"); + Slice const INSPECT_PREFIX = SLICE_LITERAL("DQN_INSPECT"); + char *file_buf_end = file_buf + file_size; + Slice buffer = Slice(file_buf, static_cast(file_size)); for (char *ptr = StrFind(buffer, INSPECT_PREFIX); ptr; @@ -1601,19 +1601,19 @@ int main(int argc, char *argv[]) }; CPPTokenType inspect_type = CPPTokenType::InspectCode; - if (Slice_Cmp(Slice(ptr, INSPECT_PROTOTYPE.len), INSPECT_PROTOTYPE)) + if (Slice_Cmp(Slice(ptr, INSPECT_FUNCTION.len), INSPECT_FUNCTION)) { - inspect_type = CPPTokenType::InspectGeneratePrototype; + inspect_type = CPPTokenType::InspectFunction; } if (inspect_type == CPPTokenType::InspectCode) { ptr += INSPECT_PREFIX.len; - if (mode == InspectMode::GenerateProtypes) continue; + if (mode == InspectMode::Function) continue; } else { - ptr += INSPECT_PROTOTYPE.len; + ptr += INSPECT_FUNCTION.len; if (mode == InspectMode::Code) continue; } @@ -1621,7 +1621,7 @@ int main(int argc, char *argv[]) inspect_token->type = inspect_type; inspect_token->str = marker_str; inspect_token->len = marker_len; - ptr = EnumOrStructOrFunctionLexer(&tokeniser, ptr, inspect_type == CPPTokenType::InspectGeneratePrototype); + ptr = EnumOrStructOrFunctionLexer(&tokeniser, ptr, inspect_type == CPPTokenType::InspectFunction); } @@ -1633,7 +1633,7 @@ int main(int argc, char *argv[]) token = CPPTokeniser_PeekToken(&tokeniser)) { ParsedCode parsed_code = {}; - if (token.type == CPPTokenType::InspectCode || token.type == CPPTokenType::InspectGeneratePrototype) + if (token.type == CPPTokenType::InspectCode || token.type == CPPTokenType::InspectFunction) { if (token.type == CPPTokenType::InspectCode) { @@ -1653,11 +1653,11 @@ int main(int argc, char *argv[]) } else { - if (ParseCPPInspectPrototype(&tokeniser, &parsed_code.parsed_func_prototype)) + if (ParseCPPInspectFunction(&tokeniser, &parsed_code.parsed_func)) { - parsed_code.type = ParsedCodeType::FunctionPrototype; - parsing_results.max_func_return_type_decl_len = INSPECT_MAX(parsing_results.max_func_return_type_decl_len, parsed_code.parsed_func_prototype.return_type.len); - parsing_results.max_func_name_decl_len = INSPECT_MAX(parsing_results.max_func_name_decl_len, parsed_code.parsed_func_prototype.name.len); + parsed_code.type = ParsedCodeType::Function; + parsing_results.max_func_return_type_decl_len = INSPECT_MAX(parsing_results.max_func_return_type_decl_len, parsed_code.parsed_func.return_type.len); + parsing_results.max_func_name_decl_len = INSPECT_MAX(parsing_results.max_func_name_decl_len, parsed_code.parsed_func.name.len); } } } @@ -2304,9 +2304,9 @@ int main(int argc, char *argv[]) } break; - case ParsedCodeType::FunctionPrototype: + case ParsedCodeType::Function: { - ParsedFunctionPrototype *parsed_func = &code.parsed_func_prototype; + ParsedFunction *parsed_func = &code.parsed_func; if (parsed_func->has_comments) { for (LinkedList> const *comment_link = &parsed_func->comments; diff --git a/Data/DqnInspect_TestData.h b/Data/DqnInspect_TestData.h index ba83307..373754e 100644 --- a/Data/DqnInspect_TestData.h +++ b/Data/DqnInspect_TestData.h @@ -40,14 +40,14 @@ DQN_INSPECT enum struct EnumWithMetadata Count, }; -DQN_INSPECT_GENERATE_PROTOTYPE(b = {}, c = nullptr, e = false, f = 1, g = "Hello world") +DQN_INSPECT_FUNCTION(b = {}, c = nullptr, e = false, f = 1, g = "Hello world") void Function1(int a, float b, char const *c, bool e, int f, char *g) { (void)a; (void)b; (void)c; (void)e; (void)f; (void)g; } -DQN_INSPECT_GENERATE_PROTOTYPE(foo = V3(10, 20, 50), bar = {120, 150, 20}) +DQN_INSPECT_FUNCTION(foo = V3(10, 20, 50), bar = {120, 150, 20}) void *Function2(V3 foo, V3 bar, ...) { (void)foo; (void)bar; return nullptr; } -DQN_INSPECT_GENERATE_PROTOTYPE() +DQN_INSPECT_FUNCTION() Array const *const Function3(Array const *foobar) { (void)foobar; return {}; } diff --git a/Data/DqnInspect_TestDataGenerated.cpp b/Data/DqnInspect_TestDataGenerated.cpp index e75cbe4..4555d77 100644 --- a/Data/DqnInspect_TestDataGenerated.cpp +++ b/Data/DqnInspect_TestDataGenerated.cpp @@ -40,11 +40,14 @@ enum struct DqnInspectMemberType enum struct DqnInspectDeclType { + NotAvailable_, V3_, V4_, int_, Array_, int_Ptr_, + V3,_32_, + V4,_32_, int_Ptr_Ptr_, void_Ptr_, char_Ptr_Ptr_, @@ -53,6 +56,8 @@ enum struct DqnInspectDeclType int_const_Ptr_, SampleStruct_, char_const_Ptr_, + Array_V3,_32_, + Array_V4,_32_, int_Ptr_Ptr_Ptr_Ptr_const_, EnumWithMetadata_, int_const_Ptr_const_, @@ -98,8 +103,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_ebo, STR_AND_LEN("ebo"), offsetof(SampleStruct, ebo), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->ebo), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->ebo), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, DqnInspectMetadata_SampleStruct_ebo, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_ebo), // metadata array @@ -108,8 +114,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_vbo, STR_AND_LEN("vbo"), offsetof(SampleStruct, vbo), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->vbo), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->vbo), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -118,8 +125,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_vao, STR_AND_LEN("vao"), offsetof(SampleStruct, vao), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->vao), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->vao), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, DqnInspectMetadata_SampleStruct_vao, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_vao), // metadata array @@ -128,8 +136,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_a, STR_AND_LEN("a"), offsetof(SampleStruct, a), DqnInspectDeclType::int_Ptr_const_, STR_AND_LEN("int *const"), - sizeof(((SampleStruct *)0)->a), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->a), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_const_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -138,8 +147,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_b, STR_AND_LEN("b"), offsetof(SampleStruct, b), DqnInspectDeclType::int_const_Ptr_const_, STR_AND_LEN("int const *const"), - sizeof(((SampleStruct *)0)->b), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->b), // full_decl_type_sizeof + DqnInspectDeclType::int_const_Ptr_const_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -148,8 +158,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_c, STR_AND_LEN("c"), offsetof(SampleStruct, c), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->c), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->c), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -158,8 +169,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_d, STR_AND_LEN("d"), offsetof(SampleStruct, d), DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"), - sizeof(((SampleStruct *)0)->d), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->d), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -168,8 +180,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_e, STR_AND_LEN("e"), offsetof(SampleStruct, e), DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"), - sizeof(((SampleStruct *)0)->e), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->e), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -178,8 +191,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_draw_color, STR_AND_LEN("draw_color"), offsetof(SampleStruct, draw_color), DqnInspectDeclType::V4_, STR_AND_LEN("V4"), - sizeof(((SampleStruct *)0)->draw_color), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->draw_color), // full_decl_type_sizeof + DqnInspectDeclType::V4_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, DqnInspectMetadata_SampleStruct_draw_color, ARRAY_COUNT(DqnInspectMetadata_SampleStruct_draw_color), // metadata array @@ -187,9 +201,10 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = { DqnInspectMemberType::SampleStruct_lights, STR_AND_LEN("lights"), offsetof(SampleStruct, lights), - DqnInspectDeclType::Array_, STR_AND_LEN("Array"), - sizeof(((SampleStruct *)0)->lights), // decl_type_sizeof - STR_AND_LEN("V3, 32"), // template_expr + DqnInspectDeclType::Array_V3,_32_, STR_AND_LEN("Array"), + sizeof(((SampleStruct *)0)->lights), // full_decl_type_sizeof + DqnInspectDeclType::Array_, DqnInspectDeclType::V3,_32_, + STR_AND_LEN("V3, 32"), // template_child_expr 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -197,9 +212,10 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = { DqnInspectMemberType::SampleStruct_camera_matrixes, STR_AND_LEN("camera_matrixes"), offsetof(SampleStruct, camera_matrixes), - DqnInspectDeclType::Array_, STR_AND_LEN("Array"), - sizeof(((SampleStruct *)0)->camera_matrixes), // decl_type_sizeof - STR_AND_LEN("V4, 32"), // template_expr + DqnInspectDeclType::Array_V4,_32_, STR_AND_LEN("Array"), + sizeof(((SampleStruct *)0)->camera_matrixes), // full_decl_type_sizeof + DqnInspectDeclType::Array_, DqnInspectDeclType::V4,_32_, + STR_AND_LEN("V4, 32"), // template_child_expr 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -208,8 +224,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_bitmaps, STR_AND_LEN("bitmaps"), offsetof(SampleStruct, bitmaps), DqnInspectDeclType::char_Ptr_Ptr_, STR_AND_LEN("char **"), - sizeof(((SampleStruct *)0)->bitmaps), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->bitmaps), // full_decl_type_sizeof + DqnInspectDeclType::char_Ptr_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 2, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -218,8 +235,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_shaders, STR_AND_LEN("shaders"), offsetof(SampleStruct, shaders), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->shaders), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->shaders), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {ARRAY_COUNT(((SampleStruct *)0)->shaders), 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -228,8 +246,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_win32_handle, STR_AND_LEN("win32_handle"), offsetof(SampleStruct, win32_handle), DqnInspectDeclType::void_Ptr_, STR_AND_LEN("void *"), - sizeof(((SampleStruct *)0)->win32_handle), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->win32_handle), // full_decl_type_sizeof + DqnInspectDeclType::void_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -238,8 +257,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_lighting_ambient_coeff, STR_AND_LEN("lighting_ambient_coeff"), offsetof(SampleStruct, lighting_ambient_coeff), DqnInspectDeclType::V3_, STR_AND_LEN("V3"), - sizeof(((SampleStruct *)0)->lighting_ambient_coeff), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->lighting_ambient_coeff), // full_decl_type_sizeof + DqnInspectDeclType::V3_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -248,8 +268,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_draw_call_count, STR_AND_LEN("draw_call_count"), offsetof(SampleStruct, draw_call_count), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->draw_call_count), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->draw_call_count), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -258,8 +279,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_f, STR_AND_LEN("f"), offsetof(SampleStruct, f), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->f), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->f), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -268,8 +290,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_g, STR_AND_LEN("g"), offsetof(SampleStruct, g), DqnInspectDeclType::int_const_, STR_AND_LEN("int const"), - sizeof(((SampleStruct *)0)->g), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->g), // full_decl_type_sizeof + DqnInspectDeclType::int_const_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -278,8 +301,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_h, STR_AND_LEN("h"), offsetof(SampleStruct, h), DqnInspectDeclType::int_Ptr_const_, STR_AND_LEN("int *const"), - sizeof(((SampleStruct *)0)->h), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->h), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_const_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -288,8 +312,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_i, STR_AND_LEN("i"), offsetof(SampleStruct, i), DqnInspectDeclType::int_const_Ptr_, STR_AND_LEN("int const*"), - sizeof(((SampleStruct *)0)->i), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->i), // full_decl_type_sizeof + DqnInspectDeclType::int_const_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -298,8 +323,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_j, STR_AND_LEN("j"), offsetof(SampleStruct, j), DqnInspectDeclType::int_Ptr_Ptr_Ptr_Ptr_const_, STR_AND_LEN("int ****const"), - sizeof(((SampleStruct *)0)->j), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->j), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_Ptr_Ptr_Ptr_const_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 4, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -308,8 +334,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_k, STR_AND_LEN("k"), offsetof(SampleStruct, k), DqnInspectDeclType::int_, STR_AND_LEN("int"), - sizeof(((SampleStruct *)0)->k), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->k), // full_decl_type_sizeof + DqnInspectDeclType::int_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 0, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -318,8 +345,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_l, STR_AND_LEN("l"), offsetof(SampleStruct, l), DqnInspectDeclType::int_Ptr_Ptr_, STR_AND_LEN("int **"), - sizeof(((SampleStruct *)0)->l), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->l), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 2, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -328,8 +356,9 @@ DqnInspectMember const DqnInspect_SampleStruct_Members[] = DqnInspectMemberType::SampleStruct_m, STR_AND_LEN("m"), offsetof(SampleStruct, m), DqnInspectDeclType::int_Ptr_, STR_AND_LEN("int *"), - sizeof(((SampleStruct *)0)->m), // decl_type_sizeof - nullptr, 0, // template_expr and template_expr_len + sizeof(((SampleStruct *)0)->m), // full_decl_type_sizeof + DqnInspectDeclType::int_Ptr_, DqnInspectDeclType::NotAvailable_, + nullptr, 0, // template_child_expr and template_child_expr_len 1, // array_dimensions {0, 0, 0, 0, 0, 0, 0, 0}, // array_compile_time_size 0, max 8 dimensions, 0 if unknown, nullptr, 0, // metadata array @@ -368,7 +397,7 @@ char const * DqnInspectMetadata_FilePath(EnumWithMetadata val) return nullptr; } -bool DqnInspectMetadata_Coords(EnumWithMetadata val, V3 *value) +bool DqnInspectMetadata_Coords(EnumWithMetadata val, V3 *value = nullptr) { if (val == EnumWithMetadata::Rect) { *value = V3(1, 2, 3); return true; } return false; @@ -382,6 +411,7 @@ Array const *const Function3(Array const * foobar); DqnInspectStruct const *DqnInspect_Struct(DqnInspectDeclType type) { + (void)type; #ifdef DQN_INSPECT_DQNINSPECT_TESTDATA_H if (type == DqnInspectDeclType::SampleStruct_) return &DqnInspect_SampleStruct_Struct; #endif // DQN_INSPECT_DQNINSPECT_TESTDATA_H