[Skiboot] [PATCH] hw/ipmi: Fix misleading-indentation failures
Dan Horák
dan at danny.cz
Tue Apr 6 17:55:38 AEST 2021
On Mon, 5 Apr 2021 16:43:47 +0530
Vasant Hegde <hegdevasant at linux.vnet.ibm.com> wrote:
> Hitting below issue on recent distro (fedora-rawhide).
could be due HOSTCC being gcc version 11
>
> sample failure:
> ---------------
> [ HOSTCC ] hw/ipmi/test/run-fru.c
> In file included from hw/ipmi/test/run-fru.c:10:
> hw/ipmi/test/../ipmi-fru.c: In function 'fru_fill_product_info':
> hw/ipmi/test/../ipmi-fru.c:80:17: error: this 'if' clause does not guard... [-Werror=misleading-indentation]
>
> 80 | if (rc < 1) return OPAL_PARAMETER; rc; })
> | ^~
> hw/ipmi/test/../ipmi-fru.c:102:18: note: in expansion of macro 'FRU_INSERT_STRING'
> 102 | index += FRU_INSERT_STRING(&buf[index], info->manufacturer);
> | ^~~~~~~~~~~~~~~~~
> hw/ipmi/test/../ipmi-fru.c:80:52: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
> 80 | if (rc < 1) return OPAL_PARAMETER; rc; })
> | ^~
> hw/ipmi/test/../ipmi-fru.c:102:18: note: in expansion of macro 'FRU_INSERT_STRING'
> 102 | index += FRU_INSERT_STRING(&buf[index], info->manufacturer);
> | ^~~~~~~~~~~~~~~~~
>
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
LGTM, but would be useful to figure out why compiling ipmi-fru.c as
part of the firmware doesn't produce the same warning.
Reviewed-by: Dan Horák <dan at danny.cz>
Dan
> ---
> hw/ipmi/ipmi-fru.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/ipmi/ipmi-fru.c b/hw/ipmi/ipmi-fru.c
> index da866adb5..86c9ca0ce 100644
> --- a/hw/ipmi/ipmi-fru.c
> +++ b/hw/ipmi/ipmi-fru.c
> @@ -77,7 +77,7 @@ static u8 fru_checksum(u8 *buf, int len)
>
> #define FRU_INSERT_STRING(x, y) \
> ({ rc = fru_insert_string(x, y); \
> - if (rc < 1) return OPAL_PARAMETER; rc; })
> + { if (rc < 1) return OPAL_PARAMETER; } rc; })
>
> static int fru_fill_product_info(u8 *buf, struct product_info *info, size_t size)
> {
> --
> 2.26.2
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
More information about the Skiboot
mailing list