Description of problem: When cross-compiling for mingw, and attempting to use the identifier 'interface' (which is reserved for the user according to C99), compilation fails under mingw. While trying to cross-compile libvirt, I ended up with failed compilation where dbus tried to use 'interface' as a parameter name in a function prototype, but where an earlier '#define interface ...' in the system rpc.h caused syntax failures. Although I noticed it with libvirt, the case below is stripped down to the bare minimum for easier testing. Version-Release number of selected component (if applicable): mingw32-headers-2.0.999-0.15.trunk.20121110.fc18.noarch mingw32-dbus-1.6.8-1.fc18.noarch How reproducible: 100% Steps to Reproduce: 1. cat foo.c 2. i686-w64-mingw32-gcc -c \ -I /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0 \ -I /usr/i686-w64-mingw32/sys-root/mingw/lib/dbus-1.0/include \ foo.c 3. cat bar.c 4. i686-w64-mingw32-gcc -c bar.c Actual results: 1. #include <rpc.h> #include <dbus/dbus.h> int dummy; 2. In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-connection.h:32:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-bus.h:30, from /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus.h:31, from foo.c:2: /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:74:58: error: expected ';', ',' or ')' before 'struct' /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:80:58: error: expected ';', ',' or ')' before 'struct' /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:111:58: error: expected ';', ',' or ')' before 'struct' /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:116:58: error: expected ';', ',' or ')' before 'struct' /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:149:58: error: expected ';', ',' or ')' before 'struct' /usr/i686-w64-mingw32/sys-root/mingw/include/dbus-1.0/dbus/dbus-message.h:153:58: error: expected ';', ',' or ')' before 'struct' 3. #include <rpc.h> #define interface int dummy; 4. bar.c:2:0: warning: "interface" redefined [enabled by default] In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/oleidl.h:7:0, from /usr/i686-w64-mingw32/sys-root/mingw/include/ole2.h:38, from /usr/i686-w64-mingw32/sys-root/mingw/include/wtypes.h:12, from /usr/i686-w64-mingw32/sys-root/mingw/include/winscard.h:10, from /usr/i686-w64-mingw32/sys-root/mingw/include/windows.h:97, from /usr/i686-w64-mingw32/sys-root/mingw/include/rpc.h:16, from bar.c:1: /usr/i686-w64-mingw32/sys-root/mingw/include/rpc.h:12:0: note: this is the location of the previous definition Expected results: rpc.h should be namespace-clean, and should not leave 'interface' defined to interfere with subsequent valid C99 use of this identifier. Additional info: Yes, it could also be argued that dbus shouldn't be using the name 'interface' in its header prototypes, so I'll file a bug there, too.
(In reply to Eric Blake from comment #0) > > Additional info: > Yes, it could also be argued that dbus shouldn't be using the name > 'interface' in its header prototypes, so I'll file a bug there, too. bug 980278 for that argument
I'm aware of the issue and I've also got hit by it on multiple occasions (as can be seen at https://bugzilla.gnome.org/show_bug.cgi?id=656402). However, the keyword 'interface' is a reserved keyword on Windows environments according to MSDN: http://msdn.microsoft.com/en-us/library/vstudio/2kb28261.aspx Therefore I can't fix this in the mingw-w64 headers. If you still wish to pursue this issue I would recommend you to contact the upstream mingw-w64 developers and try to get it resolved there. For downstream packages (like dbus) I would recommend to avoid using the 'interface' keyword in public headers. For this you've already created a separate bug report so I'll close this one.