making binding generator output explicit void for functions with no parameters. Fix oc_surface_canvas/oc_surface_gles to take explicit void

This commit is contained in:
Martin Fouilleul 2023-09-28 21:29:03 +02:00
parent d5bd7ea2bb
commit 549e640102
2 changed files with 236 additions and 230 deletions

View File

@ -61,6 +61,8 @@ def bindgen(apiName, spec, **kwargs):
s += decl['ret']['name'] + '* __retArg' s += decl['ret']['name'] + '* __retArg'
if len(decl['args']) > 0: if len(decl['args']) > 0:
s += ', ' s += ', '
elif len(decl['args']) == 0:
s += 'void'
for i, arg in enumerate(decl['args']): for i, arg in enumerate(decl['args']):
s += arg['type']['name'] s += arg['type']['name']
@ -73,6 +75,10 @@ def bindgen(apiName, spec, **kwargs):
# forward function to pointer arg stub declaration # forward function to pointer arg stub declaration
s += decl['ret']['name'] + ' ' + name + '(' s += decl['ret']['name'] + ' ' + name + '('
if len(decl['args']) == 0:
s += 'void'
for i, arg in enumerate(decl['args']): for i, arg in enumerate(decl['args']):
s += arg['type']['name'] + ' ' + arg['name'] s += arg['type']['name'] + ' ' + arg['name']
if i+1 < len(decl['args']): if i+1 < len(decl['args']):

View File

@ -110,8 +110,8 @@ ORCA_API void oc_surface_set_hidden(oc_surface surface, bool hidden);
#else #else
ORCA_API oc_surface oc_surface_canvas(); //DOC: creates a surface for use with the canvas API ORCA_API oc_surface oc_surface_canvas(void); //DOC: creates a surface for use with the canvas API
ORCA_API oc_surface oc_surface_gles(); //DOC: create a surface for use with GLES API ORCA_API oc_surface oc_surface_gles(void); //DOC: create a surface for use with GLES API
#endif #endif