mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-03 17:56:17 +01:00
genmarshal Only wrap body prototypes in C++ guards
Commit 31ae2c5598
added the C++ guards
around all prototypes, including inside the header file. The header
file, though, already has C++ guards, so while it's harmless to have
them there, it's also unnecessary.
We should only emit C++ guards around the prototypes we include in the
generated source.
This commit is contained in:
parent
9ff6f24a58
commit
100b83a7fa
@ -556,7 +556,7 @@ def generate_prototype(retval, params,
|
|||||||
va_marshal=False):
|
va_marshal=False):
|
||||||
'''Generate a marshaller declaration with the given @visibility. If @va_marshal
|
'''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.'''
|
is True, the marshaller will use variadic arguments in place of a GValue array.'''
|
||||||
signature = ['G_BEGIN_DECLS']
|
signature = []
|
||||||
|
|
||||||
if visibility == Visibility.INTERNAL:
|
if visibility == Visibility.INTERNAL:
|
||||||
signature += ['G_GNUC_INTERNAL']
|
signature += ['G_GNUC_INTERNAL']
|
||||||
@ -585,8 +585,6 @@ def generate_prototype(retval, params,
|
|||||||
signature += [indent('int n_params,', level=width, fill=' ')]
|
signature += [indent('int n_params,', level=width, fill=' ')]
|
||||||
signature += [indent('GType *param_types);', level=width, fill=' ')]
|
signature += [indent('GType *param_types);', level=width, fill=' ')]
|
||||||
|
|
||||||
signature += ['G_END_DECLS']
|
|
||||||
|
|
||||||
return signature
|
return signature
|
||||||
|
|
||||||
|
|
||||||
@ -822,7 +820,11 @@ def generate_marshallers_body(outfile, retval, params,
|
|||||||
else:
|
else:
|
||||||
decl_visibility = Visibility.EXTERN
|
decl_visibility = Visibility.EXTERN
|
||||||
proto = ['/* Prototype for -Wmissing-prototypes */']
|
proto = ['/* Prototype for -Wmissing-prototypes */']
|
||||||
|
# Add C++ guards in case somebody compiles the generated code
|
||||||
|
# with a C++ compiler
|
||||||
|
proto += ['G_BEGIN_DECLS']
|
||||||
proto += generate_prototype(retval, params, prefix, decl_visibility, False)
|
proto += generate_prototype(retval, params, prefix, decl_visibility, False)
|
||||||
|
proto += ['G_END_DECLS']
|
||||||
outfile.write('\n'.join(proto))
|
outfile.write('\n'.join(proto))
|
||||||
outfile.write('\n')
|
outfile.write('\n')
|
||||||
|
|
||||||
@ -838,7 +840,10 @@ def generate_marshallers_body(outfile, retval, params,
|
|||||||
else:
|
else:
|
||||||
decl_visibility = Visibility.EXTERN
|
decl_visibility = Visibility.EXTERN
|
||||||
proto = ['/* Prototype for -Wmissing-prototypes */']
|
proto = ['/* Prototype for -Wmissing-prototypes */']
|
||||||
|
# Add C++ guards here as well
|
||||||
|
proto += ['G_BEGIN_DECLS']
|
||||||
proto += generate_prototype(retval, params, prefix, decl_visibility, True)
|
proto += generate_prototype(retval, params, prefix, decl_visibility, True)
|
||||||
|
proto += ['G_END_DECLS']
|
||||||
outfile.write('\n'.join(proto))
|
outfile.write('\n'.join(proto))
|
||||||
outfile.write('\n')
|
outfile.write('\n')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user