Skip to contentSkip to conversation

perf build: Minor cleanup

PATCH In review Leo Yan 2 participants 5 messages Mar 28, 2025 1 message not in the archive perf events

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

cover perf build: Minor cleanup

This series includes two minor cleanup for perf build, with using the GCC-15 (15.0.1 20250327).

Leo Yan (2):
perf build: Remove unused LIBPERF_CLFAGS
perf hist: Refine signed integer checking

 tools/perf/Makefile.config | 2 --
 tools/perf/ui/stdio/hist.c | 6 +-----
 2 files changed, 1 insertion(+), 7 deletions(-)
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/2 perf build: Remove unused LIBPERF_CLFAGS

Since commit 91009a3a9913 ("perf build: Install libperf locally when building"), the LIBPERF_CFLAGS flag is never populated to libperf.

As the flag is not used anymore, remove it.

---
 tools/perf/Makefile.config | 2 --
 1 file changed, 2 deletions(-)
tools/perf/Makefile.config +0 -2
index eea95c6c0c71..94dfc18c2741 100644
@@ -389,8 +389,6 @@ CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS   += $(CORE_CFLAGS) $(INC_FLAGS)
 CXXFLAGS += $(INC_FLAGS)
 
-LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
-
 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
   CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
 endif
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS

Quoted 7 lines · Leo Yan

Since commit 91009a3a9913 ("perf build: Install libperf locally when building"), the LIBPERF_CFLAGS flag is never populated to libperf.

As the flag is not used anymore, remove it.

Thanks for the cleanup!
Ian

Quoted 20 lines
---
 tools/perf/Makefile.config | 2 --
 1 file changed, 2 deletions(-)
tools/perf/Makefile.config +0 -3
index eea95c6c0c71..94dfc18c2741 100644
@@ -389,8 +389,6 @@ CORE_CFLAGS += -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
 CFLAGS   += $(CORE_CFLAGS) $(INC_FLAGS)
 CXXFLAGS += $(INC_FLAGS)
 
-LIBPERF_CFLAGS := $(CORE_CFLAGS) $(EXTRA_CFLAGS)
-
 ifeq ($(feature-pthread-attr-setaffinity-np), 1)
   CFLAGS += -DHAVE_PTHREAD_ATTR_SETAFFINITY_NP
 endif
--

2.34.1

A message that is not in the archive (sent off-list or not yet received): CA+JHD90hqsAQn8FcwdBnzU8aPOmey76MrUkGitu9E4i2sC2bWw@mail.gmail.com

author
#4 lore raw

Re: [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS

Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 2 lines · Leo Yan

Since commit 91009a3a9913 ("perf build: Install libperf locally when building"), the LIBPERF_CFLAGS flag is never

I'll fix the summary, should be CFLAGS,

Sure. Thanks for fixing up!

Thanks,
Leo

author
#5 lore raw

PATCH 2/2 perf hist: Refine signed integer checking

In reply to Leo Yan

To avoid any issues caused by overflow in a signed integer, and since the limit to USHRT_MAX is not necessary, this patch simply decrements the signed integer and checks that it is greater than 0.

---
 tools/perf/ui/stdio/hist.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
tools/perf/ui/stdio/hist.c +1 -5
index 7ac4b98e28bc..6da624309fab 100644
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <linux/string.h>
@@ -25,10 +24,7 @@ static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
 	int i;
 	int ret = fprintf(fp, "            ");
 
-	if (left_margin > USHRT_MAX)
-		left_margin = USHRT_MAX;
-
-	for (i = 0; i < left_margin; i++)
+	for (i = left_margin; i > 0; i--)
 		ret += fprintf(fp, " ");
 
 	return ret;
Signature · 1 line
2.34.1