Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
       [not found] <8f5f58c9bf0f4006fabd01b5564af071d20f2a2d.1659909060.git.jahau@rocketmail.com>
@ 2022-08-08  5:39 ` kernel test robot
  2022-08-08 11:18   ` Andy Shevchenko
  0 siblings, 1 reply; 7+ messages in thread
From: kernel test robot @ 2022-08-08  5:39 UTC (permalink / raw)
  To: Jakob Hauser, Jonathan Cameron
  Cc: llvm, kbuild-all, Lars-Peter Clausen, Linus Walleij,
	Andy Shevchenko, Hans de Goede, linux-iio, devicetree,
	phone-devel, ~postmarketos/upstreaming, Jakob Hauser

Hi Jakob,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on v5.19]
[also build test ERROR on next-20220805]
[cannot apply to jic23-iio/togreg linus/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Jakob-Hauser/iio-magnetometer-yas530-Change-data-type-of-hard_offsets-to-signed/20220808-080209
base:    3d7cb6b04c3f3115719235cc6866b10326de34cd
config: hexagon-randconfig-r045-20220807 (https://download.01.org/0day-ci/archive/20220808/202208081346.EWHUWCSa-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 5f1c7e2cc5a3c07cbc2412e851a7283c1841f520)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/2e5a660a127b0fa7ca71e3e30356dc2254ec13eb
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Jakob-Hauser/iio-magnetometer-yas530-Change-data-type-of-hard_offsets-to-signed/20220808-080209
        git checkout 2e5a660a127b0fa7ca71e3e30356dc2254ec13eb
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/iio/magnetometer/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
                   .product_name = yas5xx_product_name[yas530],
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 error generated.


vim +933 drivers/iio/magnetometer/yamaha-yas530.c

   929	
   930	static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
   931		[yas530] = {
   932			.devid = YAS530_DEVICE_ID,
 > 933			.product_name = yas5xx_product_name[yas530],
   934			.version_name = yas5xx_version_names[yas530],
   935		},
   936		[yas532] = {
   937			.devid = YAS532_DEVICE_ID,
   938			.product_name = yas5xx_product_name[yas532],
   939			.version_name = yas5xx_version_names[yas532],
   940		},
   941		[yas533] = {
   942			.devid = YAS532_DEVICE_ID,
   943			.product_name = yas5xx_product_name[yas533],
   944			.version_name = yas5xx_version_names[yas533],
   945		},
   946	};
   947	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
  2022-08-08  5:39 ` [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure kernel test robot
@ 2022-08-08 11:18   ` Andy Shevchenko
  2022-08-08 11:24     ` Andy Shevchenko
  2022-08-08 15:59     ` Nathan Chancellor
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-08-08 11:18 UTC (permalink / raw)
  To: kernel test robot
  Cc: Jakob Hauser, Jonathan Cameron, llvm, kbuild-all,
	Lars-Peter Clausen, Linus Walleij, Hans de Goede, linux-iio,
	devicetree, phone-devel, ~postmarketos/upstreaming

On Mon, Aug 8, 2022 at 7:40 AM kernel test robot <lkp@intel.com> wrote:

...

> All errors (new ones prefixed by >>):
>
> >> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
>                    .product_name = yas5xx_product_name[yas530],
>                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>    1 error generated.

What?!

The yas530 is a part of the enum, how come that compiler can't see
this? Looks like a Clang bug.

>    930  static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
>    931          [yas530] = {
>    932                  .devid = YAS530_DEVICE_ID,
>  > 933                  .product_name = yas5xx_product_name[yas530],
>    934                  .version_name = yas5xx_version_names[yas530],
>    935          },
>    936          [yas532] = {
>    937                  .devid = YAS532_DEVICE_ID,
>    938                  .product_name = yas5xx_product_name[yas532],
>    939                  .version_name = yas5xx_version_names[yas532],
>    940          },
>    941          [yas533] = {
>    942                  .devid = YAS532_DEVICE_ID,
>    943                  .product_name = yas5xx_product_name[yas533],
>    944                  .version_name = yas5xx_version_names[yas533],
>    945          },
>    946  };

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
  2022-08-08 11:18   ` Andy Shevchenko
@ 2022-08-08 11:24     ` Andy Shevchenko
  2022-08-08 15:59     ` Nathan Chancellor
  1 sibling, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-08-08 11:24 UTC (permalink / raw)
  To: kernel test robot, Nathan Chancellor, Nick Desaulniers
  Cc: Jakob Hauser, Jonathan Cameron, llvm, kbuild-all,
	Lars-Peter Clausen, Linus Walleij, Hans de Goede, linux-iio,
	devicetree, phone-devel, ~postmarketos/upstreaming

+Cc: clang people

On Mon, Aug 8, 2022 at 1:18 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Aug 8, 2022 at 7:40 AM kernel test robot <lkp@intel.com> wrote:
>
> ...
>
> > All errors (new ones prefixed by >>):
> >
> > >> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
> >                    .product_name = yas5xx_product_name[yas530],
> >                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    1 error generated.
>
> What?!
>
> The yas530 is a part of the enum, how come that compiler can't see
> this? Looks like a Clang bug.
>
> >    930  static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
> >    931          [yas530] = {
> >    932                  .devid = YAS530_DEVICE_ID,
> >  > 933                  .product_name = yas5xx_product_name[yas530],
> >    934                  .version_name = yas5xx_version_names[yas530],
> >    935          },
> >    936          [yas532] = {
> >    937                  .devid = YAS532_DEVICE_ID,
> >    938                  .product_name = yas5xx_product_name[yas532],
> >    939                  .version_name = yas5xx_version_names[yas532],
> >    940          },
> >    941          [yas533] = {
> >    942                  .devid = YAS532_DEVICE_ID,
> >    943                  .product_name = yas5xx_product_name[yas533],
> >    944                  .version_name = yas5xx_version_names[yas533],
> >    945          },
> >    946  };

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
  2022-08-08 11:18   ` Andy Shevchenko
  2022-08-08 11:24     ` Andy Shevchenko
@ 2022-08-08 15:59     ` Nathan Chancellor
  2022-08-08 18:04       ` Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2022-08-08 15:59 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kernel test robot, Jakob Hauser, Jonathan Cameron, llvm,
	kbuild-all, Lars-Peter Clausen, Linus Walleij, Hans de Goede,
	linux-iio, devicetree, phone-devel, ~postmarketos/upstreaming

Hi Andy,

On Mon, Aug 08, 2022 at 01:18:06PM, +0200, Andy Shevchenko wrote:
> On Mon, Aug 8, 2022 at 7:40 AM kernel test robot <lkp@intel.com> wrote:
> 
> ...
> 
> > All errors (new ones prefixed by >>):
> >
> > >> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
> >                    .product_name = yas5xx_product_name[yas530],
> >                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >    1 error generated.
> 
> What?!
> 
> The yas530 is a part of the enum, how come that compiler can't see
> this? Looks like a Clang bug.

That is not what clang is complaining about here, you'll see the same
error even if you used '0', '1', or '2' here:

  drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
                  .product_name = yas5xx_product_name[0],
                                  ^~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

It is complaining that the initializer element
('yas5xx_product_name[yas530]', rather than just 'yas530') is not
constant, which is a true complaint if I am reading C11 standard 6.6.7
correctly.

GCC 8+ has chosen to accept const structures as constant expressions in
designated initializers, which it is allowed to do per 6.6.10. Nick did
have a patch to try and match this behavior in clang but the work that
was requested doesn't seem to be trivial so it was never finalized:
https://reviews.llvm.org/D76096

You'll see the same error with GCC 7:

  drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not constant
     .product_name = yas5xx_product_name[yas530],
                     ^~~~~~~~~~~~~~~~~~~
  drivers/iio/magnetometer/yamaha-yas530.c:933:19: note: (near initialization for ‘yas5xx_chip_info_tbl[0].product_name’)
  drivers/iio/magnetometer/yamaha-yas530.c:938:19: error: initializer element is not constant
     .product_name = yas5xx_product_name[yas532],
                     ^~~~~~~~~~~~~~~~~~~
  drivers/iio/magnetometer/yamaha-yas530.c:938:19: note: (near initialization for ‘yas5xx_chip_info_tbl[1].product_name’)
  drivers/iio/magnetometer/yamaha-yas530.c:943:19: error: initializer element is not constant
     .product_name = yas5xx_product_name[yas533],
                     ^~~~~~~~~~~~~~~~~~~
  drivers/iio/magnetometer/yamaha-yas530.c:943:19: note: (near initialization for ‘yas5xx_chip_info_tbl[2].product_name’)

Cheers,
Nathan

> >    930  static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
> >    931          [yas530] = {
> >    932                  .devid = YAS530_DEVICE_ID,
> >  > 933                  .product_name = yas5xx_product_name[yas530],
> >    934                  .version_name = yas5xx_version_names[yas530],
> >    935          },
> >    936          [yas532] = {
> >    937                  .devid = YAS532_DEVICE_ID,
> >    938                  .product_name = yas5xx_product_name[yas532],
> >    939                  .version_name = yas5xx_version_names[yas532],
> >    940          },
> >    941          [yas533] = {
> >    942                  .devid = YAS532_DEVICE_ID,
> >    943                  .product_name = yas5xx_product_name[yas533],
> >    944                  .version_name = yas5xx_version_names[yas533],
> >    945          },
> >    946  };
> 
> -- 
> With Best Regards,
> Andy Shevchenko
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
  2022-08-08 15:59     ` Nathan Chancellor
