Re: [PATCH v2 2/2] kconfig: trivial - adjust comments

Paul Bolle
2014-10-10T13:14:49Z

Hi Martin,

I haven't yet dared to review 1/2, which is the interesting change. So I
cheated and skipped to 2/2.

On Mon, 2014-09-22 at 19:13 +0200, Martin Walch wrote:
> Replace any C99 comments with traditional ones (/*...*/).

Perhaps you could split those changes off in a separate, trivial patch.

> Also fix the contents of two comments:
>
> 1) the second occurrence of
> (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
> is probably copy & paste from above, missing the adjustment corresponding
> to the code.
> It should probably read
> (a!='b') && (a='c') -> 'b'='c' ? 'n' : a='c'
>
> 2) that one is similar:
> (a!='m') && (a!='n') -> (a='m')
> it should be
> (a!='m') && (a!='n') -> (a='y')

And perhaps even send these two changes as two separate patches. Not
sure, as I don't review much, but it should make it easier to review.

> Signed-off-by: Martin Walch <walch.martin@web.de>
> ---
> scripts/kconfig/expr.c | 38 +++++++++++++++++++-------------------
> 1 file changed, 19 insertions(+), 19 deletions(-)
>
> diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
> index 4aa171b..c840e52 100644
> --- a/scripts/kconfig/expr.c
> +++ b/scripts/kconfig/expr.c
> [...]
> if (sym1->type == S_TRISTATE) {
> if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) {
> - // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
> + /* (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' */

Could you make this match the code? Ie,
/* (a='b') && (a!='c') -> 'b'!='c' ? a='b' : 'n' */

if I'm reading the code right.

> sym2 = e1->right.sym;
> if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
> return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)
> : expr_alloc_symbol(&symbol_no);
> }
> if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) {
> - // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b'
> + /* (a!='b') && (a='c') -> 'b'='c' ? 'n' : a='c' */

Likewise:
/* (a!='b') && (a='c') -> 'b'!='c' ? a='c' : 'n' */

> sym2 = e2->right.sym;
> if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST))
> return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2)

(You could also make the code match the comments. But that would make
the patch less trivial.)

Paul Bolle