Skip to content

Commit

Permalink
boilerplate_generator: Annotate stub func args as G_GNUC_UNUSED
Browse files Browse the repository at this point in the history
  • Loading branch information
tbzatek committed Jul 3, 2023
1 parent 01a42b8 commit 0ee4438
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/boilerplate_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ def get_arg_names(args):

def get_func_boilerplate(fn_info):
call_args_str = ", ".join(get_arg_names(fn_info.args))
args_ann_unused = fn_info.args.replace(",", " G_GNUC_UNUSED,")

if "int" in fn_info.rtype:
default_ret = "0"
Expand All @@ -159,12 +160,12 @@ def get_func_boilerplate(fn_info):
default_ret = 0

# first add the stub function doing nothing and just reporting error
ret = ("static {0.rtype} {0.name}_stub ({0.args}) {{\n" +
ret = ("static {0.rtype} {0.name}_stub ({2}) {{\n" +
" g_critical (\"The function '{0.name}' called, but not implemented!\");\n" +
" g_set_error (error, BD_INIT_ERROR, BD_INIT_ERROR_NOT_IMPLEMENTED,\n"+
" \"The function '{0.name}' called, but not implemented!\");\n"
" return {1};\n"
"}}\n\n").format(fn_info, default_ret)
"}}\n\n").format(fn_info, default_ret, args_ann_unused)

# then add a variable holding a reference to the dynamically loaded function
# (if any) initialized to the stub
Expand Down

0 comments on commit 0ee4438

Please sign in to comment.