The attached patch allows to add GCC attributes to methods, using a
syntax borrowed from C#. For instance:
[G_GNUC_PRINTF(1, 2)]
private void say_something (const char *format, ...)
{
}
The text enclosed in brackets is not parsed (the lexer returns a CCODE
token). It is inserted verbatim in the function declaration, before
the trailing semicolon.
With this patch, gob no longer unconditionally adds G_GNUC_UNUSED to
methods, which is a bad idea since it might hide programming
errors. Users should now specify it manually when needed.
Attributes are not supported for overriden methods since these methods
are not meant to be called directly. For signals and virtual methods,
the attributes are added to the declaration of the invocation wrapper,
but not to the "__real" default implementation method that gob emits.
Two patches are provided:
gob2-2.0.15-attr.diff
The attributes feature alone.
gob2-2.0.15-gobject-overrides-and-attr.diff
The attributes feature and another feature I've
implemented previously (see the message with subject
"patch adding first-class support of
constructor/dispose/finalize methods"). This unified
patch is provided because the two individual patches
conflict with each other and require merging.
-- Jean-Yves Lefort <jylefort_at_brutele.be>
This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT