Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Jun 2019 02:16:51 +1000 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Warner Losh <imp@bsdimp.com>, "Conrad E. Meyer" <cem@freebsd.org>,  Tijl Coosemans <tijl@freebsd.org>,  src-committers <src-committers@freebsd.org>,  svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r348847 - head/sys/sys
Message-ID:  <20190611013853.E3415@besplex.bde.org>
In-Reply-To: <f96e29b7fdbb0568a3f0b04878d514aa4ff436fe.camel@freebsd.org>
References:  <201906100528.x5A5S4gm072561@repo.freebsd.org>  <20190610110909.3e6fbc13@kalimero.tijl.coosemans.org>  <CAG6CVpViTYjjcqT6v_4m9RFk%2BGCr7kRNGeq63%2Bv4L_QgM3DEjQ@mail.gmail.com>  <CANCZdfoJsHRL_0Jom6bsSC9J3EZn1d-WGA41hCsvWRTBhCVzhw@mail.gmail.com> <f96e29b7fdbb0568a3f0b04878d514aa4ff436fe.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 10 Jun 2019, Ian Lepore wrote:

> On Mon, 2019-06-10 at 07:49 -0600, Warner Losh wrote:
>> On Mon, Jun 10, 2019, 7:44 AM Conrad Meyer <cem@freebsd.org> wrote:
>>
>>> On Mon, Jun 10, 2019 at 2:10 AM T=C4=B3l Coosemans <tijl@freebsd.org>
>>> wrote:
>>>> On Mon, 10 Jun 2019 05:28:04 +0000 (UTC) Dmitry Chagin
>>>> <dchagin@FreeBSD.org> wrote:
>>>>> ...
>>>>> URL: https://svnweb.freebsd.org/changeset/base/348847
>>>>> Log:
>>>>>   Use C11 anonymous unions.
>>>>>
>>>>> Modified: head/sys/sys/ucred.h
>>>>
>>>> ...
>>>>
>>>> Isn't this a userland header that should work with non-C11
>>>> compilers?
>>> ...
>>> Why would one expect userland headers to work with non-C11 (gnu89)
>>> compilers?
>> ...
>> Because those compilers can choose non c11 variants of the language?
>
> Do we promise that userland will compile with -std=3Dc89?  I hope not.

Only headers and libraries should support -std=3Dc89.  <sys/cdefs.h> has
lots of support for compilers and POSIX versions going back to K&R C,
and only the K&R parts are completely broken.

FreeBSD also has the c89 and c99 utilities.  These require c89 and c99
headers to work under FreeBSD.  c89 uses CFLAGS -std=3Diso9899:199409
-pedantic.  I don't see how a 1994 standard can be correct for c89,
but -pedantic here might avoid the bug that -std=3Dcxx doesn't actually
gives standard cxx, especially for clang.  c99 uses -std=3Diso9899:1999
-pedantic.  So anonymous unions are correctly disallowed by both c89
and c99.

At least the following headers still compile with c89: sys/types.h,
stdio.h, stdlib.h, the old version of sys/ucred.h.

> Anonymous unions may be a c11 feature, but they're also available with
> -std=3Dgnu99, which I think is how we compile userland.

That is only the default, only for for parts of userland controlled by us.
Non-FreeBSD makefiles get at most the POSIX CFLAGS (something like -O)
from sys.mk if they use FreeBSD make, and something similar using gmake.

> I think -std=3Dgnu99 is how we should also compile the kernel, and I
> think Bruce has been trying to say that for several years (but I'm not
> sure, because the emails that seem to say so are always so full of
> semi-related extraneous material that it's hard to be sure what they're
> saying).

-std can be forced for kernel builds and other pure FreeBSD builds, but
then it should be the correct one.

bsd.sys.mk only directly supports the user selecting the following standard=
s:
- c89 or c90
- c94 or c95 (the c89 utility gives -std=3Dc94, not -std=3Dc89)
- c99
- gnu99 (default)
Newer and more useful old standards like gnu89 are hard to select.  The
user must set the undocumented variable CSTD even to change the default to
c89/90/94/95.  Adding -std=3Dwhatever to CFLAGS only works if it happens to
be added after -std=3D${CSTD}.

