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 486102 - Provide a way to include files before any generated code
Provide a way to include files before any generated code
Status: RESOLVED FIXED
Product: glibmm
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtkmm-forge
gtkmm-forge
Depends on:
Blocks: 486104
 
 
Reported: 2007-10-12 18:18 UTC by Armin Burgmeier
Modified: 2007-10-12 20:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1.67 KB, patch)
2007-10-12 18:20 UTC, Armin Burgmeier
committed Details | Review

Description Armin Burgmeier 2007-10-12 18:18:21 UTC
gmmproc automatically generates a "#ifndef *_DISABLE_DEPRECATED" guard around headers of deprecated classes. However, third-party code including that header has no way to find out (at compile time) whether the deprecated API is available or not because the *_DISABLE_DEPRECATED is never defined there. This can lead such code to compile correctly, but fail to link.

gmmproc should probably allow code to be put before that "#ifndef *_DISABLE_DEPRECATED" in the header file so that affected classes can make sure that the define is always present if necessary, also when included from non-library code.
Comment 1 Armin Burgmeier 2007-10-12 18:20:31 UTC
Created attachment 97132 [details] [review]
Proposed patch

This patch adds a corresponding m4 section and a _CONFIGINCLUDE macro that allows to include a file there. It is called _CONFIGINCLUDE because it is intended to include, for example <gtkmmconfig.h> to which the GTKMM_DISABLE_DEPRECATED define can be added (I am going to open another bug for this).
Comment 2 Murray Cumming 2007-10-12 19:27:32 UTC
Well done. But please add more comments saying that we are using the macro so that the config header is included before the #ifndef block around all the rest of the generated code. We should probably mention that in a comment whenever we use the macro, because it will be easy to forget this logic.
Comment 3 Murray Cumming 2007-10-12 19:28:05 UTC
By the way, feel free to commit this to whatever branches you need it in (and any branches after that, including trunk)
Comment 4 Armin Burgmeier 2007-10-12 20:01:30 UTC
I added a corresponding comment to the definition in base.m4 and am going to add another one wherever the macro is used. I committed the patch to glibmm-2-12, glibmm-2-14 and trunk.