wireplumber-0.5: Redefinition of G_LOG_DOMAIN causes problems with giomm headers
While porting Waybar to wireplumber-0.5 I ran into the following build error due to the redefinition of G_LOG_DOMAIN
in wp/log.h
and a subsequent include of glibmm headers:
In file included from ../src/modules/wireplumber.cpp:1:
In file included from ../include/modules/wireplumber.hpp:9:
In file included from ../include/ALabel.hpp:4:
In file included from /usr/x86_64-pc-linux-musl/include/gtkmm-3.0/gtkmm/label.h:27:
In file included from /usr/x86_64-pc-linux-musl/include/gtkmm-3.0/gtkmm/misc.h:27:
In file included from /usr/x86_64-pc-linux-musl/include/gtkmm-3.0/gtkmm/widget.h:31:
In file included from /usr/x86_64-pc-linux-musl/include/pangomm-1.4/pangomm/context.h:29:
In file included from /usr/x86_64-pc-linux-musl/include/glibmm-2.4/glibmm/object.h:30:
/usr/x86_64-pc-linux-musl/include/glibmm-2.4/glibmm/wrap.h:92:7: error: use of undeclared identifier 'WP_LOCAL_LOG_TOPIC'
92 | g_warning("Glib::wrap_auto_interface(): The C++ instance (%s) does not dynamic_cast to the "
| ^
/usr/x86_64-pc-linux-musl/include/glib-2.0/glib/gmessages.h:362:32: note: expanded from macro 'g_warning'
362 | #define g_warning(...) g_log (G_LOG_DOMAIN, \
| ^
/usr/x86_64-pc-linux-musl/include/wireplumber-0.5/wp/log.h:63:23: note: expanded from macro 'G_LOG_DOMAIN'
63 | #define G_LOG_DOMAIN (WP_LOCAL_LOG_TOPIC->topic_name)
| ^
The problem can be reproduced using the following snippet:
#include <wp/wp.h>
#include <gtkmm/label.h>
compiled with:
clang++ -c wp-test.c $(pkg-config --cflags wireplumber-0.5 gtkmm-3.0)
This is with gtkmm-3.24.8, glibmm-2.66.6
Changing the order of includes works around the problem, but it would be nicer if there's a solution that doesn't require to change existing code