glib-genmarshal: wrap prototypes in G_{BEGIN,END}_DECLS.

Since --header --body has been deprecated and replaced with --body
--prototypes, the generated body is not wrapped with G_{BEGIN,END}_DECLS
any longer. Projects using C++ break due to that. Automatically wrap
prototypes individually in G_{BEGIN,END}_DECLS instead.

https://bugzilla.gnome.org/show_bug.cgi?id=785554
This commit is contained in:
Mihai Moldovan 2017-07-29 09:09:39 +02:00 committed by Philip Withnall
parent c4dc30e2a3
commit 31ae2c5598

View File

@ -556,7 +556,7 @@ def generate_prototype(retval, params,
va_marshal=False):
'''Generate a marshaller declaration with the given @visibility. If @va_marshal
is True, the marshaller will use variadic arguments in place of a GValue array.'''
signature = []
signature = ['G_BEGIN_DECLS']
if visibility == Visibility.INTERNAL:
signature += ['G_GNUC_INTERNAL']
@ -585,6 +585,8 @@ def generate_prototype(retval, params,
signature += [indent('int n_params,', level=width, fill=' ')]
signature += [indent('GType *param_types);', level=width, fill=' ')]
signature += ['G_END_DECLS']
return signature