Bruce
From owner-svn-src-head@freebsd.org  Mon Jun 10 16:51:14 2019
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 047E315C4189;
 Mon, 10 Jun 2019 16:51:14 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: from mail-it1-f169.google.com (mail-it1-f169.google.com
 [209.85.166.169])
 (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
 server-signature RSA-PSS (4096 bits)
 client-signature RSA-PSS (2048 bits) client-digest SHA256)
 (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id 9175C83B94;
 Mon, 10 Jun 2019 16:51:13 +0000 (UTC)
 (envelope-from cse.cem@gmail.com)
Received: by mail-it1-f169.google.com with SMTP id m3so128092itl.1;
 Mon, 10 Jun 2019 09:51:13 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:reply-to
 :from:date:message-id:subject:to:cc;
 bh=Eu04DSogOqzagCsYJLwY4WcWqS8Pq2SPDwU0n9qEVE0=;
 b=DIcuyqkeSGVgvbGWYOmwHMG3gGpIu1RfMP3WT7Nryl73ZK7QHOjkhhRNHPCfKCw1KC
 TIS1NNWvgWmrxZ/sAk7qoabZFD3Ykk4BU6aJFKcQ2sOV/a544dUVoggP5xK5cKJkEQ6p
 UQPw8fAkJeKKK1N3Asa/o9UJwaEco7rLdHyvXucsNKDwoSHNz2OzZt8uBTXveLzud4jE
 MLahl1+K9A1Syr2bEmjLnOLbfMJ4Mn2+UC+fLh6rwO2E0h6PjSbFbJHU3qls+/lkdTh7
 SivKK9KQDdV5UlDobBqR9PXhrjukJUQtki5owFEzWcK4cVZZf6RAgwGaaNWH7laHUoBD
 QJzA==
X-Gm-Message-State: APjAAAVlFG3Om7+Qyqu7NmHoAcOKNUqoYt2MoccH+XqqPyUEmZwnp7/+
 DJGp4Im0wRLOes8iUpHv2rR9+YBg
X-Google-Smtp-Source: APXvYqzbWqZ0k+LjgZuFZlidfxe5Ukt5OyteODYkal1Eawig9aR6eZhvC9QqvS2cuB5a+EobbZUiyg==
X-Received: by 2002:a05:6638:199:: with SMTP id
 a25mr135500jaq.18.1560184115751; 
 Mon, 10 Jun 2019 09:28:35 -0700 (PDT)
Received: from mail-it1-f171.google.com (mail-it1-f171.google.com.
 [209.85.166.171])
 by smtp.gmail.com with ESMTPSA id z138sm2224328itc.36.2019.06.10.09.28.35
 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128);
 Mon, 10 Jun 2019 09:28:35 -0700 (PDT)
Received: by mail-it1-f171.google.com with SMTP id i21so14237933ita.5;
 Mon, 10 Jun 2019 09:28:35 -0700 (PDT)
X-Received: by 2002:a24:4411:: with SMTP id o17mr13966343ita.117.1560184115377; 
 Mon, 10 Jun 2019 09:28:35 -0700 (PDT)
MIME-Version: 1.0
References: <201906100528.x5A5S4gm072561@repo.freebsd.org>
 <20190610110909.3e6fbc13@kalimero.tijl.coosemans.org>
 <CAG6CVpViTYjjcqT6v_4m9RFk+GCr7kRNGeq63+v4L_QgM3DEjQ@mail.gmail.com>
 <CANCZdfoJsHRL_0Jom6bsSC9J3EZn1d-WGA41hCsvWRTBhCVzhw@mail.gmail.com>
 <f96e29b7fdbb0568a3f0b04878d514aa4ff436fe.camel@freebsd.org>
 <20190611013853.E3415@besplex.bde.org>
In-Reply-To: <20190611013853.E3415@besplex.bde.org>
Reply-To: cem@freebsd.org
From: Conrad Meyer <cem@freebsd.org>
Date: Mon, 10 Jun 2019 09:28:24 -0700
X-Gmail-Original-Message-ID: <CAG6CVpXr3pC3fv+KU02b-iCnsMhe47TOPWOz5XshC7jH94WVeA@mail.gmail.com>
Message-ID: <CAG6CVpXr3pC3fv+KU02b-iCnsMhe47TOPWOz5XshC7jH94WVeA@mail.gmail.com>
Subject: Re: svn commit: r348847 - head/sys/sys
To: Bruce Evans <brde@optusnet.com.au>
Cc: src-committers <src-committers@freebsd.org>,
 svn-src-all <svn-src-all@freebsd.org>, 
 svn-src-head <svn-src-head@freebsd.org>
Content-Type: text/plain; charset="UTF-8"
X-Rspamd-Queue-Id: 9175C83B94
X-Spamd-Bar: ------
Authentication-Results: mx1.freebsd.org
X-Spamd-Result: default: False [-6.96 / 15.00];
 NEURAL_HAM_MEDIUM(-1.00)[-1.000,0];
 NEURAL_HAM_SHORT(-0.96)[-0.963,0]; REPLY(-4.00)[];
 TAGGED_FROM(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 10 Jun 2019 16:51:14 -0000

On Mon, Jun 10, 2019 at 9:17 AM Bruce Evans <brde@optusnet.com.au> wrote:
> Only headers and libraries should support -std=c89.  <sys/cdefs.h> has
> lots of support for compilers and POSIX versions going back to K&R C,
> and only the K&R parts are completely broken.

Is this due to specific policy, or just inertia?  (No one has bothered
to remove the old bits?)  The older parts being totally broken
suggests sheer inertia.

Best,
Conrad



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190611013853.E3415>