From nobody Thu Apr 18 14:47:15 2024 X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VL0xG6K1Tz5H1HZ for ; Thu, 18 Apr 2024 14:47:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VL0xG4Kydz4c8Y for ; Thu, 18 Apr 2024 14:47:30 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-5176f217b7bso1642015e87.0 for ; Thu, 18 Apr 2024 07:47:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20230601.gappssmtp.com; s=20230601; t=1713451648; x=1714056448; darn=freebsd.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Oht3M/ZTL8s9dnSUifad+dJJgGOMcAKv67CJrobFbXk=; b=iJDQc6/RT20pd7hs9uw5bDxWSqOhjtfnoQQ0ybwqCLTwdjvhXH1R3vKmpTDlInQ4ha 6/x8IBDwi5kHpAlpAAhqB4cOfYCq5fo1WnrFoD/sr+Ze0ScjrMqjheZs1jq52aQSHWvW BVehehCpfMQtKM7OFrBtShP5uhVjdzfuVspIWjLbTGNDoC6e5OWTTQCOmKrawFfbcGbh bBWuUaySMaWUSZEY9/mA4TtZDjOoUuK0YyFxagZMNqy8SgDJmIyuz3rbJm3T8S+HGFNh hQkrvrw+CRlN20jJ/DT66L2r0vWslU70M3TRIz7LKH4h1kI5O9OVPz/POYHhZz2jYvTo QIeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713451648; x=1714056448; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Oht3M/ZTL8s9dnSUifad+dJJgGOMcAKv67CJrobFbXk=; b=HorhCNyIqpmNkk8Vcc0a3DK7MxHL823WZAhWXEwowC/NYXYj4DK8cjvSy4VAOJlLiv vQ8/5q0T3Us8j4k2fvYDy9qkE7RLCklA8qfQ4+h63wNimYUglayPBQx8ShZEFd0Cc+Fz HLv3Zc1ka8jGfz5Dd8VQgFE6IZevT+O+EwMm+bFBF8qC0rqlBjqNLyUs+1NDJFBMwYgS tu5MmQDHw/epK4QoisuWisVFrDp6/V66e4e8ocZfVPgyUow6uxqP4QEVb2yYeKQK+ocU wgXNUFgWd3nU8jODqLj+np4eQRjMuecfme57LQNXlwCrYjCy7CEu2xTSEaoTuS5Cw75Q e5Ag== X-Gm-Message-State: AOJu0YxW2tHBExTTVj56NTM9R+RRs05BHXxV6yuTReT9i4VMx06QZYWH kNUvWJPWR/nEusAaeKdcqrANsFJNlkMXtZyPdP8RKUhHPq+JI8QtutFp9TB+ay4q+MhpVRrexxp 2eOJX4GqD8W+GKo+olK0NQsHblOHEhwU/gv7uYU39am8yPhEfbng= X-Google-Smtp-Source: AGHT+IFqDrkG/jHNiUpc4tbezlWHB484ft3TSOhyrHO5LJNgN7fReoBMO8HXWqBzkHVCNcmde+F/Wpzin6Q2GMBWCKQ= X-Received: by 2002:a19:645b:0:b0:515:acda:77f0 with SMTP id b27-20020a19645b000000b00515acda77f0mr2323812lfj.29.1713451647930; Thu, 18 Apr 2024 07:47:27 -0700 (PDT) List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@FreeBSD.org MIME-Version: 1.0 References: In-Reply-To: From: Warner Losh Date: Thu, 18 Apr 2024 08:47:15 -0600 Message-ID: Subject: Re: How to add a -W flag in local Makefile To: Wei Hu Cc: "freebsd-hackers@FreeBSD.org" Content-Type: multipart/alternative; boundary="000000000000d0bdae0616600c33" X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US] X-Rspamd-Queue-Id: 4VL0xG4Kydz4c8Y --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 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


On Thu, Apr 18, 2024, 7:04=E2=80=AFAM Wei Hu <weh@microsoft.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">Hi,

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.

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.


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=C2=A0


This seems working fine if I build the module by typing 'make' unde= r sys/modules/hyperv/vmbus subdir. But it seems having no effect when build= ing 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 worki= ng. 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 prop= er way to add this flag?

Thanks,
Wei


--000000000000d0bdae0616600c33--