From owner-svn-src-head@freebsd.org Fri Feb 19 23:14:48 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64F21AAEA00; Fri, 19 Feb 2016 23:14:48 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F08481447; Fri, 19 Feb 2016 23:14:47 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by mail-wm0-x22c.google.com with SMTP id g62so91139265wme.0; Fri, 19 Feb 2016 15:14:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=01V0n2S5Khbtlwb0Qg/aJzITbJ1nW5QrSFzGPpO/Vwo=; b=h5uB2iPujw+jSfgtNFjTfK0M3l7bNRew7HGpot0FLbQ2HurzgDvgARjfYZqw9TCzCU 0cqYfBJjpUGL5nKzZaPA/7w0GCNcf2bEZZA1Jcr3j/RBdombk4kZTzWCiOkXpAdL+nIb afMh3cR4XXK/7iVn5GIiviOb/+8rWVPh+P08rUb6dHkqHJTdmRNGAmGu77+8OMesLUhK oboRu+B7MCCj3p+z7Zx1/O5kAbege7wmgz9/5vWYwFYzwh/tzSmqBk0cACcbKL2Z84ig 7ENJ74/9ckCBBslwpZjEUTgkbq4gSDzINxt6FmznOggtgyAUF0TGTtoySqI6ZO28pRi8 XtFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=01V0n2S5Khbtlwb0Qg/aJzITbJ1nW5QrSFzGPpO/Vwo=; b=XDzn7j07sEZQvpjR5/0HgOLZAoCbw42F+edYApwa8mNVINe2WD8llT2eN4JY+22Qdq K+xjMMWtk3uR4Ti0N3NWhJxfXeVJE8KAqOxAij4JWo53R6EZB6LGLHYadm5kq4gDD0jB EENs0tjU9dgv+tNw4wFw0/pQU7mHObcoBJGFJFdL0rIE3cLmHu+ddTTtlE24vPHZJPcw NB5pykHB5YGqj8aHeUfo4MD1ZCAmcMzDW48PVal9Hztqpnmk5jwyRTyhcJ6ZE7CjEPwI 3vKAuyLq/LmbW/gtPfr9GCjjh0xkinZx+MhiQp+xGZ3sXGUD8HOO2dTFdNWlYDGTr6WV CNgg== X-Gm-Message-State: AG10YORbxBdfXj/UsT+kryHqLa0d37SkEr53TpbDmmj9KTW4V0fMWqBa+oIj2C4ycA13CshNnYh/t9m/YQJrIw== MIME-Version: 1.0 X-Received: by 10.194.84.66 with SMTP id w2mr3574021wjy.6.1455923685009; Fri, 19 Feb 2016 15:14:45 -0800 (PST) Received: by 10.27.170.11 with HTTP; Fri, 19 Feb 2016 15:14:44 -0800 (PST) In-Reply-To: <20160219230612.GR1945@FreeBSD.org> References: <201602182008.u1IK81vg092127@repo.freebsd.org> <20160219230612.GR1945@FreeBSD.org> Date: Fri, 19 Feb 2016 17:14:44 -0600 Message-ID: Subject: Re: svn commit: r295768 - head/usr.sbin/iostat From: Benjamin Kaduk To: Gleb Smirnoff Cc: Alan Somers , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , Sergey Kandaurov , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 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: Fri, 19 Feb 2016 23:14:48 -0000 On Fri, Feb 19, 2016 at 5:06 PM, Gleb Smirnoff wrote: > On Fri, Feb 19, 2016 at 08:49:43AM -0700, Alan Somers wrote: > A> On Fri, Feb 19, 2016 at 5:24 AM, Sergey Kandaurov > wrote: > A> Yeah, it was being implicitly zeroized before. But Clang complained > A> about the structures being only partially initialized. Since the > A> whole point of my commit was to increase the WARNS level, I explicitly > A> zeroed the zero fields to silence Clang. > > Isn't zero filling part of the standard? I don't see why lack of > explicit zeroing is a warning? Looks a false warning to me. > It is not quite as simple as this would make it sound. The elements or members of an aggregate (e.g.) structure type are initialized as if it were an object of static storage duration (i.e., to zero) if the initializer list does not contain enough initializers for all members of the aggregate type, per item 21 of section 6.7.8 of n1256.pdf. However, such initialization does not necessarily need to zero any padding bytes that are present, which may take unspecified values. Personally, I think this particular clang warning can be too aggressive, especially for complex structs, but on the other hand given the indeterminateness of padding, bzero/memset are often a better choice anyway. -Ben