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.
This commit is contained in:
scawful
2025-10-10 08:44:01 -04:00
parent 78b7d38359
commit 6c6bb67a87
3 changed files with 29 additions and 4 deletions

View File

@@ -5,7 +5,17 @@
#include <vector>
#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

View File

@@ -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 <grpcpp/grpcpp.h>
#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

View File

@@ -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 <grpcpp/grpcpp.h>
#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 {