Library Forwarding/GL: Assume void* always points to compatible data

This commit is contained in:
Tony Wasserka 2024-06-11 16:56:27 +02:00
parent b275c96889
commit 843b2d1969
2 changed files with 6 additions and 1 deletions

View File

@ -144,7 +144,7 @@ void GenerateThunkLibsAction::EmitLayoutWrappers(clang::ASTContext& context, std
auto struct_name = get_type_name(context, type);
// Opaque types don't need layout definitions
if (type_repack_info.assumed_compatible && type_repack_info.pointers_only) {
if (type_repack_info.assumed_compatible && type_repack_info.pointers_only && struct_name != "void") {
if (guest_abi.pointer_size != 4) {
fmt::print(file, "template<> inline constexpr bool has_compatible_data_layout<{}*> = true;\n", struct_name);
}

View File

@ -38,6 +38,11 @@ struct fex_gen_config<SetGuestXDisplayString> : fexgen::custom_guest_entrypoint,
template<typename>
struct fex_gen_type {};
// Assume void* always points to data with consistent layout.
// It's used in too many functions to annotate them all.
template<>
struct fex_gen_type<void> : fexgen::opaque_type {};
template<>
struct fex_gen_type<std::remove_pointer_t<GLXContext>> : fexgen::opaque_type {};
template<>