linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] perf build: Minor cleanup
@ 2025-03-28 12:26 Leo Yan
  2025-03-28 12:26 ` [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS Leo Yan
  2025-03-28 12:26 ` [PATCH 2/2] perf hist: Refine signed integer checking Leo Yan
  0 siblings, 2 replies; 5+ messages in thread
From: Leo Yan @ 2025-03-28 12:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Jiri Olsa,
	Adrian Hunter, Liang, Kan, linux-perf-users, linux-kernel
  Cc: Leo Yan

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(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS
  2025-03-28 12:26 [PATCH 0/2] perf build: Minor cleanup Leo Yan
@ 2025-03-28 12:26 ` Leo Yan
  2025-03-28 16:30   ` Ian Rogers
       [not found]   ` <CA+JHD90hqsAQn8FcwdBnzU8aPOmey76MrUkGitu9E4i2sC2bWw@mail.gmail.com>
  2025-03-28 12:26 ` [PATCH 2/2] perf hist: Refine signed integer checking Leo Yan
  1 sibling, 2 replies; 5+ messages in thread
From: Leo Yan @ 2025-03-28 12:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Jiri Olsa,
	Adrian Hunter, Liang, Kan, linux-perf-users, linux-kernel
  Cc: 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.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/Makefile.config | 2 --
 1 file changed, 2 deletions(-)

diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index eea95c6c0c71..94dfc18c2741 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] perf hist: Refine signed integer checking
  2025-03-28 12:26 [PATCH 0/2] perf build: Minor cleanup Leo Yan
  2025-03-28 12:26 ` [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS Leo Yan
@ 2025-03-28 12:26 ` Leo Yan
  1 sibling, 0 replies; 5+ messages in thread
From: Leo Yan @ 2025-03-28 12:26 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Jiri Olsa,
	Adrian Hunter, Liang, Kan, linux-perf-users, linux-kernel
  Cc: 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.

Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 tools/perf/ui/stdio/hist.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index 7ac4b98e28bc..6da624309fab 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS
  2025-03-28 12:26 ` [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS Leo Yan
@ 2025-03-28 16:30   ` Ian Rogers
       [not found]   ` <CA+JHD90hqsAQn8FcwdBnzU8aPOmey76MrUkGitu9E4i2sC2bWw@mail.gmail.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Ian Rogers @ 2025-03-28 16:30 UTC (permalink / raw)
  To: Leo Yan
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Jiri Olsa, Adrian Hunter,
	Liang, Kan, linux-perf-users, linux-kernel

On Fri, Mar 28, 2025 at 5:27 AM Leo Yan <leo.yan@arm.com> wrote:
>
> 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.
>
> Signed-off-by: Leo Yan <leo.yan@arm.com>

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks for the cleanup!
Ian

> ---
>  tools/perf/Makefile.config | 2 --
>  1 file changed, 2 deletions(-)
>
> diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
> index eea95c6c0c71..94dfc18c2741 100644
> --- a/tools/perf/Makefile.config
> +++ b/tools/perf/Makefile.config
> @@ -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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS
       [not found]   ` <CA+JHD90hqsAQn8FcwdBnzU8aPOmey76MrUkGitu9E4i2sC2bWw@mail.gmail.com>
@ 2025-03-28 17:16     ` Leo Yan
  0 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2025-03-28 17:16 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, Ian Rogers, Jiri Olsa,
	Adrian Hunter, Liang, Kan, linux-perf-users,
	Linux Kernel Mailing List

On Fri, Mar 28, 2025 at 01:47:39PM -0300, Arnaldo Carvalho de Melo wrote:
> On Fri, Mar 28, 2025, 9:27 AM Leo Yan <leo.yan@arm.com> wrote:
> 
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-28 17:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 12:26 [PATCH 0/2] perf build: Minor cleanup Leo Yan
2025-03-28 12:26 ` [PATCH 1/2] perf build: Remove unused LIBPERF_CLFAGS Leo Yan
2025-03-28 16:30   ` Ian Rogers
     [not found]   ` <CA+JHD90hqsAQn8FcwdBnzU8aPOmey76MrUkGitu9E4i2sC2bWw@mail.gmail.com>
2025-03-28 17:16     ` Leo Yan
2025-03-28 12:26 ` [PATCH 2/2] perf hist: Refine signed integer checking Leo Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).