From: Vineet.Gupta1@synopsys.com (Vineet Gupta)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH v2] tools lib: Reinstate strlcpy() header guard with __UCLIBC__
Date: Thu, 18 Aug 2016 09:28:23 -0700 [thread overview]
Message-ID: <1471537703-16439-1-git-send-email-vgupta@synopsys.com> (raw)
In-Reply-To: <20160818140722.GC16916@redhat.com>
perf tools build in recent kernels spews splat when cross compiling with uClibc
| CC util/alias.o
| In file included from tools/perf/util/../ui/../util/cache.h:8:0,
| from tools/perf/util/../ui/helpline.h:7,
| from tools/perf/util/debug.h:8,
| from arch/../util/cpumap.h:9,
| from arch/../util/env.h:5,
| from arch/common.h:4,
| from arch/common.c:3:
| tools/include/linux/string.h:12:15: warning: redundant redeclaration of ?strlcpy? [-Wredundant-decls]
| extern size_t strlcpy(char *dest, const char *src, size_t size);
^
This is after commit 61a6445e463a31 ("tools lib: Guard the strlcpy() header with
__GLIBC__").
The problem is uClibc also defines __GLIBC__ for exported headers for
applications. So add that specific check to not trip for uClibc.
Cc: Adrian Hunter <adrian.hunter at intel.com>
Cc: Alexey Brodkin <Alexey.Brodkin at synopsys.com>
Cc: David Ahern <dsahern at gmail.com>
Cc: Jiri Olsa <jolsa at kernel.org>
Cc: Namhyung Kim <namhyung at kernel.org>
Cc: Wang Nan <wangnan0 at huawei.com>
Cc: Petri Gynther <pgynther at google.com>
Cc: Peter Zijlstra (Intel) <peterz at infradead.org>
Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
---
tools/include/linux/string.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/tools/include/linux/string.h b/tools/include/linux/string.h
index b96879477311..f436d2420a18 100644
--- a/tools/include/linux/string.h
+++ b/tools/include/linux/string.h
@@ -8,7 +8,11 @@ void *memdup(const void *src, size_t len);
int strtobool(const char *s, bool *res);
-#ifdef __GLIBC__
+/*
+ * glibc based builds needs the extern while uClibc doesn't.
+ * However uClibc headers also define __GLIBC__ hence the hack below
+ */
+#if defined(__GLIBC__) && !defined(__UCLIBC__)
extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif
--
2.7.4
prev parent reply other threads:[~2016-08-18 16:28 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-17 20:00 [PATCH] tools lib: Reinstate strlcpy() header guard with __UCLIBC__ Vineet Gupta
2016-08-18 14:07 ` Arnaldo Carvalho de Melo
2016-08-18 16:03 ` Vineet Gupta
2016-08-18 16:17 ` Arnaldo Carvalho de Melo
2016-08-19 14:22 ` Arnaldo Carvalho de Melo
2016-08-19 18:01 ` Vineet Gupta
2016-08-19 19:23 ` Arnaldo Carvalho de Melo
2016-08-19 20:09 ` Vineet Gupta
2016-08-19 21:10 ` Arnaldo Carvalho de Melo
2016-08-19 21:27 ` Vineet Gupta
2016-08-19 21:42 ` Arnaldo Carvalho de Melo
2016-08-19 23:02 ` Arnaldo Carvalho de Melo
2016-08-22 18:01 ` Alexey Brodkin
2016-08-22 18:08 ` Arnaldo Carvalho de Melo
2016-08-18 16:28 ` Vineet Gupta [this message]
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=1471537703-16439-1-git-send-email-vgupta@synopsys.com \
--to=vineet.gupta1@synopsys.com \
--cc=linux-snps-arc@lists.infradead.org \
/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).