[oe] [meta-oe][PATCH] flashrom: Fix build with clang

Khem Raj raj.khem at gmail.com
Mon Mar 16 18:40:16 UTC 2020


On Mon, Mar 16, 2020 at 1:02 AM Adrian Bunk <bunk at stusta.de> wrote:
>
> On Sun, Mar 15, 2020 at 05:06:54PM -0700, Khem Raj wrote:
> >...
> > +clang complains like below
> > +
> > +libflashrom.c:191:43: error: implicit conversion from enumeration type 'const enum test_state' to different enumeration type 'enum flashrom_test_state' [-Werror,-Wenum-conversion]
> > +                        supported_boards[i].working = binfo[i].working;
> > +                                                    ~ ~~~~~~~~~^~~~~~~
> > +libflashrom.c:229:46: error: implicit conversion from enumeration type 'const enum test_state' to different enumeration type 'enum flashrom_test_state' [-Werror,-Wenum-conversion]
> > +                        supported_chipsets[i].status = chipset[i].status;
>
> Please patch out the -Werror instead.
>

I was basing my solution on an upstream commit
https://github.com/flashrom/flashrom/commit/71b706f5
and I have also proposed my patch upstream lets see what feedback
flashrom devs have
if you are interested you can follow the pull

https://github.com/flashrom/flashrom/pull/133

> >...
> > +However these enums are exactly same so they can be typecasted
>
> If they are the same, the correct fix would be to have only one enum.
>

its not that straight forward and I would leave that to flashrom experts.

> >...
> > +Upstream-Status: Pending
> >...
> > +-                    supported_boards[i].working = binfo[i].working;
> > ++                    supported_boards[i].working = (enum flashrom_test_state)binfo[i].working;
> >...
>
> Working around a compile warning by making the code worse is not
> an improvement.
>

If you think it make it worse, feel free to improve it.

> Even worse when this is an OE-only workaround.
>
> cu
> Adrian


More information about the Openembedded-devel mailing list