[PATCH] include: sbi: fix swap errors with newer gcc -Werror=sequence-point
Rahul Pathak
rahul at summations.net
Tue Jul 8 19:15:05 PDT 2025
On Fri, Jul 4, 2025 at 5:59 PM Ben Dooks <ben.dooks at codethink.co.uk> wrote:
>
> The BSWAPxx() macros are now throwing the following warnings with
> newer gcc versions. This is due to throwing an argument in that may
> be evaluated more than one (I think) and therefore things like the
> example below should be avoided.
>
> Fix by making a set of BSWAPxx() wrappers which specifically onlt
nit: %s/only/onlt ?
> evaluate 'x' once.
>
> In file included lib/sbi/sbi_mpxy.c:21:
> lib/sbi/sbi_mpxy.c: In function ‘sbi_mpxy_write_attrs’:
> ib/sbi/sbi_mpxy.c:632:63: error: operation on ‘mem_idx’ may be undefined [-Werror=sequence-point]
> 632 | attr_val = le32_to_cpu(mem_ptr[mem_idx++]);
> | ~~~~~~~^~
>
May I ask which gcc version?
LGTM
Reviewed-by: Rahul Pathak <rahul at summations.net>
More information about the opensbi
mailing list