Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp52278rdg; Wed, 11 Oct 2023 20:52:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGqLqrZL7Kha0seDC3qagIxC26+6Qnw43Ean+vVpOigK4DK7ODk0QwJ+GkNqK5m/2g74b4I X-Received: by 2002:a17:90b:4c87:b0:276:fd4c:c20b with SMTP id my7-20020a17090b4c8700b00276fd4cc20bmr21064704pjb.5.1697082720127; Wed, 11 Oct 2023 20:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697082720; cv=none; d=google.com; s=arc-20160816; b=Bi22naJHE3QDNlgJuBG6DWCaOorF0fTazIbCyIx97VsEvUVmObhbQgdDTN4ic0nQU2 vm8jqMKjDFA7QZf3oql3vnbJewjlIJB3jxhvjNeCUa0RaC0KT0pocqKg6lniExxoP21i 8n9ZHzqKa7qY4gDIgCb88Uu2g1PExgZoKDMqeHWkC/MOIpW8okXA50oRGUoA6AwOLHLS ei8qTl9ZtTk4ImCOXarFN/JEMTc8GtMIfRQ31ms8I9Gne8BCAEjYPz+yfN0QXzHrBEde TRgUh+N5ZlzxnxvjbYRFcVjPPnL3oCJg3P2sKJFmV5iF9ng943ijHcHutbZoy5JNpfv1 yg/w== 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:date:subject:cc:to:from:sender :dkim-signature; bh=cPOXjwmN3ZMMh06n/p0NGkvvVnZrqkqOb37OFAMvoL8=; fh=7Id7wL2M+oCJXD4imOzx4OKioxBXSOZqypDprm7aO4E=; b=CA2zYbPUnQFS22su8LOG1xMYYBfut9akcmJEeoyOMS5B/t/9TLnvqotVlCcEeh85UB bbTSvBNkdgJiIs/Lr/Yx6FmiNXmiH/1zvH7PeFm0XTQf771Vl37L8jQv7ctv43cHEMVc Z71CFEHHG6OmD4JpxkRTeoEEFA0i3S/jiCbhEFygYUR8J40jnvvINGgRt15n9johKjOS wUkV0bVakoTR1fxwh/OccrelYa7/4MHD1ISvOWsF+eAXbrvJW4z9HlVjTtZmCrJgvf0t gSadkAFnFH4bbj5iuMpVm0MX9PLpZpbaHJd9wMQEOnwI5n6OZsaFt9KJIsO0SodiqnxD E+1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hJlN7VF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id a70-20020a639049000000b00565ecd01399si1218337pge.783.2023.10.11.20.51.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:52:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hJlN7VF5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id B9EC4817907B; Wed, 11 Oct 2023 20:51:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376920AbjJLDvp (ORCPT + 99 others); Wed, 11 Oct 2023 23:51:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376855AbjJLDvY (ORCPT ); Wed, 11 Oct 2023 23:51:24 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0D57B6; Wed, 11 Oct 2023 20:51:21 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1bdf4752c3cso4011205ad.2; Wed, 11 Oct 2023 20:51:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697082681; x=1697687481; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=cPOXjwmN3ZMMh06n/p0NGkvvVnZrqkqOb37OFAMvoL8=; b=hJlN7VF5lkojISEEEE6JFzje5Q47d3eIQggM9OIUaVWObmzB4vkNaqkL4VgJj742wO S27+8AvdrQYQnRDjhhbaYM8TdXCKq4zBBXtnWRbTnO47uj6FkoaW6F92XoxoEUa6w/Qp HybNbypvFinrzXbqcOgBnLXY90Vm73C4GuLAadcXYLjCcMoPzf75ttS5vkvybjDFzUK5 lkCJhxCK5f5bIHjjppHjWcM+Tapv6ULUOA6N0jAaxdjYUjonUzcSnLK7G4gMVXeasq+/ yzRW+oiUcua5J2JcQAlL5/pMF2fF5QS0crlb1gQxVJIKSh3UHWU9GtqhWD9A8qqA1j5T Otqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697082681; x=1697687481; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=cPOXjwmN3ZMMh06n/p0NGkvvVnZrqkqOb37OFAMvoL8=; b=Od9VgrU0q22XG0PFokq41TZbbhl+ahO0m/j1UkbqtQ7ZExuO0s7uc86cMjgHwgKWM/ rGuNrXFOJ2anQuzDyS/yd1InOr9mR0O3pcGuIItkW1YXTrmyyhO/7kScq7fjeJs8Qlo+ vRPQRkAq43begNmXr9UhR8Ztyzu+/r6aZvcLRhBH9sZf4YhFIGYNP+loXu6kcQP1x72I 6IGMnMnVoshbGniZnsCz1rcBT2xvUnW0myZzh01yaJprPqhlP2YrViN3kgc5vdobP9kL jmh5+3F3hznke58EopsYXT5eeK/S9YQrUNTp5TBLvAqpMUVClqERxCoHFhEftC46s5u2 n70g== X-Gm-Message-State: AOJu0Yzo6OHIZpySHRuSi2lG3F8rBoRgT9jsXktMmsaUcLACYzi7VCHT TpKg7nb273stfkfLXf7dNws= X-Received: by 2002:a17:902:dacd:b0:1c0:c174:3695 with SMTP id q13-20020a170902dacd00b001c0c1743695mr23283409plx.13.1697082681229; Wed, 11 Oct 2023 20:51:21 -0700 (PDT) Received: from bangji.hsd1.ca.comcast.net ([2601:647:6780:42e0:b1b9:d490:2f5e:be06]) by smtp.gmail.com with ESMTPSA id w8-20020a170902d70800b001bc18e579aesm711374ply.101.2023.10.11.20.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 20:51:20 -0700 (PDT) Sender: Namhyung Kim From: Namhyung Kim To: Arnaldo Carvalho de Melo , Jiri Olsa , Peter Zijlstra Cc: 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: [PATCH 05/48] perf dwarf-aux: Move #ifdef code to the header file Date: Wed, 11 Oct 2023 20:50:28 -0700 Message-ID: <20231012035111.676789-6-namhyung@kernel.org> X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog In-Reply-To: <20231012035111.676789-1-namhyung@kernel.org> References: <20231012035111.676789-1-namhyung@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Wed, 11 Oct 2023 20:51:56 -0700 (PDT) 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. 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