@ 2022-08-08 18:04       ` Andy Shevchenko
  2022-08-08 19:48         ` Nathan Chancellor
  2022-08-09 23:26         ` Jakob Hauser
  0 siblings, 2 replies; 7+ messages in thread
From: Andy Shevchenko @ 2022-08-08 18:04 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: kernel test robot, Jakob Hauser, Jonathan Cameron, llvm,
	kbuild-all, Lars-Peter Clausen, Linus Walleij, Hans de Goede,
	linux-iio, devicetree, phone-devel, ~postmarketos/upstreaming

On Mon, Aug 8, 2022 at 5:59 PM Nathan Chancellor <nathan@kernel.org> wrote:
> On Mon, Aug 08, 2022 at 01:18:06PM, +0200, Andy Shevchenko wrote:
> > On Mon, Aug 8, 2022 at 7:40 AM kernel test robot <lkp@intel.com> wrote:
> >
> > ...
> >
> > > All errors (new ones prefixed by >>):
> > >
> > > >> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
> > >                    .product_name = yas5xx_product_name[yas530],
> > >                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > >    1 error generated.
> >
> > What?!
> >
> > The yas530 is a part of the enum, how come that compiler can't see
> > this? Looks like a Clang bug.
>
> That is not what clang is complaining about here, you'll see the same
> error even if you used '0', '1', or '2' here:
>
>   drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
>                   .product_name = yas5xx_product_name[0],
>                                   ^~~~~~~~~~~~~~~~~~~~~~
>   1 error generated.
>
> It is complaining that the initializer element
> ('yas5xx_product_name[yas530]', rather than just 'yas530') is not
> constant, which is a true complaint if I am reading C11 standard 6.6.7
> correctly.
>
> GCC 8+ has chosen to accept const structures as constant expressions in
> designated initializers, which it is allowed to do per 6.6.10. Nick did
> have a patch to try and match this behavior in clang but the work that
> was requested doesn't seem to be trivial so it was never finalized:
> https://reviews.llvm.org/D76096
>
> You'll see the same error with GCC 7:
>
>   drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not constant
>      .product_name = yas5xx_product_name[yas530],
>                      ^~~~~~~~~~~~~~~~~~~
>   drivers/iio/magnetometer/yamaha-yas530.c:933:19: note: (near initialization for ‘yas5xx_chip_info_tbl[0].product_name’)
>   drivers/iio/magnetometer/yamaha-yas530.c:938:19: error: initializer element is not constant
>      .product_name = yas5xx_product_name[yas532],
>                      ^~~~~~~~~~~~~~~~~~~
>   drivers/iio/magnetometer/yamaha-yas530.c:938:19: note: (near initialization for ‘yas5xx_chip_info_tbl[1].product_name’)
>   drivers/iio/magnetometer/yamaha-yas530.c:943:19: error: initializer element is not constant
>      .product_name = yas5xx_product_name[yas533],
>                      ^~~~~~~~~~~~~~~~~~~
>   drivers/iio/magnetometer/yamaha-yas530.c:943:19: note: (near initialization for ‘yas5xx_chip_info_tbl[2].product_name’)

> > >    930  static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
> > >    931          [yas530] = {
> > >    932                  .devid = YAS530_DEVICE_ID,
> > >  > 933                  .product_name = yas5xx_product_name[yas530],
> > >    934                  .version_name = yas5xx_version_names[yas530],

Would then

  .product_name = "YAS530 MS-3E",
  .version_names = { "A", "B" },

work?

Jakob, note 's' in the field name as well.

> > >    935          },
> > >    936          [yas532] = {
> > >    937                  .devid = YAS532_DEVICE_ID,
> > >    938                  .product_name = yas5xx_product_name[yas532],
> > >    939                  .version_name = yas5xx_version_names[yas532],
> > >    940          },
> > >    941          [yas533] = {
> > >    942                  .devid = YAS532_DEVICE_ID,
> > >    943                  .product_name = yas5xx_product_name[yas533],
> > >    944                  .version_name = yas5xx_version_names[yas533],
> > >    945          },
> > >    946  };

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
  2022-08-08 18:04       ` Andy Shevchenko
