Skip to content

Commit

Permalink
perf: Swap inclusion order of util.h and string.h in util/string.c
Browse files Browse the repository at this point in the history
Currently util/string.c includes headers in this order: string.h, util.h
But this causes a build error because __USE_GNU definition
is needed for strndup() definition:

	% 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 the headers inclusion order.
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: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <1270368798-27232-1-git-send-email-mitake@dcl.info.waseda.ac.jp>
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
  • Loading branch information
Hitoshi Mitake authored and Frederic Weisbecker committed Apr 4, 2010
1 parent 3326c1c commit 8141d00
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/perf/util/string.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "string.h"
#include "util.h"
#include "string.h"

#define K 1024LL
/*
Expand Down

0 comments on commit 8141d00

Please sign in to comment.