Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp356091pxy; Sat, 14 Aug 2021 08:55:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRPam9h0rmrURaihB+IEeS16Ed+ZxYU3/uHEjDOX6vlJwGgwuSYW9yJwfIhAP+7ILx0Sx1 X-Received: by 2002:a92:de4b:: with SMTP id e11mr5474652ilr.22.1628956548153; Sat, 14 Aug 2021 08:55:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628956548; cv=none; d=google.com; s=arc-20160816; b=KNO1WbJIo/NeY93FrYeVKDnYM6t9FfywGEeZPBmQHjDOLvEO1Os4new+fkLsv4lZOR RiMBfEK1OrvxCiPpmXICl31lK1Oq32TWPEVxMMo/R6JtTUIHnkntiyUss6lQnUxhkPTs 4KdlHnflXXjtN+ttnbXPsNDZqY/Cb6awIKCCPTGod7CN7urFSaiS5bvHJuc/VQVpTMdp XF+njw694D8G/C2w8HU57NnwFPNPZXZCvQtw/5CsE6uzXszPL9zqgVIR2RFn6EgHndri 56rBgw7adKzacP6dQ+EYnuVRvlrD1dXWY3p3RV3j03WUjF/0cQ9ov2M2tJBK4wg/tMkO Qb6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=o4NiQWr5CvCZjml5IYmatLRTXHfcp9lvhOkFNQ0pNPU=; b=LpMQ2ovQBzhKQkjbD4Xx/X/JcEgougq4Sa2el3iN0XNzJ2JFepa0BSWzzAorgyol2A wfANxxhurrwGhKxnuH9Y3LTxQw0zqFe0vNkvnpZNZdUfRz2B2maFMkEeHLy6+nAfO8Oh 5yK66/EzOO/zkleHjDFOY67G0kN2QTRI75HcykEPE23XkrYhjgnf3v+KVR6bNxXFah6h fWGjlkgUMvATfmn1H5f189lUF+NTVK7aN0O/1qj2gs4SAsdP+8nEFZw4k8+VcwfgC1By S9L/nfQz1jQa3JxSSc+9j4EuRvy72Bzi7m3kRGFK10xsj0IxqwnPeZRUigN0iZWvtsDI cMew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wt1QRQM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k1si5014919ios.77.2021.08.14.08.55.32; Sat, 14 Aug 2021 08:55:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Wt1QRQM3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238714AbhHNPxa (ORCPT + 99 others); Sat, 14 Aug 2021 11:53:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:57994 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232131AbhHNPx3 (ORCPT ); Sat, 14 Aug 2021 11:53:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4900860720; Sat, 14 Aug 2021 15:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628956381; bh=Jt0fOzF0pcEbaBGtTmsRAlN0CVIMP8qB1jbJroYoatI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Wt1QRQM3rJiisOQ0IGur1mg6OixeqpJE6Md6AzDXjNLp+xbgtKbYlCeiohB9yuk1t 3J8E7E5LjX3TXXf2EwJCub0T94/FdPU6eqHnEbdoxVw8s9omZPKFLfxv+G9cAwTxIw disY8x8/YwopZRNhLDxQZmHcneZVM+yiN+2kHjjB5mYANzMF2PqYWe4lmOcp7MbL8u bEZ/t8mBdiije0qk15p9f5CgIw58Us0uQTgXexUoVfRoiSxVvWwrDN0qwRvMHKo8ht grDZRyWwddiedIAueyMAzWXbtlXzPBIM30YTH+M/NH/c2PZ6l9ZBeUV+Xd2dJwBkyq MBz3RuVRbjJ9w== Date: Sat, 14 Aug 2021 18:52:57 +0300 From: Leon Romanovsky To: Al Viro Cc: Christophe JAILLET , Dan Carpenter , Russell King - ARM Linux admin , Joe Perches , Dwaipayan Ray , Andy Whitcroft , Lukas Bulwahn , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Julia Lawall Subject: Re: [PATCH] checkpatch: prefer = {} initializations to = {0} Message-ID: References: <20210805104353.GD26417@kili> <1b94e688-a070-998a-3014-96bcbaed4cae@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 14, 2021 at 02:57:06PM +0000, Al Viro wrote: > On Sat, Aug 14, 2021 at 05:38:27PM +0300, Leon Romanovsky wrote: > > > There are number of reasons why you didn't notice any difference. > > 1. {} is GCC extension > > 2. {} was adopted in latest C standards, so need to check which one GCC 10 > > is using by default. > > 3. Main difference will be in padding - {0} will set to zero fields but > > won't touch padding, while {} will zero everything. > > References on (3), please? I reread gcc/c/c-typeck.c and at lest for GCC 10, I'm wrong about padding. Sorry about that. 8630 struct c_expr 8631 pop_init_level (location_t loc, int implicit, 8632 struct obstack *braced_init_obstack, 8633 location_t insert_before) .... 8692 switch (vec_safe_length (constructor_elements)) 8693 { 8694 case 0: 8695 /* Initialization with { } counts as zeroinit. */ 8696 constructor_zeroinit = 1; 8697 break; 8698 case 1: 8699 /* This might be zeroinit as well. */ 8700 if (integer_zerop ((*constructor_elements)[0].value)) 8701 constructor_zeroinit = 1; 8702 break; 8703 default: 8704 /* If the constructor has more than one element, it can't be { 0 }. */ 8705 constructor_zeroinit = 0; 8706 break; 8707 } 8708