Article View: muc.lists.netbsd.tech.kern
Article #45Re: Do all -current compilers support C23 typed enum syntax?
From: Taylor R Campbell
Date: Fri, 04 Dec 2026 02:43
Date: Fri, 04 Dec 2026 02:43
65 lines
4601 bytes
4601 bytes
> Date: Thu, 03 Dec 2026 20:30:57 -0500 > From: Greg Troxel <gdt@lexort.com> > > Chris Hanson <cmhanson@eschatologist.net> writes: > > > It sounds like this is the approach I should take in what I'm > > hacking on in order to enable compilation in older language modes. > > I think what's appropriate is for you to propose specific changes to > the existing rules to core@ and then follow what core@ decides. Is this for code in NetBSD, or code that runs on NetBSD? I wasn't clear from the original question. It also makes a difference whether we're talking about public header files or other code. Public header files in NetBSD, with public APIs, should generally work in C _or_ C++, in any revision of the standard (although there are some unavoidable compiler-specific extensions like in sys/cdefs.h). We should perhaps add some atf tests for this: for each header file we distribute, compile a trivial .c file that includes it using each revision of the standard, and likewise for C++. I expect there has been some C89 bitrot, and maybe C89 doesn't matter any more. > /usr/share/misc/style doesn't specifically allow or prohibit writing in > any particular C sublanguage. That's either a bug, or just that it's in > /usr/share/mk/bsd.sys.mk. > > bsd.sys.mk says: > > # NetBSD sources use C99 style, with some GCC extensions. > # Coverity does not like -std=gnu99 (XXX untested but likely not gnu11 either) > # > # XXX Ideally we would not rely on GNU extensions, but currently some > # code uses alloca(3) which -std=c11 compiles broken-at-runtime. Until > # we fix that (PR toolchain/58969: use of alloca is warning, not error, > # with -std=c11), we have to continue using -std=gnu11 and not > # -std=c11. > > That should probably be checked and clarified, as there's no explanation > of why after saying C99 it's gnu11/c11 being discussed. Overall I read > it as "sources should be C99, and it's a bug to need C11 or gnu > extensions, but that's where we are", but I'm not at all sure I'm > getting it right. The discussion prompting the change from -std=gnu99 to -std=gnu11 was here: https://mail-index.netbsd.org/tech-kern/2025/01/05/msg029919.html With some followon discussion about -std=gnu11 vs -std=c11 and why switching to the latter is a bad idea: PR toolchain/58969: use of alloca is warning, not error, with -std=c11 https://gnats.netbsd.org/58969 C11 has been mostly uncontroversial, in contrast to C23, so it wasn't a big discussion. -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<20261204024317.C5FCA84DD6@mail.netbsd.org>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mailReferences:
<rmipkvhltm6.fsf@s1.lexort.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news.szaf.org!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail From: Taylor R Campbell <riastradh@NetBSD.org> Newsgroups: muc.lists.netbsd.tech.kern Subject: Re: Do all -current compilers support C23 typed enum syntax? Date: Fri, 4 Dec 2026 02:43:17 +0000 Organization: Newsgate at muc.de e.V. Sender: tech-kern-owner@NetBSD.org Approved: news-admin@muc.de Distribution: world Message-ID: <20261204024317.C5FCA84DD6@mail.netbsd.org> References: <rmipkvhltm6.fsf@s1.lexort.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2"; logging-data="74870"; mail-complaints-to="news-admin@muc.de" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1796352202; bh=lqSPEeYNccU1+ATbOmf98qvU16eM4Jzn+gkZD3ycmpg=; h=To:CC:In-reply-to:Subject:Date:From:List-Id:List-Unsubscribe; b=HElyNYbYeWoI9EJR4/KSJ9amWrrlTaqiiebiGfkcLhgQoUgc/y9HCZy+yHUgGPO9s 25YniCkY3K3n4hUg0Ol5PAn+uiUyQkJtgeS4CcVhIBVyGQm8koW+Ya0A0i/iiN2Vgu JyjP18FcIVNa0JosHNNzwdDRXr1rqP3jJbN3Q92c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netbsd.org; s=20240131; t=1796352197; bh=lqSPEeYNccU1+ATbOmf98qvU16eM4Jzn+gkZD3ycmpg=; h=To:CC:In-reply-to:Subject:Date:From; b=pY66ZlLhiXGu9KrzFwKNSuxoUMkcSONTj4ooE+hyBOQEEsYES8JWmpNMISo3ijBSI l6g70lOQIXEXC2krA3D+iiCc1Lb/OARKJOBTInQ8dfG6z5xvMgrktkeoyjF0SWjIbB wkFSKtPDTUC5CO03AQ96iRtY/Rs4oRgOlR5i2WyA= In-reply-to: <rmipkvhltm6.fsf@s1.lexort.com> (gdt@lexort.com) Precedence: bulk X-Newsgate-Id: f02c70b8849f+ X-No-Archive: Yes