glibmm r735 - in trunk: . gio/src tests/giomm_ioerror
- From: jjongsma svn gnome org
- To: svn-commits-list gnome org
- Subject: glibmm r735 - in trunk: . gio/src tests/giomm_ioerror
- Date: Sun, 5 Oct 2008 04:58:47 +0000 (UTC)
Author: jjongsma
Date: Sun Oct 5 04:58:47 2008
New Revision: 735
URL: http://svn.gnome.org/viewvc/glibmm?rev=735&view=rev
Log:
Add a workaround for the HOST_NOT_FOUND symbol conflicts
As suggested by SzilÃrd Pfeiffer in Bug #529496
* tests/giomm_ioerror/main.cc: add a test for this
Modified:
trunk/ChangeLog
trunk/gio/src/error.hg
trunk/tests/giomm_ioerror/main.cc
Modified: trunk/gio/src/error.hg
==============================================================================
--- trunk/gio/src/error.hg (original)
+++ trunk/gio/src/error.hg Sun Oct 5 04:58:47 2008
@@ -19,6 +19,16 @@
#include <glibmm/interface.h>
+// There have been issues with other libraries defining HOST_NOT_FOUND (e.g.
+// netdb.h). As a workaround, we added the alternate name HOST_WAS_NOT_FOUND.
+// Portable code should not use HOST_NOT_FOUND. Undefining it here (and
+// restoring it below) will allow programs to compile even if they include
+// netdb.h. See Bug #529496
+#ifdef HOST_NOT_FOUND
+#define GIOMM_SAVED_HOST_NOT_FOUND HOST_NOT_FOUND
+#undef HOST_NOT_FOUND
+#endif // HOST_NOT_FOUND
+
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
@@ -35,3 +45,8 @@
} // namespace Gio
+#ifdef GIOMM_SAVED_HOST_NOT_FOUND
+// restore the previously-defined HOST_NOT_FOUND macro
+#define HOST_NOT_FOUND GIOMM_SAVED_HOST_NOT_FOUND
+#undef GIOMM_SAVED_HOST_NOT_FOUND
+#endif // GIOMM_SAVED_HOST_NOT_FOUND
Modified: trunk/tests/giomm_ioerror/main.cc
==============================================================================
--- trunk/tests/giomm_ioerror/main.cc (original)
+++ trunk/tests/giomm_ioerror/main.cc Sun Oct 5 04:58:47 2008
@@ -1,7 +1,19 @@
+// Some libraries define HOST_NOT_FOUND. Make sure we can still compile fine
+// even if this is the case:
+#define HOST_NOT_FOUND 1
+
#include <giomm.h>
#include <iostream>
#include <string.h>
+// This is just to test a workaround in the error.h header. We save and #undef
+// HOST_NOT_FOUND if it was defined by another header, and then restore it at
+// the end of the header. Here I'm just making sure that our temporary value
+// doesn't remain set
+#ifdef GIOMM_SAVED_HOST_NOT_FOUND
+#error Forgot to #undef GIOMM_SAVED_HOST_NOT_FOUND
+#endif
+
int main(int argc, char** argv)
{
Glib::init();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]