After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 640654 - GDK_DISABLE_DEPRECATED broken for gtkmm
GDK_DISABLE_DEPRECATED broken for gtkmm
Status: RESOLVED OBSOLETE
Product: gtkmm
Classification: Bindings
Component: gdkmm
2.23.x
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks:
 
 
Reported: 2011-01-26 17:19 UTC by Chris Kühl
Modified: 2013-09-18 08:22 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Chris Kühl 2011-01-26 17:19:28 UTC
When using GDK_DISABLE_DEPRECATED gtkmm cannot borks the build on symbols not in my project.

I ran into a problem when using the following compile flags while porting gnome-system-monitor to gtkmm version 2.23.

make -j4 CPPFLAGS+="-Wfatal-errors -DGTK_DISABLE_DEPRECATED
-DGDK_DISABLE_DEPRECATED"

This produces the following error

In file included from /opt/gnome/include/gdkmm-2.4/gdkmm/drawable.h:32,
                 from /opt/gnome/include/gdkmm-2.4/gdkmm/pixbuf.h:32,
                 from prettytable.h:9,
                 from procman.h:41,
                 from interface.cpp:33:
/opt/gnome/include/gdkmm-2.4/gdkmm/region.h:267: error: ‘GdkSpanFunc’
has not been declared
compilation terminated due to -Wfatal-errors.
make[2]: *** [interface.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /opt/gnome/include/gdkmm-2.4/gdkmm/drawable.h:32,
                 from /opt/gnome/include/gdkmm-2.4/gdkmm/pixbuf.h:32,
                 from prettytable.h:9,
                 from procman.h:41,
                 from procman.cpp:40:
/opt/gnome/include/gdkmm-2.4/gdkmm/region.h:267: error: ‘GdkSpanFunc’
has not been declared
compilation terminated due to -Wfatal-errors.
make[2]: *** [procman.o] Error 1
In file included from /opt/gnome/include/gdkmm-2.4/gdkmm/drawable.h:32,
                 from /opt/gnome/include/gdkmm-2.4/gdkmm/pixbuf.h:32,
                 from prettytable.h:9,
                 from procman.h:41,
                 from callbacks.h:25,
                 from callbacks.cpp:28:
/opt/gnome/include/gdkmm-2.4/gdkmm/region.h:267: error: ‘GdkSpanFunc’
has not been declared
compilation terminated due to -Wfatal-errors.

Based on what we see in the in the header file region.h this should not
happen, right?

// We use GdkSpanFunc in the (deprecated) API, so we must temporarily
undef GDK_DISABLE_DEPRECATED.
// We shouldn't have used that C type in the API anyway, but we can't
break API.
// Temporarily undef GDK_DISABLE_DEPRECATED, redefining it later if
appropriate.
// We need this to use _GtkBoxChild, which we use in our (deprecated)
API.
#if defined(GDK_DISABLE_DEPRECATED) && !
defined(GTKMM_GDK_DISABLE_DEPRECATED_UNDEFED)
#undef GDK_DISABLE_DEPRECATED
#define GTKMM_GDK_DISABLE_DEPRECATED_UNDEFED 1
#endif

// This is for dragcontext which is often included after color.h, which
we can't avoid.
// We use GdkDragContext members in the (deprecated) API, for which
there are no replacements,
// so we must temporarily undef GSEAL_ENABLE.
// Temporarily undef GSEAL_ENABLE, redefining it later if appropriate.
#if defined(GSEAL_ENABLE) && !defined(GTKMM_GSEAL_ENABLE_UNDEFED)
#undef GSEAL_ENABLE
#define GTKMM_GSEAL_ENABLE_UNDEFED 1
#endif

#include <gdk/gdk.h>

// Redefine GDK_DISABLE_DEPRECATED if it was defined before we
temporarily undefed it:
#if defined(GTKMM_GDK_DISABLE_DEPRECATED_UNDEFED)
#define GDK_DISABLE_DEPRECATED 1
#undef GTKMM_GDK_DISABLE_DEPRECATED_UNDEFED
#endif

// Redefine GSEAL_ENABLE if it was defined before we temporarily undefed
it:
#if defined(GTKMM_GSEAL_ENABLE_UNDEFED)
#define GSEAL_ENABLE 1
#undef GTKMM_GSEAL_ENABLE_UNDEFED
#endif

In order to find the deprecated symbols I need to be able use the above
flags but I can't get any further because gtkmm is blocking me.
Comment 1 Murray Cumming 2011-01-27 05:44:47 UTC
Yes, I don't know what is causing this. When I see it, I currently just reorder some header includes as a workaround.
Comment 2 Kjell Ahlstedt 2011-03-08 08:54:17 UTC
gdk/gdk.h is included by gdkmm/device.h, rectangle.h, region.h and types.h.
Only region.h temporarily undefines GDK_DISABLE_DEPRECATED while gdk/gdk.h is
included. If any of [device.h, rectangle.h, types.h] is included (directly or
indirectly via other header files) before region.h, gdk/gdk.h will be included
with GDK_DISABLE_DEPRECATED defined. Due to the double-inclusion protection in
every header file, all the following inclusions of gdk/gdk.h have no effect.

If you include region.h before any of the other mentioned gdkmm header files,
you won't get compilation errors due to a missing declaration of GdkSpanFunc,
but since all gdk header files will be included with GDK_DISABLE_DEPRECATED
undefined, your definition of GDK_DISABLE_DEPRECATED in the make command will
be quite useless, when you compile a cpp file that includes gdkmm/region.h.
If you want to disable deprecated API in gtkmm you should define
GDKMM_DISABLE_DEPRECATED and GTKMM_DISABLE_DEPRECATED.

This is the same kind of problem as reported in bug 640948. In that bug
GTK_DISABLE_DEPRECATED is temporarily undefined in gtkmm/box.h while gtk/gtk.h
is included.
Comment 3 Murray Cumming 2011-03-09 12:25:37 UTC
Thanks. Maybe we just need our own gdkmmgdk.h (or a better name) header file to include instead of gdk.h.
Comment 4 Murray Cumming 2012-07-16 08:48:27 UTC
Is this still a problem?
Comment 5 Kjell Ahlstedt 2012-09-28 12:07:14 UTC
Gdk::Region has been removed in gtkmm 3. This can't be a problem in gtkmm 3.

Shall we keep such bugs as this one open? A bug only in gtkmm 2 that will
almost certainly never be fixed in gtkmm 2.
Comment 6 Murray Cumming 2013-09-18 08:22:38 UTC
It would be nice to make it easier to move from gtkmm 2 to gtkmm 3, if there is a problem with that. But it's not a big problem now, and we don't have a way to reproduce the problem, so let's not bother unless it's affecting someone else.