Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Apr 2024 04:20:13 +0000
From:      Wei Hu <weh@microsoft.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Warner Losh <imp@bsdimp.com>, "freebsd-hackers@FreeBSD.org" <freebsd-hackers@freebsd.org>
Subject:   RE: How to add a -W flag in local Makefile
Message-ID:  <TYZP153MB03991E84C684145A94EA306ABB0D2@TYZP153MB0399.APCP153.PROD.OUTLOOK.COM>
In-Reply-To: <ZiFe_A6takkhcyL7@kib.kiev.ua>
References:  <TYZP153MB0399580B98D5F790C0A551C3BB0E2@TYZP153MB0399.APCP153.PROD.OUTLOOK.COM> <CANCZdfoJD1gb1SVb9xiyUAPe8mWL1SZBB%2BtJ3ZOASMWxO6nmbg@mail.gmail.com> <TYZP153MB039998D645FD84C28A9A057EBB0E2@TYZP153MB0399.APCP153.PROD.OUTLOOK.COM> <ZiFe_A6takkhcyL7@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
> -----Original Message-----
> From: Konstantin Belousov <kostikbel@gmail.com>
> Sent: Friday, April 19, 2024 1:57 AM
> To: Wei Hu <weh@microsoft.com>
> Cc: Warner Losh <imp@bsdimp.com>; freebsd-hackers@FreeBSD.org
> Subject: Re: How to add a -W flag in local Makefile
>=20
> On Thu, Apr 18, 2024 at 03:27:13PM +0000, Wei Hu wrote:
> > I added something like:
> >
> > diff --git a/sys/dev/hyperv/vmbus/vmbus_var.h
> > b/sys/dev/hyperv/vmbus/vmbus_var.h
> > index b598f782947e..6e3b7b040827 100644
> > --- a/sys/dev/hyperv/vmbus/vmbus_var.h
> > +++ b/sys/dev/hyperv/vmbus/vmbus_var.h
> > @@ -193,4 +193,17 @@ struct hyperv_tlb_flush {
> > uint64_t        hv_vm_tlb_flush(pmap_t pmap, vm_offset_t addr1,
> >                                 vm_offset_t addr2, cpuset_t mask);
> >
> > +struct hv_vpset {
> > +       uint64_t format;
> > +       uint64_t valid_bank_mask;
> > +       uint64_t bank_contents[];
> > +} __packed;
> > +
> > +struct hv_tlb_flush_ex {
> > +       uint64_t address_space;
> > +       uint64_t flags;
> > +       struct hv_vpset hv_vp_set;
> > +       uint64_t gva_list[];
> > +} __packed;
> > +
> > #endif /* !_VMBUS_VAR_H_ */
> >
> > So, the struct hv_vpset is the second last member of struct hv_tlb_flus=
h_ex.
> The member bank_contents[] in struct hv_vpset is of variable length. This
> would makes the last two members of struct hv_tlb_flush_ex both variable
> length. Therefore, the flag '-Wno-gnu-variable-sized-type-not-at-end' is
> needed, otherwise it would complain about this with errors like:
> >
> No, the compiler' complain is correct.  The structure definition for
> hv_tlb_flush_ex does not make sense: you never can access gva_list (excep=
t for
> the case of bank_contents being zero-sized).

The same code already exists in Linux and Windows. Linux also added a compi=
ling
flag to suppress similar warnings.=20

Anyway, the purpose of this email is to understand how to add such flags in=
 local
Makefiles and make it effective for global buildkernel. Adding such flags
in local Makefiles already proves to be working when only building under lo=
cal=20
directory.

Thanks,
Wei




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?TYZP153MB03991E84C684145A94EA306ABB0D2>