All of lore.kernel.org
 help / color / mirror / Atom feed
From: acme@kernel.org (Arnaldo Carvalho de Melo)
To: linux-snps-arc@lists.infradead.org
Subject: [PATCH 2/3] tools lib: Reinstate strlcpy() header guard with __UCLIBC__
Date: Thu, 18 Aug 2016 17:40:53 -0300	[thread overview]
Message-ID: <1471552854-26972-3-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1471552854-26972-1-git-send-email-acme@kernel.org>

From: Vineet Gupta <Vineet.Gupta1@synopsys.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.

Signed-off-by: Vineet Gupta <vgupta at synopsys.com>
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: Josh Poimboeuf <jpoimboe at redhat.com>
Cc: Namhyung Kim <namhyung at kernel.org>
Cc: Peter Zijlstra <peterz at infradead.org>
Cc: Petri Gynther <pgynther at google.com>
Cc: Wang Nan <wangnan0 at huawei.com>
Cc: linux-snps-arc at lists.infradead.org
Link: http://lkml.kernel.org/r/1471537703-16439-1-git-send-email-vgupta at synopsys.com
Signed-off-by: Arnaldo Carvalho de Melo <acme at redhat.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

WARNING: multiple messages have this Message-ID (diff)
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	Vineet Gupta <Vineet.Gupta1@synopsys.com>,
	Vineet Gupta <vgupta@synopsys.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Alexey Brodkin <Alexey.Brodkin@synopsys.com>,
	David Ahern <dsahern@gmail.com>, Jiri Olsa <jolsa@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Petri Gynther <pgynther@google.com>,
	Wang Nan <wangnan0@huawei.com>,
	linux-snps-arc@lists.infradead.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 2/3] tools lib: Reinstate strlcpy() header guard with __UCLIBC__
Date: Thu, 18 Aug 2016 17:40:53 -0300	[thread overview]
Message-ID: <1471552854-26972-3-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1471552854-26972-1-git-send-email-acme@kernel.org>

From: Vineet Gupta <Vineet.Gupta1@synopsys.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.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petri Gynther <pgynther@google.com>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: linux-snps-arc@lists.infradead.org
Link: http://lkml.kernel.org/r/1471537703-16439-1-git-send-email-vgupta@synopsys.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.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

  parent reply	other threads:[~2016-08-18 20:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-18 20:40 [GIT PULL 0/3] perf/urgent fixes Arnaldo Carvalho de Melo
2016-08-18 20:40 ` Arnaldo Carvalho de Melo
2016-08-18 20:40 ` [PATCH 1/3] perf unwind: Use addr_location::addr instead of ip for entries Arnaldo Carvalho de Melo
2016-08-18 20:40 ` Arnaldo Carvalho de Melo [this message]
2016-08-18 20:40   ` [PATCH 2/3] tools lib: Reinstate strlcpy() header guard with __UCLIBC__ Arnaldo Carvalho de Melo
2016-08-18 20:40 ` [PATCH 3/3] perf evsel: Do not access outside hw cache name arrays Arnaldo Carvalho de Melo
2016-08-18 20:51 ` [GIT PULL 0/3] perf/urgent fixes Ingo Molnar
2016-08-18 20:51   ` 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=1471552854-26972-3-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.