From 6c6bb67a87931024afaf667b27343e48fe49808c Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 10 Oct 2025 08:44:01 -0400 Subject: [PATCH] fix: Restore Windows macro definitions to prevent conflicts with protobuf generated code - Added preprocessor directives to push and pop the DWORD and ERROR macros in widget_discovery_service.h, rom_service_impl.h, and gui_automation_client.h. - This change ensures compatibility with protobuf generated code in a Windows environment, preventing potential compilation issues. --- src/app/core/service/widget_discovery_service.h | 10 ++++++++++ src/app/net/rom_service_impl.h | 10 ++++++++++ src/cli/service/gui/gui_automation_client.h | 13 +++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/app/core/service/widget_discovery_service.h b/src/app/core/service/widget_discovery_service.h index b7ead6bd..ca0d03e1 100644 --- a/src/app/core/service/widget_discovery_service.h +++ b/src/app/core/service/widget_discovery_service.h @@ -5,7 +5,17 @@ #include #include "absl/strings/string_view.h" +#ifdef _WIN32 +#pragma push_macro("DWORD") +#pragma push_macro("ERROR") +#undef DWORD +#undef ERROR +#endif // _WIN32 #include "protos/imgui_test_harness.pb.h" +#ifdef _WIN32 +#pragma pop_macro("DWORD") +#pragma pop_macro("ERROR") +#endif // _WIN32 #include "app/gui/widgets/widget_id_registry.h" #if defined(YAZE_ENABLE_IMGUI_TEST_ENGINE) && YAZE_ENABLE_IMGUI_TEST_ENGINE diff --git a/src/app/net/rom_service_impl.h b/src/app/net/rom_service_impl.h index dae19b2f..e09f1666 100644 --- a/src/app/net/rom_service_impl.h +++ b/src/app/net/rom_service_impl.h @@ -8,8 +8,18 @@ #include "absl/status/statusor.h" #ifdef YAZE_WITH_GRPC +#ifdef _WIN32 +#pragma push_macro("DWORD") +#pragma push_macro("ERROR") +#undef DWORD +#undef ERROR +#endif // _WIN32 #include #include "protos/rom_service.grpc.pb.h" +#ifdef _WIN32 +#pragma pop_macro("DWORD") +#pragma pop_macro("ERROR") +#endif // _WIN32 // Note: Proto files will be generated to build directory #endif diff --git a/src/cli/service/gui/gui_automation_client.h b/src/cli/service/gui/gui_automation_client.h index fd985e5d..7773e887 100644 --- a/src/cli/service/gui/gui_automation_client.h +++ b/src/cli/service/gui/gui_automation_client.h @@ -19,15 +19,20 @@ #ifdef YAZE_WITH_GRPC // Undefine Windows macros that conflict with protobuf generated code #ifdef _WIN32 -#ifdef DWORD +#pragma push_macro("DWORD") +#pragma push_macro("ERROR") #undef DWORD -#endif -#ifdef ERROR #undef ERROR -#endif #endif // _WIN32 + #include #include "protos/imgui_test_harness.grpc.pb.h" + +// Restore Windows macros +#ifdef _WIN32 +#pragma pop_macro("DWORD") +#pragma pop_macro("ERROR") +#endif #endif namespace yaze {