[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SUSPECTED SPAM][RESEND PATCH 1/2] tools/libxl: Mark pointer args of many functions constant


  • To: Elliott Mitchell <ehem+xen@xxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Wed, 28 Apr 2021 18:12:29 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, "Wei Liu" <wl@xxxxxxx>
  • Delivery-date: Wed, 28 Apr 2021 17:12:40 +0000
  • Ironport-hdrordr: A9a23:Ovf2BajE6NSRCH4cFjOKv3PWLXBQXksji2hD6mlwRA09T+Wzva mV/cgz/xnylToXRTUMmcqYPrOBXHPb8vdOkO4sFJ2lWxTrv3btEZF64eLZslndMgD36+I178 tdWodkDtmYNzdHpOb8pDK1CtMxhOSAmZrY49v261dIYUVUZ7p77wF/Yzzrd3FeYAVdH5I2GN 69y6N81lmdUE8aZMi6GXUJNtKrz7ag+a7OWhIICwUq7wODl1qTmdzHOiOVwwsEVHd3yaoimF K16jDR3LmpsP2w13bnt1P70pI+orXc9uc=
  • Ironport-sdr: 1ZkLDtpa6R+gCGA4tSZJAVut+9ez2wS+Gg4LBrfueD6uSZNLwz2x32kXtiIy2YR6tOVKGZIM67 +E7xyb1Ymn0oTfH7Qh0Dhc9qw15M8hPSJ21NTKp56sMDocKqs0aw1JC+G6e25VRUiaq0Q/32pG 3UKrwL3azARVtFaIMdpJT4qeaCWthxXP6mkYE1Iaku12UVGND2USnrs5zY8sPXkkNH0XB93JXE Gu1FTDvGf2obah4f56wPnHnTi1FyNBYAL+0yfMY4MQhDPJrddDPzlM2nshFet5tNnZO72i1Q+i SZU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, Dec 18, 2020 at 01:37:44PM -0800, Elliott Mitchell wrote:
> --- a/tools/libs/light/libxl_internal.h
> +++ b/tools/libs/light/libxl_internal.h
> @@ -2073,9 +2073,9 @@ struct libxl__xen_console_reader {
>  /* parse the string @s as a sequence of 6 colon separated bytes in to @mac */
>  _hidden int libxl__parse_mac(const char *s, libxl_mac mac);
>  /* compare mac address @a and @b. 0 if the same, -ve if a<b and +ve if a>b */
> -_hidden int libxl__compare_macs(libxl_mac *a, libxl_mac *b);
> +_hidden int libxl__compare_macs(const libxl_mac *a, const libxl_mac *b);
>  /* return true if mac address is all zero (the default value) */
> -_hidden int libxl__mac_is_default(libxl_mac *mac);
> +_hidden int libxl__mac_is_default(const libxl_mac *mac);

It turns out that older version of gcc complains about the const of
libxl_mac:


    libxl_nic.c: In function 'libxl_mac_to_device_nic':
    libxl_nic.c:40:9: error: passing argument 1 of 'libxl__compare_macs' from 
incompatible pointer type [-Werror]
             if (!libxl__compare_macs(&mac_n, &nics[i].mac)) {
             ^
    In file included from libxl_nic.c:18:0:
    libxl_internal.h:2076:13: note: expected 'const uint8_t (*)[6]' but 
argument is of type 'uint8_t (*)[6]'
     _hidden int libxl__compare_macs(const libxl_mac *a, const libxl_mac *b);
                 ^
    libxl_nic.c:40:9: error: passing argument 2 of 'libxl__compare_macs' from 
incompatible pointer type [-Werror]
             if (!libxl__compare_macs(&mac_n, &nics[i].mac)) {
             ^
    In file included from libxl_nic.c:18:0:
    libxl_internal.h:2076:13: note: expected 'const uint8_t (*)[6]' but 
argument is of type 'uint8_t (*)[6]'
     _hidden int libxl__compare_macs(const libxl_mac *a, const libxl_mac *b);
                 ^
    libxl_nic.c: In function 'libxl__device_nic_setdefault':
    libxl_nic.c:69:5: error: passing argument 1 of 'libxl__mac_is_default' from 
incompatible pointer type [-Werror]
         if (libxl__mac_is_default(&nic->mac)) {
         ^
    In file included from libxl_nic.c:18:0:
    libxl_internal.h:2078:13: note: expected 'const uint8_t (*)[6]' but 
argument is of type 'uint8_t (*)[6]'
     _hidden int libxl__mac_is_default(const libxl_mac *mac);
                 ^
    cc1: all warnings being treated as errors


That happens on ubuntu trusty, debian jessie, and centos 7.

Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.