Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1025039rdf; Sat, 4 Nov 2023 04:01:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaMwhaVTWZ1xRLfUC1RuDeIDSaa/V8Z1E6dTOyO+BKQztieqL1YPlQQ8KNUTs+czpz3e0p X-Received: by 2002:a05:6808:2105:b0:3b2:db61:ff8e with SMTP id r5-20020a056808210500b003b2db61ff8emr31301066oiw.33.1699095683010; Sat, 04 Nov 2023 04:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699095682; cv=none; d=google.com; s=arc-20160816; b=CQ797sGpkL7bV81WNT99+9LFhQd48FK7F5AJHiHNMQhRNh3pCZmO32lmVq6hYO+siz HQnNhQV2HiXIYhtsrQRPvIXq5VG9CgoiK3cUZ0RFdcAm5HrvM1xbCHv6Ctjk5jm7LAIW U0SAoO+/HKIsHxcUNlVbYYAFm9R2eCTO8Dg+ew3km4idJKnCSRMdAAq0op2EWbDx+z1j l4P2YcpMH6qf1Qdxl14tin8D2Y6NP30Oe6YRPil6WC7oz/R9kh6QcRTrTNECXIUV1hB8 AoM3D0sPZLxErfszfBbbxNxveAPnKVZ83tnJKkKHLA2iYXMQg4WhEWdNE2uc9MhHV0vE jMFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Ci1jRUo8Q/RIjaz813KhTJBjyw4/qJO0U4wmmerZOPU=; fh=isJd0JZVDkfXL73EXh8XKFxOIWM94S6/sYnFcQuWgSQ=; b=m2tQvHvmeA1H3vBDx8bibIYe4ZXqoFpGXXRdwKN5E7zLNq4ncbVqPtSxNl5Zll1bWw KcBLQ+SQH2yQz/izGGHSmvk0T61PpBOoBWx7c0R38CyuKr8+kH2Tc+KQMlIQV2T7izA3 fojp0nj86pmFa0e29UZ6t0OlhqkFfHxrWOBWy5ctmMCUcecwfWYwYLKoVFTyuSQCLZVO 6OqtHIZBf9YCuwrcHn4Ahf0thk1bvyZdhixg+lhvULyO+ExQ2PssymjXx7eMBMXb4E/o 0+fZ7DjEE3dtRzq6pFeiicTFL44a+xGxAjzTeejL282OKSpXzn+qgVTzVEGt25nK99kU rjKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AlNk1U0o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o7-20020a0568080f8700b003ae04bb334bsi1501820oiw.10.2023.11.04.04.01.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 04:01:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AlNk1U0o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 59F3D808A378; Sat, 4 Nov 2023 04:00:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232093AbjKDLAA (ORCPT + 99 others); Sat, 4 Nov 2023 07:00:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232212AbjKDK7t (ORCPT ); Sat, 4 Nov 2023 06:59:49 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F6D10E0; Sat, 4 Nov 2023 03:59:35 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04F89C433BA; Sat, 4 Nov 2023 10:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1699095574; bh=KcH3qtrbrngsmcLmJ9FlXeAJy5bZDec5KEhDaAEVk3c=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=AlNk1U0oZ3ISi8TOWwssSrRJFs0B7YQBch4HvrDq0LyHReYD+ZnwydQYjBSTU9lxU nuywVDYZjKtOBsCdP37kdVQIgRGwOxOkvXD3W7x0CFxmEn02yOybwaA4mkwI3gkMF+ AOFzXbuO5hhXov/xwQwxw9zXQlCmXKyYgyYZsQQ5S0odfCLgsCz8CZiIKmInROVyLC 5d36LB6GadaTQgNQ/Jnt3/ae5pSHEF34h3WshVtgFl2qcbwl9aFzlSbDKfz01/70f5 INZ2RnOyKJUueoa/rUU+XzEpIhvxnfFzsgsZFsfiEBHFNRZTmj+p/hMlgdko8Hh2pm IjRk0wt/2NWWg== Date: Sat, 4 Nov 2023 19:59:29 +0900 From: Masami Hiramatsu (Google) To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra , Ian Rogers , Adrian Hunter , Ingo Molnar , LKML , linux-perf-users@vger.kernel.org, Linus Torvalds , Stephane Eranian , Masami Hiramatsu , linux-toolchains@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: Re: [PATCH 05/48] perf dwarf-aux: Move #ifdef code to the header file Message-Id: <20231104195929.d229225a0dc6242ba8c8a517@kernel.org> In-Reply-To: <20231012035111.676789-6-namhyung@kernel.org> References: <20231012035111.676789-1-namhyung@kernel.org> <20231012035111.676789-6-namhyung@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sat, 04 Nov 2023 04:00:18 -0700 (PDT) On Wed, 11 Oct 2023 20:50:28 -0700 Namhyung Kim wrote: > It's a usual convention that the conditional code is handled in a header > file. As I'm planning to add some more of them, let's move the current > code to the header first. OK, looks good to me. Acked-by: Masami Hiramatsu (Google) Thanks, > > Cc: Masami Hiramatsu > Signed-off-by: Namhyung Kim > --- > tools/perf/util/dwarf-aux.c | 7 ------- > tools/perf/util/dwarf-aux.h | 19 +++++++++++++++++-- > 2 files changed, 17 insertions(+), 9 deletions(-) > > diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c > index 4849c3bbfd95..adef2635587d 100644 > --- a/tools/perf/util/dwarf-aux.c > +++ b/tools/perf/util/dwarf-aux.c > @@ -1245,13 +1245,6 @@ int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf) > out: > return ret; > } > -#else > -int die_get_var_range(Dwarf_Die *sp_die __maybe_unused, > - Dwarf_Die *vr_die __maybe_unused, > - struct strbuf *buf __maybe_unused) > -{ > - return -ENOTSUP; > -} > #endif > > /* > diff --git a/tools/perf/util/dwarf-aux.h b/tools/perf/util/dwarf-aux.h > index 7ec8bc1083bb..4f5d0211ee4f 100644 > --- a/tools/perf/util/dwarf-aux.h > +++ b/tools/perf/util/dwarf-aux.h > @@ -121,7 +121,6 @@ int die_get_typename(Dwarf_Die *vr_die, struct strbuf *buf); > > /* Get the name and type of given variable DIE, stored as "type\tname" */ > int die_get_varname(Dwarf_Die *vr_die, struct strbuf *buf); > -int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf); > > /* Check if target program is compiled with optimization */ > bool die_is_optimized_target(Dwarf_Die *cu_die); > @@ -130,4 +129,20 @@ bool die_is_optimized_target(Dwarf_Die *cu_die); > void die_skip_prologue(Dwarf_Die *sp_die, Dwarf_Die *cu_die, > Dwarf_Addr *entrypc); > > -#endif > +#ifdef HAVE_DWARF_GETLOCATIONS_SUPPORT > + > +/* Get byte offset range of given variable DIE */ > +int die_get_var_range(Dwarf_Die *sp_die, Dwarf_Die *vr_die, struct strbuf *buf); > + > +#else /* HAVE_DWARF_GETLOCATIONS_SUPPORT */ > + > +static inline int die_get_var_range(Dwarf_Die *sp_die __maybe_unused, > + Dwarf_Die *vr_die __maybe_unused, > + struct strbuf *buf __maybe_unused) > +{ > + return -ENOTSUP; > +} > + > +#endif /* HAVE_DWARF_GETLOCATIONS_SUPPORT */ > + > +#endif /* _DWARF_AUX_H */ > -- > 2.42.0.655.g421f12c284-goog > -- Masami Hiramatsu (Google)