Fix for convert_cpp_enum_to_c for gen_c_library

It wasn't generating correct typedefs for when underlying type was used over the enum name.
This commit is contained in:
Edward R. Gonzalez 2025-01-30 14:14:53 -05:00
parent bdd9c9bcdf
commit 13ebd105c4
2 changed files with 21 additions and 8 deletions

View File

@ -7,8 +7,19 @@ void convert_cpp_enum_to_c( CodeEnum to_convert, CodeBody to_append )
{ {
#pragma push_macro("enum_underlying") #pragma push_macro("enum_underlying")
#undef enum_underlying #undef enum_underlying
StrCached type = to_convert->UnderlyingType ? to_convert->UnderlyingType.to_strbuilder().to_str() : to_convert->Name; StrCached type;
CodeTypedef tdef = parse_typedef(token_fmt("type", type, "name", to_convert->Name, stringize( typedef enum <type> <name>; ))); CodeTypedef tdef;
if (to_convert->UnderlyingType)
{
type = to_convert->UnderlyingType.to_strbuilder().to_str();
tdef = parse_typedef(token_fmt("type", type, "name", to_convert->Name, stringize( typedef <type> <name>; )));
}
else
{
type = to_convert->Name;
tdef = parse_typedef(token_fmt("type", type, "name", to_convert->Name, stringize( typedef enum <type> <name>; )));
}
if (to_convert->UnderlyingType) if (to_convert->UnderlyingType)
{ {
to_convert->UnderlyingTypeMacro = untyped_str(token_fmt("type", to_convert->UnderlyingType->Name, stringize(enum_underlying(<type>)))); to_convert->UnderlyingTypeMacro = untyped_str(token_fmt("type", to_convert->UnderlyingType->Name, stringize(enum_underlying(<type>))));

View File

@ -344,15 +344,17 @@ if ( $vendor -match "clang" )
} }
# Check if output is a static library # Check if output is a static library
# if ( $binary -match '\.lib$' ) if ( $binary -match '\.lib$' )
# { {
# $lib_args = @() $lib_args = @()
# $lib_args += $flag_nologo # $lib_args += $flag_nologo
# $lib_args += $flag_link_win_machine_64 # $lib_args += $flag_link_win_machine_64
# $lib_args += ( $flag_link_win_path_output + $binary ) # $lib_args += ( $flag_link_win_path_output + $binary )
# $lib_args += $object # $lib_args += '--format=windows'
# return run-archiver $archiver $binary $lib_args # $lib_args += '-X64'
# } $lib_args += $object
return run-archiver $archiver $binary $lib_args
}
$linker_args += $object $linker_args += $object
return run-linker $linker $binary $linker_args return run-linker $linker $binary $linker_args