@ 2022-08-08 19:48         ` Nathan Chancellor
  2022-08-09 23:26         ` Jakob Hauser
  1 sibling, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2022-08-08 19:48 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: kernel test robot, Jakob Hauser, Jonathan Cameron, llvm,
	kbuild-all, Lars-Peter Clausen, Linus Walleij, Hans de Goede,
	linux-iio, devicetree, phone-devel, ~postmarketos/upstreaming

On Mon, Aug 08, 2022 at 08:04:20PM +0200, Andy Shevchenko wrote:
> On Mon, Aug 8, 2022 at 5:59 PM Nathan Chancellor <nathan@kernel.org> wrote:
> > On Mon, Aug 08, 2022 at 01:18:06PM, +0200, Andy Shevchenko wrote:
> > > On Mon, Aug 8, 2022 at 7:40 AM kernel test robot <lkp@intel.com> wrote:
> > >
> > > ...
> > >
> > > > All errors (new ones prefixed by >>):
> > > >
> > > > >> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
> > > >                    .product_name = yas5xx_product_name[yas530],
> > > >                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > >    1 error generated.
> > >
> > > What?!
> > >
> > > The yas530 is a part of the enum, how come that compiler can't see
> > > this? Looks like a Clang bug.
> >
> > That is not what clang is complaining about here, you'll see the same
> > error even if you used '0', '1', or '2' here:
> >
> >   drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
> >                   .product_name = yas5xx_product_name[0],
> >                                   ^~~~~~~~~~~~~~~~~~~~~~
> >   1 error generated.
> >
> > It is complaining that the initializer element
> > ('yas5xx_product_name[yas530]', rather than just 'yas530') is not
> > constant, which is a true complaint if I am reading C11 standard 6.6.7
> > correctly.
> >
> > GCC 8+ has chosen to accept const structures as constant expressions in
> > designated initializers, which it is allowed to do per 6.6.10. Nick did
> > have a patch to try and match this behavior in clang but the work that
> > was requested doesn't seem to be trivial so it was never finalized:
> > https://reviews.llvm.org/D76096
> >
> > You'll see the same error with GCC 7:
> >
> >   drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not constant
> >      .product_name = yas5xx_product_name[yas530],
> >                      ^~~~~~~~~~~~~~~~~~~
> >   drivers/iio/magnetometer/yamaha-yas530.c:933:19: note: (near initialization for ‘yas5xx_chip_info_tbl[0].product_name’)
> >   drivers/iio/magnetometer/yamaha-yas530.c:938:19: error: initializer element is not constant
> >      .product_name = yas5xx_product_name[yas532],
> >                      ^~~~~~~~~~~~~~~~~~~
> >   drivers/iio/magnetometer/yamaha-yas530.c:938:19: note: (near initialization for ‘yas5xx_chip_info_tbl[1].product_name’)
> >   drivers/iio/magnetometer/yamaha-yas530.c:943:19: error: initializer element is not constant
> >      .product_name = yas5xx_product_name[yas533],
> >                      ^~~~~~~~~~~~~~~~~~~
> >   drivers/iio/magnetometer/yamaha-yas530.c:943:19: note: (near initialization for ‘yas5xx_chip_info_tbl[2].product_name’)
> 
> > > >    930  static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
> > > >    931          [yas530] = {
> > > >    932                  .devid = YAS530_DEVICE_ID,
> > > >  > 933                  .product_name = yas5xx_product_name[yas530],
> > > >    934                  .version_name = yas5xx_version_names[yas530],
> 
> Would then
> 
>   .product_name = "YAS530 MS-3E",
>   .version_names = { "A", "B" },
> 
> work?

I haven't tested it but there is no reason that shouldn't work.

> Jakob, note 's' in the field name as well.
> 
> > > >    935          },
> > > >    936          [yas532] = {
> > > >    937                  .devid = YAS532_DEVICE_ID,
> > > >    938                  .product_name = yas5xx_product_name[yas532],
> > > >    939                  .version_name = yas5xx_version_names[yas532],
> > > >    940          },
> > > >    941          [yas533] = {
> > > >    942                  .devid = YAS532_DEVICE_ID,
> > > >    943                  .product_name = yas5xx_product_name[yas533],
> > > >    944                  .version_name = yas5xx_version_names[yas533],
> > > >    945          },
> > > >    946  };
> 
> -- 
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure
  2022-08-08 18:04       ` Andy Shevchenko
  2022-08-08 19:48         ` Nathan Chancellor
