Skip to content

Commit 13ebd10

Browse files
committed
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.
1 parent bdd9c9b commit 13ebd10

2 files changed

Lines changed: 21 additions & 8 deletions

File tree

gen_c_library/components/misc.hpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,19 @@ void convert_cpp_enum_to_c( CodeEnum to_convert, CodeBody to_append )
77
{
88
#pragma push_macro("enum_underlying")
99
#undef enum_underlying
10-
StrCached type = to_convert->UnderlyingType ? to_convert->UnderlyingType.to_strbuilder().to_str() : to_convert->Name;
11-
CodeTypedef tdef = parse_typedef(token_fmt("type", type, "name", to_convert->Name, stringize( typedef enum <type> <name>; )));
10+
StrCached type;
11+
CodeTypedef tdef;
12+
if (to_convert->UnderlyingType)
13+
{
14+
type = to_convert->UnderlyingType.to_strbuilder().to_str();
15+
tdef = parse_typedef(token_fmt("type", type, "name", to_convert->Name, stringize( typedef <type> <name>; )));
16+
}
17+
else
18+
{
19+
type = to_convert->Name;
20+
tdef = parse_typedef(token_fmt("type", type, "name", to_convert->Name, stringize( typedef enum <type> <name>; )));
21+
22+
}
1223
if (to_convert->UnderlyingType)
1324
{
1425
to_convert->UnderlyingTypeMacro = untyped_str(token_fmt("type", to_convert->UnderlyingType->Name, stringize(enum_underlying(<type>))));

scripts/helpers/vendor_toolchain.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -344,15 +344,17 @@ if ( $vendor -match "clang" )
344344
}
345345

346346
# Check if output is a static library
347-
# if ( $binary -match '\.lib$' )
348-
# {
349-
# $lib_args = @()
347+
if ( $binary -match '\.lib$' )
348+
{
349+
$lib_args = @()
350350
# $lib_args += $flag_nologo
351351
# $lib_args += $flag_link_win_machine_64
352352
# $lib_args += ( $flag_link_win_path_output + $binary )
353-
# $lib_args += $object
354-
# return run-archiver $archiver $binary $lib_args
355-
# }
353+
# $lib_args += '--format=windows'
354+
# $lib_args += '-X64'
355+
$lib_args += $object
356+
return run-archiver $archiver $binary $lib_args
357+
}
356358

357359
$linker_args += $object
358360
return run-linker $linker $binary $linker_args

0 commit comments

Comments
 (0)