GNOME Bugzilla – Bug 486102
Provide a way to include files before any generated code
Last modified: 2007-10-12 20:01:30 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.
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).
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.
By the way, feel free to commit this to whatever branches you need it in (and any branches after that, including trunk)
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.