Re: b3fd5464a903 - main - rb_tree: resolve name clash

From: Ravi Pokala <rpokala_at_freebsd.org>
Date: Tue, 02 Aug 2022 17:39:13 UTC
-----Original Message-----
From: <owner-src-committers@freebsd.org> on behalf of Doug Moore <dougm@FreeBSD.org>
Date: 2022-08-02, Tuesday at 09:49
To: <src-committers@FreeBSD.org>, <dev-commits-src-all@FreeBSD.org>, <dev-commits-src-main@FreeBSD.org>
Subject: git: b3fd5464a903 - main - rb_tree: resolve name clash

    The branch main has been updated by dougm:

    URL: https://cgit.FreeBSD.org/src/commit/?id=b3fd5464a903180994313bd903f3c170f5f9e1f3

    commit b3fd5464a903180994313bd903f3c170f5f9e1f3
    Author:     Doug Moore <dougm@FreeBSD.org>
    AuthorDate: 2022-08-02 16:47:17 +0000
    Commit:     Doug Moore <dougm@FreeBSD.org>
    CommitDate: 2022-08-02 16:47:17 +0000

        rb_tree: resolve name clash

        Rename 'tmp' to 'rb_update_tmp' in a macro to avoid a shadow variable panic.

I was going to suggest '_tmp', because macro-local variables are supposed to have leading underscores, right?

Thanks,

Ravi (rpokala@)

        Reported by:    imb@protected-networks.net
        Fixes:  35557a0d9169
    ---
     sys/sys/tree.h | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)

    diff --git a/sys/sys/tree.h b/sys/sys/tree.h
    index c0d21b5f8b73..45791e08c947 100644
    --- a/sys/sys/tree.h
    +++ b/sys/sys/tree.h
    @@ -372,10 +372,10 @@ struct {								\
     #endif

     #define RB_UPDATE_AUGMENT(elm, field) do {				\
    -	__typeof(elm) tmp = (elm);					\
    +		__typeof(elm) rb_update_tmp = (elm);			\
     	do {								\
    -		RB_AUGMENT(tmp);					\
    -	} while ((tmp = RB_PARENT(tmp, field)) != NULL);		\
    +		RB_AUGMENT(rb_update_tmp);				\
    +	} while ((rb_update_tmp = RB_PARENT(rb_update_tmp, field)) != NULL); \
     } while (0)

     #define RB_SWAP_CHILD(head, out, in, field) do {			\