From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24B27C606BD for ; Mon, 8 Jul 2019 15:43:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id EE9F12177B for ; Mon, 8 Jul 2019 15:43:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562600594; bh=yCzFsWiYhH4GWY7hiIepQmYETVQSUDi7twtZuK5iRUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cSFfLuOuc89dPDUqheogoJdp764h5ls17KLKf766uyIJXHVui27u1RBx56CibiyIy c7pOD6KtepXUSzNzU8VVT0g1vqz1tu6gDVkslkQV0y8Yh+TUVa8stPGOKHOEB0qN2X vuAzQNSu0lXxstwDWbvjBw0PQWZgV9/UDookSWL8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391140AbfGHPnN (ORCPT ); Mon, 8 Jul 2019 11:43:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:43494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388363AbfGHPnL (ORCPT ); Mon, 8 Jul 2019 11:43:11 -0400 Received: from quaco.ghostprotocols.net (179-240-135-35.3g.claro.net.br [179.240.135.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 488AF20665; Mon, 8 Jul 2019 15:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562600590; bh=yCzFsWiYhH4GWY7hiIepQmYETVQSUDi7twtZuK5iRUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trTSel9BCUtY4t8arzeDe1aMXTirgqz6CHE1ZE9QDdaNrsa0JAQlSBC5coRedQFtK wt64lSiGhArTFODM6MepTC9csZDlvZivLLGl5kKGmLyfcV03yGawEJDowEZn3YSCNb Kx76RtQAIzHtqRFXZphdqqoxts4pjs+dTU0+yK+I= From: Arnaldo Carvalho de Melo To: Ingo Molnar , Thomas Gleixner Cc: Jiri Olsa , Namhyung Kim , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Adrian Hunter Subject: [PATCH 6/8] perf annotate TUI browser: Do not use member from variable within its own initialization Date: Mon, 8 Jul 2019 12:42:05 -0300 Message-Id: <20190708154207.11403-7-acme@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190708154207.11403-1-acme@kernel.org> References: <20190708154207.11403-1-acme@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo Some compilers will complain when using a member of a struct to initialize another member, in the same struct initialization. For instance: debian:8 Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0) oraclelinux:7 clang version 3.4.2 (tags/RELEASE_34/dot2-final) Produce: ui/browsers/annotate.c:104:12: error: variable 'ops' is uninitialized when used within its own initialization [-Werror,-Wuninitialized] (!ops.current_entry || ^~~ 1 error generated. So use an extra variable, initialized just before that struct, to have the value used in the expressions used to init two of the struct members. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Fixes: c298304bd747 ("perf annotate: Use a ops table for annotation_line__write()") Link: https://lkml.kernel.org/n/tip-f9nexro58q62l3o9hez8hr0i@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/annotate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/ui/browsers/annotate.c b/tools/perf/ui/browsers/annotate.c index 98d934a36d86..b0d089a95dac 100644 --- a/tools/perf/ui/browsers/annotate.c +++ b/tools/perf/ui/browsers/annotate.c @@ -97,11 +97,12 @@ static void annotate_browser__write(struct ui_browser *browser, void *entry, int struct annotate_browser *ab = container_of(browser, struct annotate_browser, b); struct annotation *notes = browser__annotation(browser); struct annotation_line *al = list_entry(entry, struct annotation_line, node); + const bool is_current_entry = ui_browser__is_current_entry(browser, row); struct annotation_write_ops ops = { .first_line = row == 0, - .current_entry = ui_browser__is_current_entry(browser, row), + .current_entry = is_current_entry, .change_color = (!notes->options->hide_src_code && - (!ops.current_entry || + (!is_current_entry || (browser->use_navkeypressed && !browser->navkeypressed))), .width = browser->width, -- 2.20.1