perf: Fix implicit declaration of getline in util.c
PATCH 1/1 perf: Fix implicit declaration of getline in util.c
getline() is considered as undeclared in util/util.c because it includes string.h, that in turn includes stdio.h, without having defined _GNU_SOURCE.
But util.c also includes util.h that handles the _GNU_SOURCE and all the needed inclusions already. Let's include only util.h and sys/mman.h which is the only one header not handled by util.h
This fixes the following build error:
util/util.c: In function ‘slow_copyfile’:util/util.c:49: erreur: implicit declaration of function ‘getline’ util/util.c:49: erreur: nested extern declaration of ‘getline’
--- tools/perf/util/util.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
tools/perf/util/util.c +1 -6
@@ -1,10 +1,5 @@ -#include <sys/mman.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> #include "util.h" +#include <sys/mman.h> int mkdir_p (char *path,mode_t mode) {
Signature · 1 line
1.6.2.3
Commit-ID: 69e3f52d1b1a3ed4390bb8a09bb1324265af7fbf Gitweb: http://git.kernel.org/tip/69e3f52d1b1a3ed4390bb8a09bb1324265af7fbf Author: Frederic Weisbecker <[email protected]> AuthorDate: Sat, 16 Jan 2010 14:21:15 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sun, 17 Jan 2010 07:53:09 +0100
perf: Fix implicit declaration of getline in util.c
getline() is considered as undeclared in util/util.c because it includes string.h, that in turn includes stdio.h, without having defined _GNU_SOURCE.
But util.c also includes util.h that handles the _GNU_SOURCE and all the needed inclusions already. Let's include only util.h and sys/mman.h which is the only one header not handled by util.h
This fixes the following build error:
util/util.c: In function 'slow_copyfile':
util/util.c:49: erreur: implicit declaration of function 'getline' util/util.c:49: erreur: nested extern declaration of 'getline'
LKML-Reference: <[email protected]>
--- tools/perf/util/util.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
tools/perf/util/util.c +1 -6
@@ -1,10 +1,5 @@ -#include <sys/mman.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <string.h> -#include <unistd.h> #include "util.h" +#include <sys/mman.h> int mkdir_p (char *path,mode_t mode) {