Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf version: Update --build-options to use 'supported_features' array

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

Reviewed-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Signed-off-by: Aditya Gupta <adityag@linux.ibm.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240904190132.415212-4-adityag@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Aditya Gupta and committed by
Arnaldo Carvalho de Melo
6cdd7750 9b2b9b66

+8 -36
+8 -36
tools/perf/builtin-version.c
··· 46 46 printf(" # %s\n", macro); 47 47 } 48 48 49 - #define STATUS(__d, __m) \ 50 - do { \ 51 - if (IS_BUILTIN(__d)) \ 52 - status_print(#__m, #__d, "on"); \ 53 - else \ 54 - status_print(#__m, #__d, "OFF"); \ 49 + #define STATUS(feature) \ 50 + do { \ 51 + if (feature.is_builtin) \ 52 + status_print(feature.name, feature.macro, "on"); \ 53 + else \ 54 + status_print(feature.name, feature.macro, "OFF"); \ 55 55 } while (0) 56 56 57 57 static void library_status(void) 58 58 { 59 - STATUS(HAVE_DWARF_SUPPORT, dwarf); 60 - STATUS(HAVE_DWARF_GETLOCATIONS_SUPPORT, dwarf_getlocations); 61 - #ifndef HAVE_SYSCALL_TABLE_SUPPORT 62 - STATUS(HAVE_LIBAUDIT_SUPPORT, libaudit); 63 - #endif 64 - STATUS(HAVE_SYSCALL_TABLE_SUPPORT, syscall_table); 65 - STATUS(HAVE_LIBBFD_SUPPORT, libbfd); 66 - STATUS(HAVE_DEBUGINFOD_SUPPORT, debuginfod); 67 - STATUS(HAVE_LIBELF_SUPPORT, libelf); 68 - STATUS(HAVE_LIBLLVM_SUPPORT, libllvm); 69 - STATUS(HAVE_LIBNUMA_SUPPORT, libnuma); 70 - STATUS(HAVE_LIBNUMA_SUPPORT, numa_num_possible_cpus); 71 - STATUS(HAVE_LIBPERL_SUPPORT, libperl); 72 - STATUS(HAVE_LIBPYTHON_SUPPORT, libpython); 73 - STATUS(HAVE_SLANG_SUPPORT, libslang); 74 - STATUS(HAVE_LIBCRYPTO_SUPPORT, libcrypto); 75 - STATUS(HAVE_LIBUNWIND_SUPPORT, libunwind); 76 - STATUS(HAVE_DWARF_SUPPORT, libdw-dwarf-unwind); 77 - STATUS(HAVE_LIBCAPSTONE_SUPPORT, libcapstone); 78 - STATUS(HAVE_ZLIB_SUPPORT, zlib); 79 - STATUS(HAVE_LZMA_SUPPORT, lzma); 80 - STATUS(HAVE_AUXTRACE_SUPPORT, get_cpuid); 81 - STATUS(HAVE_LIBBPF_SUPPORT, bpf); 82 - STATUS(HAVE_AIO_SUPPORT, aio); 83 - STATUS(HAVE_ZSTD_SUPPORT, zstd); 84 - STATUS(HAVE_LIBPFM, libpfm4); 85 - STATUS(HAVE_LIBTRACEEVENT, libtraceevent); 86 - STATUS(HAVE_BPF_SKEL, bpf_skeletons); 87 - STATUS(HAVE_DWARF_UNWIND_SUPPORT, dwarf-unwind-support); 88 - STATUS(HAVE_CSTRACE_SUPPORT, libopencsd); 59 + for (int i = 0; supported_features[i].name; ++i) 60 + STATUS(supported_features[i]); 89 61 } 90 62 91 63 int cmd_version(int argc, const char **argv)