@ 2022-08-09 23:26         ` Jakob Hauser
  1 sibling, 0 replies; 7+ messages in thread
From: Jakob Hauser @ 2022-08-09 23:26 UTC (permalink / raw)
  To: Andy Shevchenko, Nathan Chancellor
  Cc: kernel test robot, Jonathan Cameron, llvm, kbuild-all,
	Lars-Peter Clausen, Linus Walleij, Hans de Goede, linux-iio,
	devicetree, phone-devel, ~postmarketos/upstreaming

Hi Andy,

On 08.08.22 20:04, Andy Shevchenko wrote:
> On Mon, Aug 8, 2022 at 5:59 PM Nathan Chancellor <nathan@kernel.org> wrote:
>> On Mon, Aug 08, 2022 at 01:18:06PM, +0200, Andy Shevchenko wrote:
>>> On Mon, Aug 8, 2022 at 7:40 AM kernel test robot <lkp@intel.com> wrote:
>>>
>>> ...
>>>
>>>> All errors (new ones prefixed by >>):
>>>>
>>>>>> drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
>>>>                    .product_name = yas5xx_product_name[yas530],
>>>>                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>>    1 error generated.
>>>
>>> What?!
>>>
>>> The yas530 is a part of the enum, how come that compiler can't see
>>> this? Looks like a Clang bug.
>>
>> That is not what clang is complaining about here, you'll see the same
>> error even if you used '0', '1', or '2' here:
>>
>>   drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not a compile-time constant
>>                   .product_name = yas5xx_product_name[0],
>>                                   ^~~~~~~~~~~~~~~~~~~~~~
>>   1 error generated.
>>
>> It is complaining that the initializer element
>> ('yas5xx_product_name[yas530]', rather than just 'yas530') is not
>> constant, which is a true complaint if I am reading C11 standard 6.6.7
>> correctly.
>>
>> GCC 8+ has chosen to accept const structures as constant expressions in
>> designated initializers, which it is allowed to do per 6.6.10. Nick did
>> have a patch to try and match this behavior in clang but the work that
>> was requested doesn't seem to be trivial so it was never finalized:
>> https://reviews.llvm.org/D76096
>>
>> You'll see the same error with GCC 7:
>>
>>   drivers/iio/magnetometer/yamaha-yas530.c:933:19: error: initializer element is not constant
>>      .product_name = yas5xx_product_name[yas530],
>>                      ^~~~~~~~~~~~~~~~~~~
>>   drivers/iio/magnetometer/yamaha-yas530.c:933:19: note: (near initialization for ‘yas5xx_chip_info_tbl[0].product_name’)
>>   drivers/iio/magnetometer/yamaha-yas530.c:938:19: error: initializer element is not constant
>>      .product_name = yas5xx_product_name[yas532],
>>                      ^~~~~~~~~~~~~~~~~~~
>>   drivers/iio/magnetometer/yamaha-yas530.c:938:19: note: (near initialization for ‘yas5xx_chip_info_tbl[1].product_name’)
>>   drivers/iio/magnetometer/yamaha-yas530.c:943:19: error: initializer element is not constant
>>      .product_name = yas5xx_product_name[yas533],
>>                      ^~~~~~~~~~~~~~~~~~~
>>   drivers/iio/magnetometer/yamaha-yas530.c:943:19: note: (near initialization for ‘yas5xx_chip_info_tbl[2].product_name’)
> 
>>>>    930  static const struct yas5xx_chip_info yas5xx_chip_info_tbl[] = {
>>>>    931          [yas530] = {
>>>>    932                  .devid = YAS530_DEVICE_ID,
>>>>  > 933                  .product_name = yas5xx_product_name[yas530],
>>>>    934                  .version_name = yas5xx_version_names[yas530],
> 
> Would then
> 
>   .product_name = "YAS530 MS-3E",
>   .version_names = { "A", "B" },
> 
> work?
> 
> Jakob, note 's' in the field name as well.

Thanks for clarifying. I'll change it that way.

>>>>    935          },
>>>>    936          [yas532] = {
>>>>    937                  .devid = YAS532_DEVICE_ID,
>>>>    938                  .product_name = yas5xx_product_name[yas532],
>>>>    939                  .version_name = yas5xx_version_names[yas532],
>>>>    940          },
>>>>    941          [yas533] = {
>>>>    942                  .devid = YAS532_DEVICE_ID,
>>>>    943                  .product_name = yas5xx_product_name[yas533],
>>>>    944                  .version_name = yas5xx_version_names[yas533],
>>>>    945          },
>>>>    946  };
> 

Kind regards,
Jakob

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-08-09 23:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <8f5f58c9bf0f4006fabd01b5564af071d20f2a2d.1659909060.git.jahau@rocketmail.com>
2022-08-08  5:39 ` [PATCH v5 09/14] iio: magnetometer: yas530: Introduce "chip_info" structure kernel test robot
2022-08-08 11:18   ` Andy Shevchenko
2022-08-08 11:24     ` Andy Shevchenko
2022-08-08 15:59     ` Nathan Chancellor
2022-08-08 18:04       ` Andy Shevchenko
2022-08-08 19:48         ` Nathan Chancellor
2022-08-09 23:26         ` Jakob Hauser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox