Skip to contentSkip to conversation

Fix perf build against newer glibc

PATCH In review Josh Boyer 1 participant 2 messages Aug 18, 2011 perf events

lore
Share & tools
lore

Josh Boyer

author
#0 lore raw

PATCH 1/1 Fix perf build against newer glibc

Upstream glibc commit 295e904 added a definition for __attribute_const__ to cdefs.h. This causes the following error when building perf:

util/include/linux/compiler.h:8:0: error: "__attribute_const__" redefined [-Werror] /usr/include/sys/cdefs.h:226:0: note: this is the location of the previous definition

Wrap __attribute_const__ in #ifndef as we do for __always_inline.

---
 tools/perf/util/include/linux/compiler.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/include/linux/compiler.h +2 -0
index 791f9dd..547628e 100644
@@ -5,7 +5,9 @@
 #define __always_inline	inline
 #endif
 #define __user
+#ifndef __attribute_const__
 #define __attribute_const__
+#endif
 
 #define __used		__attribute__((__unused__))
 
Signature · 1 line
1.7.6
#1 lore raw

[tip:perf/core] perf tools: Fix build against newer glibc

Commit-ID:  195bcbf5078d74c8e00d68f04eb8695196fb31e8
Gitweb:     http://git.kernel.org/tip/195bcbf5078d74c8e00d68f04eb8695196fb31e8
Author:     Josh Boyer <[email protected]>
AuthorDate: Thu, 18 Aug 2011 07:37:21 -0400
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Thu, 18 Aug 2011 07:24:53 -0300

perf tools: Fix build against newer glibc

Upstream glibc commit 295e904 added a definition for __attribute_const__ to cdefs.h. This causes the following error when building perf:

util/include/linux/compiler.h:8:0: error: "__attribute_const__" redefined [-Werror] /usr/include/sys/cdefs.h:226:0: note: this is the location of the previous definition

Wrap __attribute_const__ in #ifndef as we do for __always_inline.

---
 tools/perf/util/include/linux/compiler.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/perf/util/include/linux/compiler.h +2 -0
index 791f9dd..547628e 100644
@@ -5,7 +5,9 @@
 #define __always_inline	inline
 #endif
 #define __user
+#ifndef __attribute_const__
 #define __attribute_const__
+#endif
 
 #define __used		__attribute__((__unused__))