From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H93YlYZ3; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 4B4555A026D for ; Wed, 06 May 2026 09:46:57 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1778053616; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1ZNSr4OJXWdRXr18HvIkCAgpMia5MKpyADk2miOqqUw=; b=H93YlYZ3SWwKfv77dyhWjP148TymBpFpsuwXX7ZCZKW/qeKv7Y/PGlUq+jcLK1sw/lbsqJ B5iorbrffEuTM7f8wBAENak/+oUnnU1u38qes0Er2eY3lCfdnv/8mSDMGuOwGVM1/8o/tb cgh5qqgWF4NbTbuwfR+cZ/46Uvgs+iU= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-676-654IuHArPraUduwgeymKNA-1; Wed, 06 May 2026 03:46:55 -0400 X-MC-Unique: 654IuHArPraUduwgeymKNA-1 X-Mimecast-MFC-AGG-ID: 654IuHArPraUduwgeymKNA_1778053614 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48a9592f666so28303805e9.1 for ; Wed, 06 May 2026 00:46:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778053613; x=1778658413; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=1ZNSr4OJXWdRXr18HvIkCAgpMia5MKpyADk2miOqqUw=; b=YOrc1ReHNc6laAJKyIQ2cATk3s09oXEaqM3Y2F7gYh2JNTNonMAkXCwf3E7cZ2yndp xj43JRFdLvXlaNGfVKKIWU9dItEilZFdTLFKco5aD8FhbNJx39uN113RRr37iViebDSM 7g08+gcfo7rLulGgk7FhAc73YQTXqRAe4Q+FQr9BrW/uhhnfWmx4G6vhDCbh8sJ25uKd SEnbXiQDWjf3dMRdzK1UIBgwCRDcQALoIn048M12pQpv1ZgCZ6BqxnBEttsG6z5zl5p/ feHjeaIGare55c0j16eo4qLKRryC4P2f9bOJVGiMT/stM3BmXNlqh1PtzBEDadDqGph9 vB+g== X-Gm-Message-State: AOJu0YxJQ652/7VVHS8RzlhPXkHKIRS9z117i7bhxYt7SNqzR8B1wXnl UqEhw+M9nOybZUr29zrEc/3prB7sgQVFy/1cLi+elbsBpo1QhblWuG1FWm4GimDda+cQpdRrqPk lr7plLei59+ksj0h2ypJKycstFAad8FDtYUBkBSVd5bERKD0ekDotB2j5QPuzUg== X-Gm-Gg: AeBDievqTVSWeUYuiKfkjSn5yrgcAHlVwRXszrWve+6fkFGkGl8vvma+70GaD1UH8Kp p/oxgeR2hanWvqZkBmLfg/B1/ikmrjhjmrLM3tGVIpVSCP1TV7bBof3DrVEO5XcSY6GWfj7Yqy1 dPyEZ0xriD1mFmgZEbgdpnfpp3Zvc2bIft5Mc5eIYUJhTj6EX+ksOvL7fbrepaWEigKhvZMsgxg vjuAgJKeIj2iyUlE2B+Ya+d4IbvwzCk+NbgXPArkMATUv1x5G48cRprFgkIeWyeOriv5qKrzHeL FrqtuVE2VoRXkyhNL2P07rOaghSHM7bgy0E5r+uv8mDzuuSnApL8EHcJmSVauU0yhIUj1XTn0cL zue9+nUq2287Hyu/g3si38VWGfz79MFvHOmCTmTNc0ec= X-Received: by 2002:a05:600c:3f0b:b0:48a:6fd4:d3d3 with SMTP id 5b1f17b1804b1-48e51f37fb8mr45695035e9.20.1778053613084; Wed, 06 May 2026 00:46:53 -0700 (PDT) X-Received: by 2002:a05:600c:3f0b:b0:48a:6fd4:d3d3 with SMTP id 5b1f17b1804b1-48e51f37fb8mr45694555e9.20.1778053612579; Wed, 06 May 2026 00:46:52 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48e530b2039sm11830405e9.5.2026.05.06.00.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2026 00:46:51 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 02/13] cppcheck: Split out essential defines into a BASE_CPPFLAGS variable Message-ID: <20260506094650.17090699@elisabeth> In-Reply-To: <20260421032338.1909084-3-david@gibson.dropbear.id.au> References: <20260421032338.1909084-1-david@gibson.dropbear.id.au> <20260421032338.1909084-3-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Wed, 06 May 2026 09:46:51 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: rmIa_i0mQdRVORXQkB7DDRk0Kr-OcA7bd1pAeQjx7do_1778053614 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: MQDE55BP4SU2LG7LVR262VICACNZ7NGF X-Message-ID-Hash: MQDE55BP4SU2LG7LVR262VICACNZ7NGF X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Tue, 21 Apr 2026 13:23:27 +1000 David Gibson wrote: > Our cppcheck target need certain flags from the compiler so that they it > can analyse the code correctly. Currently we extract these rather > awkwardly from FLAGS / CFLAGS / CPPFLAGS. But this means we inhibit one > of cppcheck's features: by default it will attempt to analyse paths for all > combinations of compile time options, not just a single one. > > Analysing *all* paths doesn't work for us because many of the -D options we > use are essential to compile at all, so unless we supply those to cppcheck, > overriding the default behaviour we get many spurious errors. At the > moment, however, we give cppcheck *all* our -D options, including > conditional / configurable ones, not just the essential ones. > > All cppcheck really needs here is those essential -D options. Split those > into a separate variable, and use that directly rather than the clunky > $(filter) expression. > > Signed-off-by: David Gibson > --- > Makefile | 14 ++++++++------ > 1 file changed, 8 insertions(+), 6 deletions(-) > > diff --git a/Makefile b/Makefile > index 17e70d22..0de98375 100644 > --- a/Makefile > +++ b/Makefile > @@ -30,11 +30,15 @@ ifeq ($(shell $(CC) -O2 -dM -E - < /dev/null 2>&1 | grep ' _FORTIFY_SOURCE ' > / > FORTIFY_FLAG := -D_FORTIFY_SOURCE=2 > endif > > +# Require preprocessor flags we can't build without > +BASE_CPPFLAGS := -D_XOPEN_SOURCE=700 -D_GNU_SOURCE \ > + -DPAGE_SIZE=$(shell getconf PAGE_SIZE) \ > + -DVERSION=\"$(VERSION)\" > + > FLAGS := -Wall -Wextra -Wno-format-zero-length -Wformat-security > -FLAGS += -pedantic -std=c11 -D_XOPEN_SOURCE=700 -D_GNU_SOURCE > +FLAGS += -pedantic -std=c11 I tried a bit harder but this distinction looks bogus to me (we must *not* build without -std=c11, FORTIFY_SOURCE, -pie, -fPIE, or DUAL_STACK_SOCKETS anyway) and adapting the whole series to a BASE_CPPFLAGS / CPPFLAGS / CFLAGS split is rather time consuming, even if I drop unrelated patches such as 5/13 to 8/13 and 10/13 to 13/13, so I would drop this series for now. I'm running static checkers on pesto manually for the moment. Note that the rationale given for 3/13 and 4/13 ignores documented reasons behind the current sets of flags. It can be changed indeed but functionality needs to be maintained, as I already mentioned in the discussion about 4/13. > FLAGS += $(FORTIFY_FLAG) -O2 -pie -fPIE > -FLAGS += -DPAGE_SIZE=$(shell getconf PAGE_SIZE) > -FLAGS += -DVERSION=\"$(VERSION)\" > +FLAGS += $(BASE_CPPFLAGS) > FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS) > > PASST_SRCS = arch.c arp.c bitmap.c checksum.c conf.c dhcp.c dhcpv6.c \ > @@ -195,6 +199,4 @@ CPPCHECK_FLAGS = --std=c11 --error-exitcode=1 --enable=all --force \ > -D CPPCHECK_6936 > > cppcheck: $(PASST_SRCS) $(HEADERS) > - $(CPPCHECK) $(CPPCHECK_FLAGS) \ > - $(filter -D%,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) $^ \ > - $^ > + $(CPPCHECK) $(CPPCHECK_FLAGS) $(BASE_CPPFLAGS) $^ -- Stefano