Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp697783rdb; Sun, 3 Sep 2023 06:42:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH9I75r0YxNQdkotShwfDlWTHdStA4S4LDd5qQdM06AO+DVb0eFFnkNqACwkM9sn6uEfRml X-Received: by 2002:a17:906:291:b0:99d:d4ec:6c5d with SMTP id 17-20020a170906029100b0099dd4ec6c5dmr5220180ejf.73.1693748524140; Sun, 03 Sep 2023 06:42:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693748524; cv=none; d=google.com; s=arc-20160816; b=St2mHW3L1kZKAmpnkHfrIeHgE9Kx7nTQZ7BPZRnpa6Tg7/8F+wGwQbm4jLhwvv/ZJC O6R9Z2yQ/Jy54gntbQHT2OC4p3HLtTgAupe9HuS4cu9FXB1RAqBmm7Dk951i1wjogStR oIVKX6PZLav1AwYusUmwZbDXQKffXw0AQiIg7+6uMVpI4VtSyzEnLHYFgW5YyFVuDMM2 Si7eQMnT2cHzOnlovFjElS9AT5ypJH3E4NE9oyY6y8nwjDWEtTcZvom1jCTGXrd68ZPV b/qndRDgQzgmlFXmC9KO8oZrLNNt+kpmSaOryDjTaT7mC49nkkPcIw2G+HCpt3JNlr+p 7pqA== 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 :dkim-signature; bh=xHviIjSIGtAjHbY83gxmWUsuMOT6BxdHNIbHYoS1Z48=; fh=QjEY/2EO9V5p3DwVRfuGCY/MJxrNiqg6iLsNzl7Khu0=; b=V0vQaHn0zBrlFvlygzsMma+AbPrI03yqKpfem3V/kW6z+5EuY6FH4nRIoz1/TO5Rh1 /lQ0XfdloCpVigvurg2jFvzb34GEArRIyi3WzBeIlas5GeYgK14MUNheUoq3W63m+QRI iWyLsIa5FZq7FZ3QXXIKcYgIm1ApxZtjZdUcc+Zz+bTX+foJTyeUKuZC2FvS/dRIqZ2j 7TufsPQInjNr4fwOiO1yP2YIysojxdqC8xAkhFuQVhmMUyX3ybqlh3wLKEt5MM6nEdKc tbTs4mbgWY/ByySLSpSkUaSqWrUxIIW0RdIfuQcv+WJhn3UXZJaqSfPfS9Xh7gLYiQjw Jjxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KoAJJIs+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r4-20020a170906350400b0099e028b0201si4990197eja.962.2023.09.03.06.41.37; Sun, 03 Sep 2023 06:42:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=KoAJJIs+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236776AbjICLru (ORCPT + 99 others); Sun, 3 Sep 2023 07:47:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236756AbjICLrr (ORCPT ); Sun, 3 Sep 2023 07:47:47 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D06A133; Sun, 3 Sep 2023 04:47:43 -0700 (PDT) Received: from pps.filterd (m0353728.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 383BgVO8026465; Sun, 3 Sep 2023 11:47:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=xHviIjSIGtAjHbY83gxmWUsuMOT6BxdHNIbHYoS1Z48=; b=KoAJJIs+kL9tvLBad/nNRPoSqGgw2Q6LY36AIq+o2+MicDsX5fUA1JuExfBj+eyukO5D RZZ3unvqEvq1FqiGMo2I7trJgE4ZaheQWomSPczcir2zXQ+XoH3ZKy7oy4m83h3hnvca 57AaGAcF5raUU0jwfYB1zaWnsm1/1/rmk7u8/sAZ0/+0pzzYIr8f2+Dmmz0PeTl3W3v4 rD9/RyTMvckkwUkdjyAKjPPkxTw8tCL1vFbrPx3Hel0lN2q7fzO7FLf5aNt59XJMFnw+ 8UxSyKmJrIyQRU+CwA4hu068V5tBHql+rUk28UakdUVuzW8SroX3tb/Wk+0tD+ZhjqsF XQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3svsggg1re-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 03 Sep 2023 11:47:34 +0000 Received: from m0353728.ppops.net (m0353728.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 383BlYqX007147; Sun, 3 Sep 2023 11:47:34 GMT Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3svsggg1ra-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 03 Sep 2023 11:47:33 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3839CNFr001610; Sun, 3 Sep 2023 11:47:33 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3svfcs3act-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 03 Sep 2023 11:47:33 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 383BlUKh18350728 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 3 Sep 2023 11:47:30 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1EF5320040; Sun, 3 Sep 2023 11:47:30 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D948D2004B; Sun, 3 Sep 2023 11:47:27 +0000 (GMT) Received: from li-3c92a0cc-27cf-11b2-a85c-b804d9ca68fa.ibm.com.com (unknown [9.171.15.154]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 3 Sep 2023 11:47:27 +0000 (GMT) From: Aditya Gupta To: acme@kernel.org, jolsa@kernel.org, irogers@google.com, namhyung@kernel.org Cc: linux-perf-users@vger.kernel.org, maddy@linux.ibm.com, atrajeev@linux.vnet.ibm.com, kjain@linux.ibm.com, disgoel@linux.vnet.ibm.com, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] perf version: update --build-options to use 'supported_features' array Date: Sun, 3 Sep 2023 17:17:19 +0530 Message-ID: <20230903114721.190733-3-adityag@linux.ibm.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230903114721.190733-1-adityag@linux.ibm.com> References: <20230903114721.190733-1-adityag@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: MBwsio2MM2ywfq0YxQlS7DaFzXHPUsPh X-Proofpoint-GUID: R2KcOeyCy2Z7_w0aAO1PdYWyw0qY2YFt X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.957,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-03_09,2023-08-31_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 spamscore=0 mlxlogscore=966 phishscore=0 suspectscore=0 malwarescore=0 mlxscore=0 priorityscore=1501 adultscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309030108 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that the feature list has been duplicated in a global 'supported_features' array, use that array instead of manually checking status of built-in features. This helps in being consistent with commands such as 'perf check --feature', so commands can use the same array, and any new feature can be added at one place, in the 'supported_features' array Signed-off-by: Aditya Gupta --- tools/perf/builtin-version.c | 39 ++++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/tools/perf/builtin-version.c b/tools/perf/builtin-version.c index e5859c70e195..e149d96c6dc5 100644 --- a/tools/perf/builtin-version.c +++ b/tools/perf/builtin-version.c @@ -46,41 +46,18 @@ static void status_print(const char *name, const char *macro, printf(" # %s\n", macro); } -#define STATUS(__d, __m) \ -do { \ - if (IS_BUILTIN(__d)) \ - status_print(#__m, #__d, "on"); \ - else \ - status_print(#__m, #__d, "OFF"); \ +#define STATUS(feature) \ +do { \ + if (feature.is_builtin) \ + status_print(feature.name, feature.macro, "on"); \ + else \ + status_print(feature.name, feature.macro, "OFF"); \ } while (0) static void library_status(void) { - STATUS(HAVE_DWARF_SUPPORT, dwarf); - STATUS(HAVE_DWARF_GETLOCATIONS_SUPPORT, dwarf_getlocations); -#ifndef HAVE_SYSCALL_TABLE_SUPPORT - STATUS(HAVE_LIBAUDIT_SUPPORT, libaudit); -#endif - STATUS(HAVE_SYSCALL_TABLE_SUPPORT, syscall_table); - STATUS(HAVE_LIBBFD_SUPPORT, libbfd); - STATUS(HAVE_DEBUGINFOD_SUPPORT, debuginfod); - STATUS(HAVE_LIBELF_SUPPORT, libelf); - STATUS(HAVE_LIBNUMA_SUPPORT, libnuma); - STATUS(HAVE_LIBNUMA_SUPPORT, numa_num_possible_cpus); - STATUS(HAVE_LIBPERL_SUPPORT, libperl); - STATUS(HAVE_LIBPYTHON_SUPPORT, libpython); - STATUS(HAVE_SLANG_SUPPORT, libslang); - STATUS(HAVE_LIBCRYPTO_SUPPORT, libcrypto); - STATUS(HAVE_LIBUNWIND_SUPPORT, libunwind); - STATUS(HAVE_DWARF_SUPPORT, libdw-dwarf-unwind); - STATUS(HAVE_ZLIB_SUPPORT, zlib); - STATUS(HAVE_LZMA_SUPPORT, lzma); - STATUS(HAVE_AUXTRACE_SUPPORT, get_cpuid); - STATUS(HAVE_LIBBPF_SUPPORT, bpf); - STATUS(HAVE_AIO_SUPPORT, aio); - STATUS(HAVE_ZSTD_SUPPORT, zstd); - STATUS(HAVE_LIBPFM, libpfm4); - STATUS(HAVE_LIBTRACEEVENT, libtraceevent); + for (int i = 0; supported_features[i].name; ++i) + STATUS(supported_features[i]); } int cmd_version(int argc, const char **argv) -- 2.41.0