From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier MATZ Subject: Re: [PATCH v2 2/2] use simple zero initializers Date: Thu, 16 Apr 2015 12:12:25 +0200 Message-ID: <552F8B09.9070000@6wind.com> References: <1958525.YbKd0lDtje@xps13> <1429130956-17828-1-git-send-email-thomas.monjalon@6wind.com> <1429130956-17828-2-git-send-email-thomas.monjalon@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit To: Thomas Monjalon , dev-VfR2kkLFssw@public.gmane.org Return-path: In-Reply-To: <1429130956-17828-2-git-send-email-thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces-VfR2kkLFssw@public.gmane.org Sender: "dev" Hi Thomas, On 04/15/2015 10:49 PM, Thomas Monjalon wrote: > To initialize a structure with zeros, one field was explicitly set > to avoid "missing initializer" bug with old GCC (e.g. 4.4). > This warning is now disabled (commit ) for old versions of GCC, > so the workarounds may be removed. > > These initializers should not be needed for static variables but they > are still used to workaround an ICC bug (see commit b2595c4aa92d). > > There is one remaining exception where {0} initializer doesn't work cleanly, > even with recent GCC: > lib/librte_pmd_ixgbe/ixgbe_rxtx_vec.c:735:9: > error: missing braces around initializer [-Werror=missing-braces] > struct rte_mbuf mb_def = {0}; /* zeroed mbuf */ > > Tested with GCC 4.4.7 (CentOS), 4.7.2 (Debian) and 4.9.2 (Arch). > > Signed-off-by: Thomas Monjalon I'm trying to compile the head of dpdk (without this patch applied), and I have this error with clang: ixgbe_rxtx.c:2509:41: error: missing field 'driver_name' initializer [-Werror,-Wmissing-field-initializers] struct rte_eth_dev_info dev_info = { 0 }; I'm wondering if adding more {0} would compile on clang, at least with the current clang flags. $ clang --version Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0) Target: x86_64-pc-linux-gnu Thread model: posix Regards, Olivier