Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Apr 2024 08:47:15 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Wei Hu <weh@microsoft.com>
Cc:        "freebsd-hackers@FreeBSD.org" <freebsd-hackers@freebsd.org>
Subject:   Re: How to add a -W flag in local Makefile
Message-ID:  <CANCZdfoJD1gb1SVb9xiyUAPe8mWL1SZBB%2BtJ3ZOASMWxO6nmbg@mail.gmail.com>
In-Reply-To: <TYZP153MB0399580B98D5F790C0A551C3BB0E2@TYZP153MB0399.APCP153.PROD.OUTLOOK.COM>
References:  <TYZP153MB0399580B98D5F790C0A551C3BB0E2@TYZP153MB0399.APCP153.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000d0bdae0616600c33
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Thu, Apr 18, 2024, 7:04=E2=80=AFAM Wei Hu <weh@microsoft.com> wrote:

> Hi,
>
> I am trying to add a -W flag to local Makefile so it would only be
> effective for the local source files. But it seems not working when I bui=
ld
> the entire kernel.
>
> For example, I added a structure in sys/dev/hyperv/vmbus/vmbus_var.h. The
> structure requires adding a -W flag (
> -Wno-gnu-variable-sized-type-not-at-end ) to build successfully for all .=
c
> files included this header file.
>


What does this type look like?

Maybe the right answer is changing it?

What I did was I add this line in sys/modules/hyperv/vmbus/Makefile:
>
> CWARNFLAGS +=3D -Wno-gnu-variable-sized-type-not-at-end
>

Where did you add it? I think it needs to be after the .includes

Warner


This seems working fine if I build the module by typing 'make' under
> sys/modules/hyperv/vmbus subdir. But it seems having no effect when
> building the kernel by using 'make buildkernel' under global directory.
> Those .c files still fail to build due to lacking this flag.
>
> If I add this flag in the global sys/conf/kern.mk, it seems to be
> working. However, I don't like to add it globally as only a few source
> files under hyperv/vmbus need it. What did I do wrong? Do you know what t=
he
> proper way to add this flag?
>
> Thanks,
> Wei
>
>
>

--000000000000d0bdae0616600c33
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><br><br><div class=3D"gmail_quote"><div dir=3D"ltr" =
class=3D"gmail_attr">On Thu, Apr 18, 2024, 7:04=E2=80=AFAM Wei Hu &lt;<a hr=
ef=3D"mailto:weh@microsoft.com">weh@microsoft.com</a>&gt; wrote:<br></div><=
blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px=
 #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am trying to add a -W flag to local Makefile so it would only be effectiv=
e for the local source files. But it seems not working when I build the ent=
ire kernel.<br>
<br>
For example, I added a structure in sys/dev/hyperv/vmbus/vmbus_var.h. The s=
tructure requires adding a -W flag ( -Wno-gnu-variable-sized-type-not-at-en=
d ) to build successfully for all .c files included this header file.<br></=
blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D"auto"><br></=
div><div dir=3D"auto">What does this type look like?</div><div dir=3D"auto"=
><br></div><div dir=3D"auto">Maybe the right answer is changing it?</div><d=
iv dir=3D"auto"><br></div><div dir=3D"auto"><div class=3D"gmail_quote"><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c=
cc solid;padding-left:1ex">
What I did was I add this line in sys/modules/hyperv/vmbus/Makefile:<br>
<br>
CWARNFLAGS +=3D -Wno-gnu-variable-sized-type-not-at-end<br></blockquote></d=
iv></div><div dir=3D"auto"><br></div><div dir=3D"auto">Where did you add it=
? I think it needs to be after the .includes</div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">Warner=C2=A0</div><div dir=3D"auto"><br></div><div dir=
=3D"auto"><br></div><div dir=3D"auto"><div class=3D"gmail_quote"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex">
This seems working fine if I build the module by typing &#39;make&#39; unde=
r sys/modules/hyperv/vmbus subdir. But it seems having no effect when build=
ing the kernel by using &#39;make buildkernel&#39; under global directory. =
Those .c files still fail to build due to lacking this flag. <br>
<br>
If I add this flag in the global sys/conf/<a href=3D"http://kern.mk" rel=3D=
"noreferrer noreferrer" target=3D"_blank">kern.mk</a>, it seems to be worki=
ng. However, I don&#39;t like to add it globally as only a few source files=
 under hyperv/vmbus need it. What did I do wrong? Do you know what the prop=
er way to add this flag?<br>
<br>
Thanks,<br>
Wei<br>
<br>
<br>
</blockquote></div></div></div>

--000000000000d0bdae0616600c33--



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