From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: "Ingo Molnar" <mingo@kernel.org>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Jiri Olsa" <jolsa@kernel.org>,
"Namhyung Kim" <namhyung@kernel.org>,
"Clark Williams" <williams@redhat.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
"Arnaldo Carvalho de Melo" <acme@redhat.com>,
"Adrian Hunter" <adrian.hunter@intel.com>,
"André Goddard Rosa" <andre.goddard@gmail.com>
Subject: Re: [PATCH 23/43] tools lib: Adopt skip_spaces() from the kernel sources
Date: Tue, 2 Jul 2019 10:46:03 -0300 [thread overview]
Message-ID: <20190702134603.GA15462@kernel.org> (raw)
In-Reply-To: <20190702121240.GB12694@krava>
Em Tue, Jul 02, 2019 at 02:12:40PM +0200, Jiri Olsa escreveu:
> On Mon, Jul 01, 2019 at 11:25:56PM -0300, Arnaldo Carvalho de Melo wrote:
> > From: Arnaldo Carvalho de Melo <acme@redhat.com>
> >
> > Same implementation, will be used to replace ad-hoc equivalent code in
> > tools/.
> >
> > Cc: Adrian Hunter <adrian.hunter@intel.com>
> > Cc: André Goddard Rosa <andre.goddard@gmail.com>
> > Cc: Jiri Olsa <jolsa@kernel.org>
> > Cc: Namhyung Kim <namhyung@kernel.org>
> > Link: https://lkml.kernel.org/n/tip-dig691cg9ripvoiprpidthw7@git.kernel.org
> > Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
> > ---
> > tools/include/linux/string.h | 4 +++-
> > tools/lib/string.c | 14 ++++++++++++++
> > 2 files changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
> > index 6c3e2cc274c5..cee239350a6b 100644
> > --- a/tools/include/linux/string.h
> > +++ b/tools/include/linux/string.h
> > @@ -29,4 +29,6 @@ static inline bool strstarts(const char *str, const char *prefix)
> > return strncmp(str, prefix, strlen(prefix)) == 0;
> > }
> >
> > -#endif /* _LINUX_STRING_H_ */
> > +extern char * __must_check skip_spaces(const char *);
> > +
> > +#endif /* _TOOLS_LINUX_STRING_H_ */
> > diff --git a/tools/lib/string.c b/tools/lib/string.c
> > index 93b3d4b6feac..50d400822bb3 100644
> > --- a/tools/lib/string.c
> > +++ b/tools/lib/string.c
> > @@ -17,6 +17,7 @@
> > #include <string.h>
> > #include <errno.h>
> > #include <linux/string.h>
> > +#include <linux/ctype.h>
> > #include <linux/compiler.h>
> >
> > /**
> > @@ -106,3 +107,16 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
> > }
> > return ret;
> > }
> > +
> > +/**
> > + * skip_spaces - Removes leading whitespace from @str.
> > + * @str: The string to be stripped.
> > + *
> > + * Returns a pointer to the first non-whitespace character in @str.
> > + */
> > +char *skip_spaces(const char *str)
> > +{
> > + while (isspace(*str))
> > + ++str;
> > + return (char *)str;
> > +}
> > --
> > 2.20.1
> >
>
> this breaks objtool build, because it adds _ctype dependency via isspace call
> patch below fixes it for me
Thanks for spotting this, I'll have it in my next pull request.
- Arnaldo
> jirka
>
>
> ---
> diff --git a/tools/objtool/Build b/tools/objtool/Build
> index 749becdf5b90..8dc4f0848362 100644
> --- a/tools/objtool/Build
> +++ b/tools/objtool/Build
> @@ -9,6 +9,7 @@ objtool-y += special.o
> objtool-y += objtool.o
>
> objtool-y += libstring.o
> +objtool-y += libctype.o
> objtool-y += str_error_r.o
>
> CFLAGS += -I$(srctree)/tools/lib
> @@ -17,6 +18,10 @@ $(OUTPUT)libstring.o: ../lib/string.c FORCE
> $(call rule_mkdir)
> $(call if_changed_dep,cc_o_c)
>
> +$(OUTPUT)libctype.o: ../lib/ctype.c FORCE
> + $(call rule_mkdir)
> + $(call if_changed_dep,cc_o_c)
> +
> $(OUTPUT)str_error_r.o: ../lib/str_error_r.c FORCE
> $(call rule_mkdir)
> $(call if_changed_dep,cc_o_c)
--
- Arnaldo
next prev parent reply other threads:[~2019-07-02 13:46 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-02 2:25 [GIT PULL] perf/core improvements and fixes Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 01/43] perf tools: Fix cache.h include directive Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 02/43] perf thread-stack: Fix thread stack return from kernel for kernel-only case Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 03/43] perf thread-stack: Eliminate code duplicating thread_stack__pop_ks() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 04/43] perf tools: Increase MAX_NR_CPUS and MAX_CACHES Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 05/43] perf intel-pt: Decoder to output CBR changes immediately Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 06/43] perf intel-pt: Cater for CBR change in PSB+ Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 07/43] perf intel-pt: Add CBR value to decoder state Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 08/43] perf intel-pt: Synthesize CBR events when last seen value changes Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 09/43] perf db-export: Export synth events Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 10/43] perf scripts python: export-to-sqlite.py: Export Intel PT power and ptwrite events Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 11/43] perf scripts python: export-to-postgresql.py: " Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 12/43] perf ctype: Remove unused 'graph_line' variable Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 13/43] perf ui stdio: No need to use 'spaces' to left align Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 14/43] perf ctype: Remove now unused 'spaces' variable Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 15/43] perf string: Move 'dots' and 'graph_dotted_line' out of sane_ctype.h Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 16/43] tools x86 machine: Add missing util.h to pick up 'page_size' Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 17/43] perf kallsyms: Adopt hex2u64 from tools/perf/util/util.h Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 18/43] perf symbols: We need util.h in symbol-elf.c for zfree() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 19/43] perf tools: Remove old baggage that is util/include/linux/ctype.h Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 20/43] perf tools: Add missing util.h to pick up 'page_size' variable Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 21/43] tools perf: Move from sane_ctype.h obtained from git to the Linux's original Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 22/43] perf tools: Use linux/ctype.h in more places Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 23/43] tools lib: Adopt skip_spaces() from the kernel sources Arnaldo Carvalho de Melo
2019-07-02 12:12 ` Jiri Olsa
2019-07-02 13:46 ` Arnaldo Carvalho de Melo [this message]
2019-07-02 13:48 ` Arnaldo Carvalho de Melo
2019-07-02 13:54 ` Jiri Olsa
2019-07-02 14:02 ` Arnaldo Carvalho de Melo
2019-07-02 13:49 ` Joe Perches
2019-07-02 2:25 ` [PATCH 24/43] perf stat: Use recently introduced skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 25/43] perf header: Use skip_spaces() in __write_cpudesc() Arnaldo Carvalho de Melo
2019-07-02 2:25 ` [PATCH 26/43] perf time-utils: Use skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 27/43] perf probe: Use skip_spaces() for argv handling Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 28/43] perf strfilter: Use skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 29/43] perf metricgroup: Use strsep() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 30/43] perf report: Use skip_spaces() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 31/43] perf tools: Ditch rtrim(), use skip_spaces() to get closer to the kernel Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 32/43] tools lib: Adopt strim() from " Arnaldo Carvalho de Melo
[not found] ` <CAGje9yTfFrUxj-vSX=Au856Fe_307aQqD=YrbGeWfHESQ6Rw8w@mail.gmail.com>
2019-07-02 16:00 ` Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 33/43] perf tools: Remove trim() implementation, use tools/lib's strim() Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 34/43] perf tools: Ditch rtrim(), use strim() from tools/lib Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 35/43] tools lib: Adopt strreplace() from the kernel Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 36/43] perf tools: Drop strxfrchar(), use strreplace() equivalent from kernel Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 37/43] tools lib: Move argv_{split,free} from tools/perf/util/ Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 38/43] perf stat: Make metric event lookup more robust Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 39/43] perf stat: Don't merge events in the same PMU Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 40/43] perf stat: Fix group lookup for metric group Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 41/43] perf stat: Fix metrics with --no-merge Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 42/43] perf annotate: Add csky support Arnaldo Carvalho de Melo
2019-07-02 2:26 ` [PATCH 43/43] perf jevents: Use nonlocal include statements in pmu-events.c Arnaldo Carvalho de Melo
2019-07-03 13:55 ` [GIT PULL] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190702134603.GA15462@kernel.org \
--to=arnaldo.melo@gmail.com \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=andre.goddard@gmail.com \
--cc=jolsa@kernel.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=tglx@linutronix.de \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).