Module: wine Branch: master Commit: dd58fcc10edb1d3b9d96151cded067e1631a54ed URL: http://source.winehq.org/git/wine.git/?a=commit;h=dd58fcc10edb1d3b9d96151cde...
Author: Jacek Caban jacek@codeweavers.com Date: Sun Jul 26 18:07:37 2015 +0200
widl: Don't output C++ default value if the argument is followed by another without default value.
---
tools/widl/header.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/tools/widl/header.c b/tools/widl/header.c index c23faf4..bf824d8 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -937,8 +937,18 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i if (method == 2) { const expr_t *expr = get_attrp(arg->attrs, ATTR_DEFAULTVALUE); if (expr) { - fprintf(h, " = "); - write_expr( h, expr, 0, 1, NULL, NULL, "" ); + const var_t *tail_arg; + + /* Output default value only if all following arguments also have default value. */ + LIST_FOR_EACH_ENTRY_REV( tail_arg, args, const var_t, entry ) { + if(tail_arg == arg) { + fprintf(h, " = "); + write_expr( h, expr, 0, 1, NULL, NULL, "" ); + break; + } + if(!get_attrp(tail_arg->attrs, ATTR_DEFAULTVALUE)) + break; + } } } count++;