Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2969976lqz; Wed, 3 Apr 2024 14:04:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVCK1O2BO0/ufZnwWyIFnttRA5oIfGy+WeiRxbbs2rLbmrIwugc47INS6Xu10FxP9Z1ZTKtLaX+u2RZVf5n1jC14d82cXLNl9J0Lp5olw== X-Google-Smtp-Source: AGHT+IETord5uPkIoU4FxMcB/gyF55FGDqhL+PxyZ6zfUM0MpP7/px6idtdDygukYyqJFZgkwi/S X-Received: by 2002:a05:6512:3259:b0:513:c69f:ed28 with SMTP id c25-20020a056512325900b00513c69fed28mr516299lfr.58.1712178252839; Wed, 03 Apr 2024 14:04:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712178252; cv=pass; d=google.com; s=arc-20160816; b=sZUzw6asnZdwcdzNjTLHKl0X7Ahf6Roac3UeZ9YIRIx4WqHvOlmczUI9DGNLD2INio 2Dno9Ma7up82I/BEc9GgMkN0FTqsI50odgEMDsGFMyhdNI1QvVMus1G4/VewEWq/qMOi 41u3HB9Hb7abP2EhFrkY026T9bEpS0N/1MOs6xzPwN8ahng8DDOXmFsGkGHdmKugxthC sqj6mgw0Jf3E4fJWB7pyFliqdHiivqp/vO1ocJILR90vwP6LCwJBXrzcV66iVsA3k8V2 Fx6sfZP8r9alvo7P+6C47M6/bxvg3DEgiuclWerWj0m/Li3juyNNpWze5TtDEbKf21t6 eSNg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PctlMdnJPP0pix1I7wGZTUtA4E1YvWW9NzDHWe6dRXk=; fh=la08EwUvyn83Y6ToWrYkgGtLedsPXp+vdSO/tzuTDaI=; b=0CMxjbaQHr1TgtDlR+PRqlcPC7U3a5GFf56EXXb2WB50KeRtOfL/OCbX8KCvpUtsd5 FW4W2WFqjx690uGhUJe5eTotvL8wewhZ1pjGBD9cWWA0u1wetqx2PPm6WJga+4ktHQNm RiZCCFDaHyLTqqJP0CBAIktpSScBn0hpLEXhTaFwcH+GpQgBXCo58sY7UfFsYYUg0/JD mzIgTBMg7h1hCGPpHUiAYHQLaY1lqAyCv4UTdm8O3hhg5knckIcksetkkG7aKzFWH4He Bsy5dTZaigYiufdoywVcBu3Hge8d4ZAc6WjblcVGeVrPb3+/xftFUAmHQM4lQWh4ilZR twTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dTFRA8wC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130601-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qf33-20020a1709077f2100b00a4e5a8c9e48si4534774ejc.150.2024.04.03.14.04.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 14:04:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-130601-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dTFRA8wC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-130601-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-130601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4EDA71F23325 for ; Wed, 3 Apr 2024 21:04:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C4CF15664D; Wed, 3 Apr 2024 21:03:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dTFRA8wC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99A0614C5B3 for ; Wed, 3 Apr 2024 21:03:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712178236; cv=none; b=sMIkrJnr5nzwilvoeU5BTljOcuDhl4rFftheSD7RTaM0q2NJdIraEp49cjDuVUY4QTK020sNkfVeXGHwjoVgi6Sfk6hnYYwDT8g8vLgUYBwg8KP9YWuiq+KXw0pWYmvVdUPLeqnEiSTKxdgYsRPaDzy2O5U3xKKme1+tUcO6des= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712178236; c=relaxed/simple; bh=2nXvlcysOJppAiAzRe5dRfX+OiQFH1nMTizntZ0g8qI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XYmiPrvITkMdtLQkKk8Fmf49Z3gm5NiZTmOQEhWIELephdUIQ/SVsQQ2B7tfogovlGJr4h7Q08DesSG+IxAWUdnF/tMGBGfycdZe+vVmyYuI36bIkaSliW/12IglqDfmIkv0O2iCroklK3pecWtocAi0s/jW2/tcITpbZz5/yRQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dTFRA8wC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 804F1C43390; Wed, 3 Apr 2024 21:03:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712178236; bh=2nXvlcysOJppAiAzRe5dRfX+OiQFH1nMTizntZ0g8qI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dTFRA8wCT+yBFtsOhYovAhWVriVq2017qU3+2eJmvWk6YL1oi/9AWW8P89MUISr8H A1kdnXKnYYKHyTBAjgr7iSVqWRdI6/DJEJW3rapiJ4+lbHvCJTCc3/cRHla3dXQwOu DWNjih7q/G1rZiXNxpGIIlK3+iBmiHWtgsMLy1ZfVtPyfVlInPRcjjXWzaDrztrZw2 V2FpkBzaAMXJPCTCaV7hx+5Ufj0YYI2DGX500uQ4xo4ujoxXtqkkWD0VZq6nQUAWoV xV4RISDoMkyDTqLFESk3zOqoGRLPXAwEIx0RffQYKGQ90IgFztfDoM2lOeBdbuDTko v6fFmaZmRRh7A== Date: Wed, 3 Apr 2024 18:03:52 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Namhyung Kim , Adrian Hunter , Jiri Olsa , Linux Kernel Mailing List Subject: Re: [PATCH 1/1] perf annotate: Initialize 'arch' variable not to trip some -Werror=maybe-uninitialized Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Apr 03, 2024 at 09:01:56AM -0700, Ian Rogers wrote: > On Wed, Apr 3, 2024 at 8:16 AM Arnaldo Carvalho de Melo wrote: > > > > In some older distros the build is failing due to > > -Werror=maybe-uninitialized, in this case we know that this isn't the > > case because 'arch' gets initialized by evsel__get_arch(), so just init > > it to NULL to silence those cases. > > > > E.g.: > > > > 32 17.12 opensuse:15.5 : FAIL gcc version 7.5.0 (SUSE Linux) > > util/annotate.c: In function 'hist_entry__get_data_type': > > util/annotate.c:2269:15: error: 'arch' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > struct arch *arch; > > ^~~~ > > cc1: all warnings being treated as errors > > > > 43 7.30 ubuntu:18.04-x-powerpc64el : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) > > util/annotate.c: In function 'hist_entry__get_data_type': > > util/annotate.c:2351:36: error: 'arch' may be used uninitialized in this function [-Werror=maybe-uninitialized] > > if (map__dso(ms->map)->kernel && arch__is(arch, "x86") && > > ^~~~~~~~~~~~~~~~~~~~~ > > cc1: all warnings being treated as errors > > > > Cc: Adrian Hunter > > Cc: Ian Rogers > > Cc: Jiri Olsa > > Cc: Namhyung Kim > > Signed-off-by: Arnaldo Carvalho de Melo > > This looks fine but I couldn't line up the errors with code in the > tree. I was curious why the "maybe-uninitialized" was failing. Perhaps > evsel__get_arch should set the out argument to NULL when an error > occurs. This fix is also good but may potentially need repeating for > other evsel__get_arch cases, so a fix in evsel__get_arch may be > preferable. > > Reviewed-by: Ian Rogers Yeah, your suggestion is better and I just tested, satisfies the compilers that were emitting this warning. I stamped a: Suggested-by: Ian Rogers and kept your Reviewed-by, ok? - Arnaldo