public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Swap including order of util.h and string.h of util/string.c
@ 2010-04-04  8:13 Hitoshi Mitake
  2010-04-04 14:34 ` Frederic Weisbecker
  0 siblings, 1 reply; 3+ messages in thread
From: Hitoshi Mitake @ 2010-04-04  8:13 UTC (permalink / raw)
  To: mingo
  Cc: linux-kernel, mitake, h.mitake, Peter Zijlstra, Paul Mackerras,
	Frederic Weisbecker, Arnaldo Carvalho de Melo

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

Current util/string.c includes headers in this order: string.h, util.h
But this causes build error because __USE_GNU definition
is needed for strndup() definition like this,
% make -j
touch .perf.dev.null
    CC util/string.o
cc1: warnings being treated as errors
util/string.c: In function ‘argv_split’:
util/string.c:171: error: implicit declaration of function ‘strndup’
util/string.c:171: error: incompatible implicit declaration of built-in function ‘strndup’

So this patch swaps order of including headers.
util.h defines _GNU_SOURCE, and /usr/include/features.h defines __USE_GNU as 1
if _GNU_SOURCE is defined.

Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/string.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index d438924..0409fc7 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -1,5 +1,5 @@
-#include "string.h"
 #include "util.h"
+#include "string.h"
 
 #define K 1024LL
 /*
-- 
1.6.5.2


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

* Re: [PATCH] Swap including order of util.h and string.h of util/string.c
  2010-04-04  8:13 [PATCH] Swap including order of util.h and string.h of util/string.c Hitoshi Mitake
@ 2010-04-04 14:34 ` Frederic Weisbecker
  2010-04-04 23:23   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Frederic Weisbecker @ 2010-04-04 14:34 UTC (permalink / raw)
  To: Hitoshi Mitake
  Cc: mingo, linux-kernel, h.mitake, Peter Zijlstra, Paul Mackerras,
	Arnaldo Carvalho de Melo

On Sun, Apr 04, 2010 at 05:13:18PM +0900, Hitoshi Mitake wrote:
> Current util/string.c includes headers in this order: string.h, util.h
> But this causes build error because __USE_GNU definition
> is needed for strndup() definition like this,
> % make -j
> touch .perf.dev.null
>     CC util/string.o
> cc1: warnings being treated as errors
> util/string.c: In function ‘argv_split’:
> util/string.c:171: error: implicit declaration of function ‘strndup’
> util/string.c:171: error: incompatible implicit declaration of built-in function ‘strndup’


Thanks, I've queued it as I have the same problem and I'm
about to send a perf/core queue.



> 
> So this patch swaps order of including headers.
> util.h defines _GNU_SOURCE, and /usr/include/features.h defines __USE_GNU as 1
> if _GNU_SOURCE is defined.
> 
> Signed-off-by: Hitoshi Mitake <mitake@dcl.info.waseda.ac.jp>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
> ---
>  tools/perf/util/string.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
> index d438924..0409fc7 100644
> --- a/tools/perf/util/string.c
> +++ b/tools/perf/util/string.c
> @@ -1,5 +1,5 @@
> -#include "string.h"
>  #include "util.h"
> +#include "string.h"
>  
>  #define K 1024LL
>  /*
> -- 
> 1.6.5.2
> 


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

* Re: [PATCH] Swap including order of util.h and string.h of util/string.c
  2010-04-04 14:34 ` Frederic Weisbecker
@ 2010-04-04 23:23   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2010-04-04 23:23 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Hitoshi Mitake, mingo, linux-kernel, h.mitake, Peter Zijlstra,
	Paul Mackerras

Em Sun, Apr 04, 2010 at 04:34:43PM +0200, Frederic Weisbecker escreveu:
> On Sun, Apr 04, 2010 at 05:13:18PM +0900, Hitoshi Mitake wrote:
> > Current util/string.c includes headers in this order: string.h, util.h
> > But this causes build error because __USE_GNU definition
> > is needed for strndup() definition like this,
> > % make -j
> > touch .perf.dev.null
> >     CC util/string.o
> > cc1: warnings being treated as errors
> > util/string.c: In function ‘argv_split’:
> > util/string.c:171: error: implicit declaration of function ‘strndup’
> > util/string.c:171: error: incompatible implicit declaration of built-in function ‘strndup’
> 
> Thanks, I've queued it as I have the same problem and I'm
> about to send a perf/core queue.

Sorry about that and thanks for queueing it up, keeping this tempo of
getting patches queued up and pushed up upstream for perf is really nice
inasmuch as we keep it sane, and so far I think it is really being
excellent! :-)

- Arnaldo

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

end of thread, other threads:[~2010-04-04 23:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-04  8:13 [PATCH] Swap including order of util.h and string.h of util/string.c Hitoshi Mitake
2010-04-04 14:34 ` Frederic Weisbecker
2010-04-04 23:23   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox