From 843b2d19698a00b779c51cda26771683c4a72e84 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Tue, 11 Jun 2024 16:56:27 +0200 Subject: [PATCH] Library Forwarding/GL: Assume void* always points to compatible data --- ThunkLibs/Generator/gen.cpp | 2 +- ThunkLibs/libGL/libGL_interface.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ThunkLibs/Generator/gen.cpp b/ThunkLibs/Generator/gen.cpp index 6b804ce53..7cbecc3ac 100644 --- a/ThunkLibs/Generator/gen.cpp +++ b/ThunkLibs/Generator/gen.cpp @@ -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); } diff --git a/ThunkLibs/libGL/libGL_interface.cpp b/ThunkLibs/libGL/libGL_interface.cpp index a5a29c907..175bb793b 100644 --- a/ThunkLibs/libGL/libGL_interface.cpp +++ b/ThunkLibs/libGL/libGL_interface.cpp @@ -38,6 +38,11 @@ struct fex_gen_config : fexgen::custom_guest_entrypoint, template 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 : fexgen::opaque_type {}; + template<> struct fex_gen_type> : fexgen::opaque_type {}; template<>