From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 692B662DE; Sun, 21 Sep 2025 16:17:27 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 3D0A962BA; Sun, 21 Sep 2025 16:17:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_MISSING,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=4.0.1 Received: from fhigh-b1-smtp.messagingengine.com (fhigh-b1-smtp.messagingengine.com [202.12.124.152]) by atuin.qyliss.net (Postfix) with ESMTPS id 6C65362B6 for ; Sun, 21 Sep 2025 16:17:23 +0000 (UTC) Received: from phl-compute-08.internal (phl-compute-08.internal [10.202.2.48]) by mailfhigh.stl.internal (Postfix) with ESMTP id 1F9547A0081; Sun, 21 Sep 2025 12:17:22 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-08.internal (MEProxy); Sun, 21 Sep 2025 12:17:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alyssa.is; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1758471441; x=1758557841; bh=YjdG6DXS5Y JVtkeob+eOUkrgd5+H9+rKmfmDkekZOZY=; b=USNHW6esfOUktnkcxILmJQtJKo o5zgnmvjbYOuycxJzU4+N0TzIMBD7EDcyNrkqav7Ua2RIoUPT3QZKZZZXTmHDpIq LEMdyIi8t0re+ePBpiNAtZGOZGSnWxDDfH3y7Wgj03aw5T7u72zF7qRXP/ADOMjr cgFWWtYmMOqj2OdIkHfLt2a2XjTQwEzP/K7s+GjH3pEaFEECBEtGtXASB0v0oG5o y1IiEsPVRLefOK35TQ7DK/lg22pn42X2JNsT+ZXo6nyObEBKDqGZtJJiBfNf9Zhe dbTy5D0EVKOOsUEp2cv/pcsnmSHo8ov05vht+G70JjKb5f7+v2VWl9wJjH0Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1758471441; x=1758557841; bh=YjdG6DXS5YJVtkeob+eOUkrgd5+H9+rKmfm DkekZOZY=; b=VuX2grEYIFOJ2CzBCt7hJVOn02wNRde5AZdfaByct/QfoaOC0v/ 5y7/kX1zZ6UIT4Tni5EYhY4d0NGe1ZXAxpZNbFCEVKpGnQnoLpH0CBDo7AaKJGYf nmh1v244ZXXGzbRB30UlTgBe8uobg1TlMPuW2HwC90UXYU4LsyMi8vhQY54kE2Zg fP3T9C2lhFKftAlon9Ou9flIsubeZUnTXTtjCZNV+WVMG8nqveYxWHInbs9OfDRH LGLoBu9otuSnWoKODG4ERgda9CfafWIJ2vvCirErH+BzifGfiaIjPG7P7UJ1uI13 M2U0ibQLn9Dk/cSzLLu56aGGtwv6MzuPhrw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggdehheegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefhvfevufgjfhffkfggtgesghdtreertddttdenucfhrhhomheptehlhihsshgrucft ohhsshcuoehhihesrghlhihsshgrrdhisheqnecuggftrfgrthhtvghrnhepieduffeuie elgfetgfdttddtkeekheekgfehkedufeevteegfeeiffetvdetueevnecuvehluhhsthgv rhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhephhhisegrlhihshhsrgdrih hspdhnsggprhgtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegu vghmihhosggvnhhouhhrsehgmhgrihhlrdgtohhmpdhrtghpthhtohepuggvvhgvlhessh hpvggtthhruhhmqdhoshdrohhrgh X-ME-Proxy: Feedback-ID: i12284293:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 21 Sep 2025 12:17:21 -0400 (EDT) Received: by mbp.qyliss.net (Postfix, from userid 1000) id 8696D24BEB11; Sun, 21 Sep 2025 18:17:20 +0200 (CEST) From: Alyssa Ross To: Demi Marie Obenour Subject: Re: [PATCH] tools/start-vmm: Add additional warning options In-Reply-To: References: <20250918-more-c-warnings-1-v1-1-5fe4eaff8a30@gmail.com> <87tt0yslm3.fsf@alyssa.is> <4c1306e9-1042-4fd7-8e9b-e6f341950021@gmail.com> <87frcguquf.fsf@alyssa.is> <69d9b008-a4e6-403b-8627-5c7577154225@gmail.com> <87tt0v4wdl.fsf@alyssa.is> Date: Sun, 21 Sep 2025 18:17:19 +0200 Message-ID: <87ms6n4w6o.fsf@alyssa.is> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Message-ID-Hash: ZI4NPA4MHOP5MIAM2U5UFURZCT277WXR X-Message-ID-Hash: ZI4NPA4MHOP5MIAM2U5UFURZCT277WXR X-MailFrom: hi@alyssa.is X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-devel.spectrum-os.org-0; header-match-devel.spectrum-os.org-1; header-match-devel.spectrum-os.org-2; header-match-devel.spectrum-os.org-3; header-match-devel.spectrum-os.org-4; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Spectrum OS Development X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Demi Marie Obenour writes: > On 9/21/25 12:13, Alyssa Ross wrote: >> Demi Marie Obenour writes: >>=20 >>> On 9/21/25 04:55, Alyssa Ross wrote: >>>> Demi Marie Obenour writes: >>>> >>>>> On 9/19/25 07:55, Alyssa Ross wrote: >>>>>> Demi Marie Obenour writes: >>>>>> >>>>>>> This detected a missing prototype. >>>>>>> >>>>>>> No functional change. >>>>>>> >>>>>>> Signed-off-by: Demi Marie Obenour >>>>>>> --- >>>>>>> tools/meson.build | 2 ++ >>>>>>> tools/start-vmm/ch.h | 1 + >>>>>>> 2 files changed, 3 insertions(+) >>>>>>> >>>>>>> diff --git a/tools/meson.build b/tools/meson.build >>>>>>> index 9cebd03e323531fca7600cacf120161a98de16c5..8262f3e01d7bd565613= 06d7dd4650a22ca40ebe7 100644 >>>>>>> --- a/tools/meson.build >>>>>>> +++ b/tools/meson.build >>>>>>> @@ -9,6 +9,8 @@ project('spectrum-tools', 'c', >>>>>>> }) >>>>>>>=20=20 >>>>>>> add_project_arguments('-Wno-error=3Dattributes', language : 'c') >>>>>>> +add_project_arguments('-Werror=3Dmissing-prototypes', language : '= c') >>>>>>> +add_project_arguments('-Werror=3Dmissing-declarations', language := 'c') >>>>>>>=20=20 >>>>>>> if get_option('host') >>>>>>> add_languages('rust') >>>>>>> diff --git a/tools/start-vmm/ch.h b/tools/start-vmm/ch.h >>>>>>> index 7230913ef0abf41a4f712ac4a543c7f7fdecec0f..5431365e6e2894cdeba= e22a9a44e2ccf1222e0d2 100644 >>>>>>> --- a/tools/start-vmm/ch.h >>>>>>> +++ b/tools/start-vmm/ch.h >>>>>>> @@ -8,3 +8,4 @@ struct net_config { >>>>>>> char id[18]; >>>>>>> uint8_t mac[6]; >>>>>>> }; >>>>>>> +struct net_config net_setup(const char name[static 1], int name_le= n); >>>>>> >>>>>> Why do we need to declare this in a C header? It's only used from R= ust. >>>>> >>>>> Ideally the Rust declarations would be generated from the C ones >>>>> using bindgen. Also, this catches genuine bugs on the C side. >>>> >>>> What bugs? Implicit definitions are already disallowed, aren't they? >>> >>> Function declared in one file, defined in another file with different >>> prototype. This makes it undefined behavior to call. >>=20 >> I don't see how this really enforces that? Fundamentally the problem >> there is conflicting prototypes, not missing ones. If you had another >> compilation unit that didn't include the header with the prototype, and >> instead make its own declaration, you'd still have the same problem. If >> we have a norm of not declaring functions outside of the header file >> that corresponds to and is included by the implementation file, that >> prevents that from happening regardless of whether we have these errors, >> assuming that the compiler would still catch the prototype not matching >> the implementation. > > It also catches cases where a function or variable should have been marked > static. Okay, I /am/ bad at remembering to mark functions as static, and I guess there's not really a better way to avoid that, so happy to take it with that rationale. Happy for me to just adjust the commit message to mention that? --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRV/neXydHjZma5XLJbRZGEIw/wogUCaNAlDwAKCRBbRZGEIw/w og+fAP0UfiBUZh4iFgCJIFOsAD4vbjRftAPzIZHCeWHuyveYGgEAzrjll/gZdiIk ZzgMtSIuOB+jsE7tsHkn9yyfmhmxOwM= =Sf+x -----END PGP SIGNATURE----- --=-=-=--