From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6FB5E21A16ED1 for ; Tue, 20 Jun 2017 13:04:20 -0700 (PDT) Received: by mail-wr0-x22f.google.com with SMTP id r103so105692858wrb.0 for ; Tue, 20 Jun 2017 13:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dUh6M5uHvVE1ANuFsylqiSuq88XqT7MHsXZxSog8w3c=; b=LqTqmqeUBLAU36/fTgYGBs41ObPK6UvnMaLsSzZF2LPG92po68fgpxbvanuyVipxwp JLeF6Vj59Q0NOAuNckLrWZMtJQKv8UCzM17A6YB3RnsljYbZDpZIkdsbX7S7JMlLM2Zk FWtS09SS/CVBXOu3PisMDAAXimwSwekFqDDXc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dUh6M5uHvVE1ANuFsylqiSuq88XqT7MHsXZxSog8w3c=; b=KWQrQ2TIhtzZ6pXDC1WuBCchM/eX04l65S6thTP/rcitp/O0nbZO8NBkr5Ll7rUJl+ WhESVwkcJuv1FOOeFKm7km+2S4Xf+WDAYsYX/qBr9nnbu1fWIpvT/CX4lXUvtZX0bNnQ nz7DIXk5aiWp/oywNmWqM47UeqeKZd2zuBUjbX46j7twCX2BR25bBpIsdM247DNnU8hU IwdyzMvnU+i6jh9c+x1qAomr4wYiCdX6OUXOIdW6PjoxO9PRBiijniTm2JvqaYWQWyuK Pu7LIq03c2IPN0CSHCZVeoIu0vdxUeGqyQXQGB5IkEFWDJ5wDEErX1o2JppjoGckLXE4 QxVw== X-Gm-Message-State: AKS2vOzqUlxN7o5Mt2+w6Vlz4bMsRYNq1mZb5Ivcj/BVeYGsnSPY36Ww mgjjQKqePqKApQQV X-Received: by 10.223.152.130 with SMTP id w2mr6331684wrb.118.1497989142173; Tue, 20 Jun 2017 13:05:42 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id j23sm3942609wre.67.2017.06.20.13.05.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Jun 2017 13:05:41 -0700 (PDT) Date: Tue, 20 Jun 2017 21:05:39 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: Laszlo Ersek , "edk2-devel@lists.01.org" , Ryan Harkin Message-ID: <20170620200539.GD26676@bivouac.eciton.net> References: <20170620110008.24413-1-leif.lindholm@linaro.org> <20170620120046.GZ26676@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [PATCH] ArmPlatformPkg: eliminate Juno gcc build warning X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jun 2017 20:04:21 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 20, 2017 at 09:52:20PM +0200, Ard Biesheuvel wrote: > >>>> For those who have heard me mentioning this before but arguing against > >>>> upstreaming this patch: I only just tweaked that this warning doesn't > >>>> go away with more recent toolchains, but simply when switching to GCC5 > >>>> build profile, and hence LTO. Build failure still reproducible with > >>>> gcc 6.3.1 and GCC49. > >>> > >>> /me annoyed > >> > >> +1 > >> > >>> We keep hitting this with GCC, and I profoundly dislike having to add > >>> redundant initialization sequences. Is there any other solution > >>> possible, e.g., disable this warning for certain builds? > >> > >> I would really like to not disable it. > >> When it gets it right, that's usually a pretty horrific bug caught. > >> And if we switch to LTO as the norm, I guess these will become less > >> noticeable over time. > >> But it does bug me too. > > > > Perhaps we should introduce two macros to "MdePkg/Include/Base.h", > > > > #define UNUSED_POINTER NULL > > #define UNUSED_INTEGER 0 > > > > These could be used to suppress such warnings, without the risk of > > misleading programmers (as to the real necessity of the variable > > assignment at hand). > > > > Or perhaps > > #ifdef __GNUC__ > #define USED(var) var = (typeof(var))0 > #else > #define USED(var) > #endif So ... I prefer this version. However, semantically, for the situation here (may be used before initialized), "USED" does not make sense. Could we have an identical "INITIALIZED" instead? / Leif