From owner-svn-src-head@freebsd.org Sun Aug 12 21:10:22 2018 Return-Path: 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 7DA49107CC00; Sun, 12 Aug 2018 21:10:22 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08F9B7A00D; Sun, 12 Aug 2018 21:10:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io0-f196.google.com with SMTP id y10-v6so12592023ioa.10; Sun, 12 Aug 2018 14:10:21 -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=BzWJBlmDLX3s5XEud91dXpqdDoTRskJHdiA1/pzi4Yc=; b=JR4bgotH84/9+7v7652Wajg/fg2H9aoUzauzHKyOGHFlKZGbYdS6RsAR4qtO7PBjCp bzwyLUhFX+6kkv4gD92SjRe+Yb7xnb53j4Bdqv2d5JTU0cNr5Gv8vsoFO2cThQ6jwhNd bk9+mXoWHNnMoUMrV3MUW71i2m4tNPdLDR9Y3Az6jnM3Ac9ve9OYLz+Rz5d3V5CkKXne aqepn1kGPHFd+rngKn27/tKR+ZFtF8oUpgY9I0BJtWBR0AA37dLPx3rX8pkiixCRZuZ8 MSaY77bC7nwNQ2aXWFyjxvRF+e/MhSqQOJyn9UYlVzvD0q4QCw5bIQB3cptPEbsk5tIY oWEw== X-Gm-Message-State: AOUpUlFEl6xHeMd7bTvlNWQydpfsRipILZXu6tgCz4q7u4wkqzdSm7cZ 6aTfaoAak+pNnyRbK2eceQ+yDIYb X-Google-Smtp-Source: AA+uWPwpV5yGgACQC7LZ+PurGVv62Z5HEINk/4MuO9ENjn/mu6iBRe10vcnEmDhUuiTTYXDmUPls9w== X-Received: by 2002:a6b:8f4e:: with SMTP id r75-v6mr13071410iod.252.1534107869273; Sun, 12 Aug 2018 14:04:29 -0700 (PDT) Received: from mail-io0-f181.google.com (mail-io0-f181.google.com. [209.85.223.181]) by smtp.gmail.com with ESMTPSA id c2-v6sm5176750iob.41.2018.08.12.14.04.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Aug 2018 14:04:28 -0700 (PDT) Received: by mail-io0-f181.google.com with SMTP id i18-v6so12573460ioj.13; Sun, 12 Aug 2018 14:04:28 -0700 (PDT) X-Received: by 2002:a6b:be46:: with SMTP id o67-v6mr12264959iof.143.1534107868794; Sun, 12 Aug 2018 14:04:28 -0700 (PDT) MIME-Version: 1.0 References: <201808091217.w79CH3gO096411@repo.freebsd.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Thu, 9 Aug 2018 19:44:52 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r337535 - head/sbin/init To: Benjamin Kaduk Cc: "cem@FreeBSD.org" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Aug 2018 21:10:22 -0000 Then maybe don=E2=80=99t keep bringing it up? Especially when it=E2=80=99s = totally irrelevant, like here. FreeBSD has certain assumptions of supported platforms beyond the guarantees of standard C that have nothing whatsoever to do with the boogeyman of a patched compiler. On Thu, Aug 9, 2018 at 2:42 PM Benjamin Kaduk wrote: > On Thu, Aug 9, 2018 at 11:03 AM, Conrad Meyer wrote: > >> On Thu, Aug 9, 2018 at 5:52 AM, Benjamin Kaduk wrote= : >> > On Thu, Aug 9, 2018 at 7:17 AM, Edward Tomasz Napierala < >> trasz@freebsd.org> >> > wrote: >> >> Use NULLs instead of casted zeroes, for consistency. >> > >> > It's probably helpful to note explicitly that these are not in >> arguments to >> > varargs functions, >> >> I don't think it's helpful. >> >> > in which case the explicit cast is needed in order to produce a progra= m >> that >> > will have >> > correct behavior on all compliant compilers/systems. >> >> Here "compliant" means "minimally compliant to the C standard." Use >> of NULL in varargs is functionally correct on all FreeBSD systems. >> >> > (We do define NULL to >> > be a zero-with-cast, >> > but programs >> >> (Ones that care about portability to weird systems.) I don't think >> BSD's 500 line init =E2=80=94 hyper local to FreeBSD =E2=80=94 is a stro= ng candidate >> for portability. >> >> > should not assume that NULL will be of pointer type -- "An >> > integer constant >> > expression with the value 0, or such an expression cast to type void *= , >> is >> > called a null pointer constant".) >> >> Right. The problem only arises when both conditions are met: >> >> 1. The system's varargs representation is smaller than the pointer >> representation, and >> 2. The runtime headers do not defined NULL as a pointer-typed value. >> (3. The function being invoked is actually varargs?) >> >> Neither is true on FreeBSD and v7-style init is not a useful place to >> call for portability. >> > > I don't really feel a need to continue the discussion that was already > started in response > to r336835 (in addition to the current thread), so I'll limit myself to > asking whether we > want to be writing standard C or a FreeBSD-specific dialect of C. My > understanding was > that we had some experience with the latter (e.g., heavy patching of the > compiler) and > it ended up with us in a bad place, which would tend to support writing > standard C or > as close to it as we can. (Yes, I know that we have non-standard printf > specifiers and the like.) > > -Ben >