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>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Thu, Apr 18, 2024, 7:04 AM 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 build > 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 += -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 the > proper way to add this flag? > > Thanks, > Wei > > > [-- Attachment #2 --] <div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Apr 18, 2024, 7:04 AM Wei Hu <<a href="mailto:weh@microsoft.com">weh@microsoft.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="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 effective for the local source files. But it seems not working when I build the entire kernel.<br> <br> 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.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">What does this type look like?</div><div dir="auto"><br></div><div dir="auto">Maybe the right answer is changing it?</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> What I did was I add this line in sys/modules/hyperv/vmbus/Makefile:<br> <br> CWARNFLAGS += -Wno-gnu-variable-sized-type-not-at-end<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">Where did you add it? I think it needs to be after the .includes</div><div dir="auto"><br></div><div dir="auto">Warner </div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> 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. <br> <br> If I add this flag in the global sys/conf/<a href="http://kern.mk" rel="noreferrer noreferrer" target="_blank">kern.mk</a>, 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 the proper way to add this flag?<br> <br> Thanks,<br> Wei<br> <br> <br> </blockquote></div></div></div>help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfoJD1gb1SVb9xiyUAPe8mWL1SZBB%2BtJ3ZOASMWxO6nmbg>
