From nobody Wed Aug 26 18:03:44 2026 X-Original-To: current@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 4hVXZq14rcz6qR4W; Wed, 26 Aug 2026 18:03:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hVXZp4gLKz43LM; Wed, 26 Aug 2026 18:03:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787767426; 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:autocrypt:autocrypt; bh=Hvmi4KENmcpQiD/ar1WBBfxRf5GEp8YhXUadfk7uEGE=; b=URfOzEl8T78kSP2LgZYRI5BrAicJGcAxdf5XDX5Fasma7psTOcOaZP06zWblAO0n1hjA/a 0m7eLzzK+n2lnXqauwmhzOK8HI4u0W187sTT+2TJQX8SfVNN7NjqWDp3ge6+wGw90HO+MI PrR541KWiq1iGgjEE4KmxuWcWyO1DUuQlXw0tG+XkrddD0LPHz/e3lVxaeDjbpB8X5aCKZ 8azcWqzZhOyxUl1uH3jvMWaiOYHykUsOrPH+Fwkx7E0xaHCWGjYPWIzM5iz/gPbBItq+zz J/AS6V6npNx9tmWIObo24w/xGV6CIgYCkWMmVOY5zGNHqY+VY+i4Gwxu7EyaAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1787767426; a=rsa-sha256; cv=none; b=ozR18UkrdhjHwkRCnwHIG0HXd+TYMaHfpI0jaXdPniyWDRe1PctkC87efo9lo0h/B2Hm6D HBH9E7Dlm+lgDNxVRrWHbRMQ2of4D0uExVjC41bxrSiykdqNiBlT/aGdkQmXtOxrd8tNC0 mS6dh77Ye7cl+X0h3pcZnpRtsLhenTCLYYbbEX363Di2/K7B+A59UA0Cl7EDwcmONOPUor zE+Hz/C9vgagRYXn7agMv27vzNKJvWGVipqbTSF/rDJ0IDaULSHfHz+t8oj7Pf8+zBQWlP tIWTGNXs/+sWIQBb2APG/RNZCA1mfTA3rkA1wQqUGgF2aNDwzsndlfP2PGpSOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1787767426; 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:autocrypt:autocrypt; bh=Hvmi4KENmcpQiD/ar1WBBfxRf5GEp8YhXUadfk7uEGE=; b=te1jcrjgKAKwNmXgE/R34IecEA1gh7/MC4Qk9BLaLH3Ssv232Q2MpLjkzWyCtRLC52taR9 TzAhEKD48FtbD5d/gjG7tn60oKBxLlDe5eVlP7/nk9mEgZLBL3t05GZCjIB7ZY1cPgNuSl QocM2mRD1ciPQvTbri5dSOOuHJ+Bdiko1V36Ip76On2zG9BTMkfe+GVNpaOc2BiTYO6b/C XrFcfiqPKakGgVoyzVBvv3VuNY5tC1me0uRTWu/mo1RRQNPeuJVVIJAnw1SQYzczUbnV5x W2mWRVWoMxocwXTKeA5iYJJlUjXoZVVeTKDByCIsNt3MXjxW5VLGZmXXgXxU1A== Received: from [10.9.4.95] (unknown [209.182.120.176]) (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 did not present a certificate) (Authenticated sender: kevans/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4hVXZp0tmMzQRD; Wed, 26 Aug 2026 18:03:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Message-ID: Date: Wed, 26 Aug 2026 13:03:44 -0500 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: enabling -Werror=assign-enum for kernel To: Gleb Smirnoff , John Baldwin Cc: current@freebsd.org, hackers@freebsd.org References: <0e34f0c6-b41a-49d3-9c41-3ec84ea2e0be@FreeBSD.org> Content-Language: en-US From: Kyle Evans Autocrypt: addr=kevans@FreeBSD.org; keydata= xjMEWySaMRYJKwYBBAHaRw8BAQdAdk/Fqvvw2gwIzw2l1UAbv5mrT35Y5ylfHyUBEcWY3AzN H0t5bGUgRXZhbnMgPGtldmFuc0BGcmVlQlNELm9yZz7ClgQTFggAPgIbAwULCQgHAgYVCgkI CwIEFgIDAQIeAQIXgBYhBPv/ZC7g03RcLBP+TBlOtBOHRwt7BQJlp2YoBQkQJmZ1AAoJEBlO tBOHRwt7krYBAPnGTE/v9EcirWF5oGU+J19nr0wOpPCQzMOxCf5e2km5AQDHIznIhaLvZYUw LlxiBE7MEs/2w4WfXRgW+LuAkzedCc44BFskmjESCisGAQQBl1UBBQEBB0B84DgMSsY6hG+1 o57XJAuqj+dVfG+esKnEiO6T886KYAMBCAfCfgQYFggAJgIbDBYhBPv/ZC7g03RcLBP+TBlO tBOHRwt7BQJlp2ZOBQkQJmadAAoJEBlOtBOHRwt75v8A/Aq5ti6ACDG6/Hfodp9rfed9UQIH q45o6ymUj2TnhTJWAP45Wtv80BB+TiEcWCG7kcOYB3hcqZlD8k8vfito8b3KBA== In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 8/26/26 12:23, Gleb Smirnoff wrote: > John, > > On Wed, Aug 26, 2026 at 01:15:27PM -0400, John Baldwin wrote: > J> > J> Note that C++ doesn't allow this at the language level. When I converted ctld to > J> > J> C++ I had to adjust some enums to be simple #define's instead in the ctl headers. > J> > > J> > Noted. I can't make a judgement if it is a smart restriction by C++ or not. > J> > In our case using enums as flags is common and handy and Werror=assign-enum in > J> > combination with __attribute__((flag_enum)) will make this use fortified > J> > against mistakes. > J> > J> Mostly my point is that over time we may be forced to convert away from enums to > J> plain constants if more of the base system starts using C++ anyway. At least for > J> enums exposed to userspace. > > But if C++ doesn't allow flag enums in principle, then they just can't go into > userspace headers, no matter how we compile the kernel. Basically we already > are there, and enabling Werror=assign-enum for kernel won't change anything, > will it? > I don't really have comments on the rest of this, but at least one of our downstreams does use C++ in the kernel and it'd be nice if we didn't have anything too critical require too heavy of patching to work in that environment. Thanks, Kyle Evans