From caec5d8dfc6f8b1f8a86445f06de40f5465d28a1 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Wed, 11 Dec 2024 00:13:36 -0500 Subject: [PATCH] fix clang format for enum_underlying --- base/components/code_serialization.cpp | 2 +- gen_c_library/c_library.cpp | 2 +- scripts/.clang-format | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/base/components/code_serialization.cpp b/base/components/code_serialization.cpp index 5369cc6..0bf9b7f 100644 --- a/base/components/code_serialization.cpp +++ b/base/components/code_serialization.cpp @@ -346,7 +346,7 @@ void enum_to_string_def(CodeEnum self, String* result ) , body_to_string(self->Body) ); else if ( self->UnderlyingTypeMacro ) - string_append_fmt( result, "%SC %S\n\n{\n%S\n}" + string_append_fmt( result, "%SC %S\n{\n%S\n}" , self->Name , code_to_string(self->UnderlyingTypeMacro) , body_to_string(self->Body) diff --git a/gen_c_library/c_library.cpp b/gen_c_library/c_library.cpp index 6e2d234..343b501 100644 --- a/gen_c_library/c_library.cpp +++ b/gen_c_library/c_library.cpp @@ -891,7 +891,7 @@ R"(#define ( code ) _Generic( (code), \ StrC cpp_size = to_strc_from_c_str(conversion_buf); union_entry->ValueType->ArrExpr = untyped_str( cpp_size ); union_entry->InlineCmt = untyped_str(token_fmt("arr_exp", arr_exp, - "// Had to hardcode _PAD_ because () was 67 bytes in C (Injected C++ size_of(AST_::_PAD_) from C++ side)\n" + "// Had to hardcode _PAD_ because () was 67 bytes in C\n" )); } } diff --git a/scripts/.clang-format b/scripts/.clang-format index 06dbeaa..a33ffe6 100644 --- a/scripts/.clang-format +++ b/scripts/.clang-format @@ -1,9 +1,23 @@ # Format Style Options - Created with Clang Power Tools --- -AttributeMacros: [enum_underlying] -StatementMacros: [GEN_NS_BEGIN, GEN_NS_END, GEN_NS_PARSER_BEGIN, GEN_NS_PARSER_END, GEN_API_C_BEGIN, GEN_API_C_END] + +# AttributeMacros: [ +# ] +StatementMacros: [ + GEN_NS_BEGIN, + GEN_NS_END, + GEN_NS_PARSER_BEGIN, + GEN_NS_PARSER_END, + GEN_API_C_BEGIN, + GEN_API_C_END, + GEN_IF_MACRO_DEFINED_INCLUDE_THIS_SLOT +] +Macros: +- enum_underlying(type)=type +- gen_enum_underlying(type)=type + TypenameMacros: [Array, Hashtable] -SkipMacroDefinitionBody: true +SkipMacroDefinitionBody: false AccessModifierOffset: -4