linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5
@ 2011-02-25 21:05 Frederic Weisbecker
  2011-02-25 21:05 ` [PATCH 2/2] perf: Fix missing strndup declaration Frederic Weisbecker
  2011-02-26  7:02 ` [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Ingo Molnar
  0 siblings, 2 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2011-02-25 21:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Frederic Weisbecker, Ingo Molnar, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi, Arnaldo Carvalho de Melo

PyVarObject_HEAD_INIT is undefined in python 2.5, resulting
in a build crash:

	util/python.c:81: attention : déclaration implicite de la fonction « «PyVarObject_HEAD_INIT» »
	util/python.c:82: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:117: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:146: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:177: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:290: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:359: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:532: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:761: erreur: request for member «tp_name» in something not a structure or union
	error: command 'gcc' failed with exit status 1
	make: *** [python/perf.so] Erreur 1

We can fix that by defining PyVarObject_HEAD_INIT as a wrapper on
PyObject_HEAD_INIT, thanks to a trick found on biopython:
https://github.com/biopython/biopython/commit/d4eaf57946c7b4c32eca8d18821edf32f83e300d

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/python.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 5317ef2..7f8edce 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -8,6 +8,12 @@
 #include "cpumap.h"
 #include "thread_map.h"
 
+/* Define PyVarObject_HEAD_INIT for python 2.5 */
+#ifndef PyVarObject_HEAD_INIT
+#define PyVarObject_HEAD_INIT(type, size) \
+	PyObject_HEAD_INIT(type) size,
+#endif
+
 struct throttle_event {
 	struct perf_event_header header;
 	u64			 time;
-- 
1.7.3.2


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

* [PATCH 2/2] perf: Fix missing strndup declaration
  2011-02-25 21:05 [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Frederic Weisbecker
@ 2011-02-25 21:05 ` Frederic Weisbecker
  2011-02-26  7:02 ` [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Ingo Molnar
  1 sibling, 0 replies; 6+ messages in thread
From: Frederic Weisbecker @ 2011-02-25 21:05 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Frederic Weisbecker, Ingo Molnar, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi, Arnaldo Carvalho de Melo

<ctype.h> is included first without _GNU_SOURCE, so it ends up
including <string.h> without declaring strndup(). And further
<string.h> declarations, even with _GNU_SOURCE defined, are
of course without effect.

Therefore:

	util/strfilter.c: Dans la fonction «strfilter_node__new» :
	util/strfilter.c:134: attention : déclaration implicite de la fonction « «strndup» »
	util/strfilter.c:134: attention : incompatible implicit declaration of built-in function «strndup»
	make: *** [util/strfilter.o] Erreur 1

Just don't include ctype.h as it doesn't appear to be necessary
anyway.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/strfilter.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/tools/perf/util/strfilter.c b/tools/perf/util/strfilter.c
index 4064b7d..834c8eb 100644
--- a/tools/perf/util/strfilter.c
+++ b/tools/perf/util/strfilter.c
@@ -1,4 +1,3 @@
-#include <ctype.h>
 #include "util.h"
 #include "string.h"
 #include "strfilter.h"
-- 
1.7.3.2


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

* Re: [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5
  2011-02-25 21:05 [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Frederic Weisbecker
  2011-02-25 21:05 ` [PATCH 2/2] perf: Fix missing strndup declaration Frederic Weisbecker
@ 2011-02-26  7:02 ` Ingo Molnar
  2011-02-26 15:11   ` [PATCH v2] " Frederic Weisbecker
  1 sibling, 1 reply; 6+ messages in thread
From: Ingo Molnar @ 2011-02-26  7:02 UTC (permalink / raw)
  To: Frederic Weisbecker
  Cc: Arnaldo Carvalho de Melo, LKML, Peter Zijlstra, Stephane Eranian,
	Tom Zanussi


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> +++ b/tools/perf/util/python.c
> @@ -8,6 +8,12 @@
>  #include "cpumap.h"
>  #include "thread_map.h"
>  
> +/* Define PyVarObject_HEAD_INIT for python 2.5 */
> +#ifndef PyVarObject_HEAD_INIT
> +#define PyVarObject_HEAD_INIT(type, size) \
> +	PyObject_HEAD_INIT(type) size,
> +#endif

Just a code readability nit - there's really no reason not to write this as:

 #ifndef PyVarObject_HEAD_INIT
 # define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
 #endif

Thanks,

	Ingo

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

* [PATCH v2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5
  2011-02-26  7:02 ` [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Ingo Molnar
@ 2011-02-26 15:11   ` Frederic Weisbecker
  2011-03-04  0:38     ` [GIT PULL] perf updates Frederic Weisbecker
  0 siblings, 1 reply; 6+ messages in thread
From: Frederic Weisbecker @ 2011-02-26 15:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: LKML, Frederic Weisbecker, Ingo Molnar, Peter Zijlstra,
	Stephane Eranian, Tom Zanussi, Arnaldo Carvalho de Melo

PyVarObject_HEAD_INIT is undefined in python 2.5, resulting
in a build crash:

	util/python.c:81: attention : déclaration implicite de la fonction « «PyVarObject_HEAD_INIT» »
	util/python.c:82: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:117: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:146: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:177: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:290: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:359: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:532: erreur: request for member «tp_name» in something not a structure or union
	util/python.c:761: erreur: request for member «tp_name» in something not a structure or union
	error: command 'gcc' failed with exit status 1
	make: *** [python/perf.so] Erreur 1

We can fix that by defining PyVarObject_HEAD_INIT as a wrapper on
PyObject_HEAD_INIT, thanks to a trick found on biopython:
https://github.com/biopython/biopython/commit/d4eaf57946c7b4c32eca8d18821edf32f83e300d

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/python.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 5317ef2..a9f2d7e 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -8,6 +8,11 @@
 #include "cpumap.h"
 #include "thread_map.h"
 
+/* Define PyVarObject_HEAD_INIT for python 2.5 */
+#ifndef PyVarObject_HEAD_INIT
+# define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size,
+#endif
+
 struct throttle_event {
 	struct perf_event_header header;
 	u64			 time;
-- 
1.7.3.2


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

* [GIT PULL] perf updates
  2011-02-26 15:11   ` [PATCH v2] " Frederic Weisbecker
@ 2011-03-04  0:38     ` Frederic Weisbecker
  2011-03-04  7:10       ` Ingo Molnar
  0 siblings, 1 reply; 6+ messages in thread
From: Frederic Weisbecker @ 2011-03-04  0:38 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: LKML, Frederic Weisbecker, Peter Zijlstra,
	Arnaldo Carvalho de Melo

Ingo,

Please pull the perf/core branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
	perf/core

Thanks,
	Frederic
---

Frederic Weisbecker (2):
      perf: Fix missing strndup declaration
      perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5


 tools/perf/util/python.c    |    5 +++++
 tools/perf/util/strfilter.c |    1 -
 2 files changed, 5 insertions(+), 1 deletions(-)

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

* Re: [GIT PULL] perf updates
  2011-03-04  0:38     ` [GIT PULL] perf updates Frederic Weisbecker
@ 2011-03-04  7:10       ` Ingo Molnar
  0 siblings, 0 replies; 6+ messages in thread
From: Ingo Molnar @ 2011-03-04  7:10 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: LKML, Peter Zijlstra, Arnaldo Carvalho de Melo


* Frederic Weisbecker <fweisbec@gmail.com> wrote:

> Ingo,
> 
> Please pull the perf/core branch that can be found at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing.git
> 	perf/core
> 
> Thanks,
> 	Frederic
> ---
> 
> Frederic Weisbecker (2):
>       perf: Fix missing strndup declaration
>       perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5
> 
> 
>  tools/perf/util/python.c    |    5 +++++
>  tools/perf/util/strfilter.c |    1 -
>  2 files changed, 5 insertions(+), 1 deletions(-)

Pulled, thanks a lot Frederic!

	Ingo

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

end of thread, other threads:[~2011-03-04  7:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25 21:05 [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Frederic Weisbecker
2011-02-25 21:05 ` [PATCH 2/2] perf: Fix missing strndup declaration Frederic Weisbecker
2011-02-26  7:02 ` [PATCH 1/2] perf: Fix undefined PyVarObject_HEAD_INIT in python 2.5 Ingo Molnar
2011-02-26 15:11   ` [PATCH v2] " Frederic Weisbecker
2011-03-04  0:38     ` [GIT PULL] perf updates Frederic Weisbecker
2011-03-04  7:10       ` Ingo Molnar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).