public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] patches/gcc: Only define CPU_COUNT if not already defined
@ 2014-09-26  3:43 Bryan Hundven
  2014-10-03  7:35 ` Bryan Hundven
  0 siblings, 1 reply; 2+ messages in thread
From: Bryan Hundven @ 2014-09-26  3:43 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc, Bryan Hundven

Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
Rather then checking the version or brand of LIBC, just check if
CPU_COUNT is defined before redefining it.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
---
 .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
 .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
 .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
 .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
 .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
 .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
 6 files changed, 192 insertions(+)
 create mode 100644 patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch
 create mode 100644 patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch
 create mode 100644 patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch
 create mode 100644 patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch
 create mode 100644 patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch
 create mode 100644 patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch

diff --git a/patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..dc9817e
--- /dev/null
+++ b/patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,32 @@
+From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Thu, 25 Sep 2014 18:54:06 -0700
+Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
+
+Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
+Rather then checking the version or brand of LIBC, just check if
+CPU_COUNT is defined before redefining it.
+
+Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
+---
+ libgo/runtime/getncpu-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
+index 0122b77..4aab58f 100644
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
+-- 
+2.1.1
+
diff --git a/patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..dc9817e
--- /dev/null
+++ b/patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,32 @@
+From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Thu, 25 Sep 2014 18:54:06 -0700
+Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
+
+Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
+Rather then checking the version or brand of LIBC, just check if
+CPU_COUNT is defined before redefining it.
+
+Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
+---
+ libgo/runtime/getncpu-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
+index 0122b77..4aab58f 100644
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
+-- 
+2.1.1
+
diff --git a/patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..dc9817e
--- /dev/null
+++ b/patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,32 @@
+From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Thu, 25 Sep 2014 18:54:06 -0700
+Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
+
+Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
+Rather then checking the version or brand of LIBC, just check if
+CPU_COUNT is defined before redefining it.
+
+Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
+---
+ libgo/runtime/getncpu-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
+index 0122b77..4aab58f 100644
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
+-- 
+2.1.1
+
diff --git a/patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..dc9817e
--- /dev/null
+++ b/patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,32 @@
+From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Thu, 25 Sep 2014 18:54:06 -0700
+Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
+
+Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
+Rather then checking the version or brand of LIBC, just check if
+CPU_COUNT is defined before redefining it.
+
+Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
+---
+ libgo/runtime/getncpu-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
+index 0122b77..4aab58f 100644
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
+-- 
+2.1.1
+
diff --git a/patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..dc9817e
--- /dev/null
+++ b/patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,32 @@
+From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Thu, 25 Sep 2014 18:54:06 -0700
+Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
+
+Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
+Rather then checking the version or brand of LIBC, just check if
+CPU_COUNT is defined before redefining it.
+
+Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
+---
+ libgo/runtime/getncpu-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
+index 0122b77..4aab58f 100644
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
+-- 
+2.1.1
+
diff --git a/patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch
new file mode 100644
index 0000000..dc9817e
--- /dev/null
+++ b/patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch
@@ -0,0 +1,32 @@
+From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
+From: Bryan Hundven <bryanhundven@gmail.com>
+Date: Thu, 25 Sep 2014 18:54:06 -0700
+Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
+
+Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
+Rather then checking the version or brand of LIBC, just check if
+CPU_COUNT is defined before redefining it.
+
+Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
+---
+ libgo/runtime/getncpu-linux.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
+index 0122b77..4aab58f 100644
+--- a/libgo/runtime/getncpu-linux.c
++++ b/libgo/runtime/getncpu-linux.c
+@@ -5,8 +5,8 @@
+ #include <features.h>
+ #include <sched.h>
+ 
+-// CPU_COUNT is only provided by glibc 2.6 or higher
+-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
++// Define CPU_COUNT if it isn't already.
++#if !defined(CPU_COUNT)
+ #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
+ static int _CPU_COUNT(unsigned int *set, size_t len) {
+ 	int cnt;
+-- 
+2.1.1
+
-- 
2.1.1


--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

* Re: [PATCH] patches/gcc: Only define CPU_COUNT if not already defined
  2014-09-26  3:43 [PATCH] patches/gcc: Only define CPU_COUNT if not already defined Bryan Hundven
@ 2014-10-03  7:35 ` Bryan Hundven
  0 siblings, 0 replies; 2+ messages in thread
From: Bryan Hundven @ 2014-10-03  7:35 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

Yann, List,

> On Sep 25, 2014, at 8:43 PM, Bryan Hundven <bryanhundven@gmail.com> wrote:
> 
> Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> Rather then checking the version or brand of LIBC, just check if
> CPU_COUNT is defined before redefining it.
> 
> Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> ---
> .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
> .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
> .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
> .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
> .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
> .../010-libgo-do-not-redefine-CPU_COUNT.patch      | 32 ++++++++++++++++++++++
> 6 files changed, 192 insertions(+)
> create mode 100644 patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch
> create mode 100644 patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch
> create mode 100644 patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch
> create mode 100644 patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch
> create mode 100644 patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch
> create mode 100644 patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch
> 
> diff --git a/patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch
> new file mode 100644
> index 0000000..dc9817e
> --- /dev/null
> +++ b/patches/gcc/4.8.0/010-libgo-do-not-redefine-CPU_COUNT.patch
> @@ -0,0 +1,32 @@
> +From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
> +From: Bryan Hundven <bryanhundven@gmail.com>
> +Date: Thu, 25 Sep 2014 18:54:06 -0700
> +Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
> +
> +Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> +Rather then checking the version or brand of LIBC, just check if
> +CPU_COUNT is defined before redefining it.
> +
> +Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> +---
> + libgo/runtime/getncpu-linux.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
> +index 0122b77..4aab58f 100644
> +--- a/libgo/runtime/getncpu-linux.c
> ++++ b/libgo/runtime/getncpu-linux.c
> +@@ -5,8 +5,8 @@
> + #include <features.h>
> + #include <sched.h>
> + 
> +-// CPU_COUNT is only provided by glibc 2.6 or higher
> +-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
> ++// Define CPU_COUNT if it isn't already.
> ++#if !defined(CPU_COUNT)
> + #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
> + static int _CPU_COUNT(unsigned int *set, size_t len) {
> + 	int cnt;
> +-- 
> +2.1.1
> +
> diff --git a/patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch
> new file mode 100644
> index 0000000..dc9817e
> --- /dev/null
> +++ b/patches/gcc/4.8.1/010-libgo-do-not-redefine-CPU_COUNT.patch
> @@ -0,0 +1,32 @@
> +From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
> +From: Bryan Hundven <bryanhundven@gmail.com>
> +Date: Thu, 25 Sep 2014 18:54:06 -0700
> +Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
> +
> +Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> +Rather then checking the version or brand of LIBC, just check if
> +CPU_COUNT is defined before redefining it.
> +
> +Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> +---
> + libgo/runtime/getncpu-linux.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
> +index 0122b77..4aab58f 100644
> +--- a/libgo/runtime/getncpu-linux.c
> ++++ b/libgo/runtime/getncpu-linux.c
> +@@ -5,8 +5,8 @@
> + #include <features.h>
> + #include <sched.h>
> + 
> +-// CPU_COUNT is only provided by glibc 2.6 or higher
> +-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
> ++// Define CPU_COUNT if it isn't already.
> ++#if !defined(CPU_COUNT)
> + #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
> + static int _CPU_COUNT(unsigned int *set, size_t len) {
> + 	int cnt;
> +-- 
> +2.1.1
> +
> diff --git a/patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch
> new file mode 100644
> index 0000000..dc9817e
> --- /dev/null
> +++ b/patches/gcc/4.8.2/010-libgo-do-not-redefine-CPU_COUNT.patch
> @@ -0,0 +1,32 @@
> +From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
> +From: Bryan Hundven <bryanhundven@gmail.com>
> +Date: Thu, 25 Sep 2014 18:54:06 -0700
> +Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
> +
> +Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> +Rather then checking the version or brand of LIBC, just check if
> +CPU_COUNT is defined before redefining it.
> +
> +Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> +---
> + libgo/runtime/getncpu-linux.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
> +index 0122b77..4aab58f 100644
> +--- a/libgo/runtime/getncpu-linux.c
> ++++ b/libgo/runtime/getncpu-linux.c
> +@@ -5,8 +5,8 @@
> + #include <features.h>
> + #include <sched.h>
> + 
> +-// CPU_COUNT is only provided by glibc 2.6 or higher
> +-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
> ++// Define CPU_COUNT if it isn't already.
> ++#if !defined(CPU_COUNT)
> + #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
> + static int _CPU_COUNT(unsigned int *set, size_t len) {
> + 	int cnt;
> +-- 
> +2.1.1
> +
> diff --git a/patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch
> new file mode 100644
> index 0000000..dc9817e
> --- /dev/null
> +++ b/patches/gcc/4.8.3/010-libgo-do-not-redefine-CPU_COUNT.patch
> @@ -0,0 +1,32 @@
> +From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
> +From: Bryan Hundven <bryanhundven@gmail.com>
> +Date: Thu, 25 Sep 2014 18:54:06 -0700
> +Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
> +
> +Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> +Rather then checking the version or brand of LIBC, just check if
> +CPU_COUNT is defined before redefining it.
> +
> +Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> +---
> + libgo/runtime/getncpu-linux.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
> +index 0122b77..4aab58f 100644
> +--- a/libgo/runtime/getncpu-linux.c
> ++++ b/libgo/runtime/getncpu-linux.c
> +@@ -5,8 +5,8 @@
> + #include <features.h>
> + #include <sched.h>
> + 
> +-// CPU_COUNT is only provided by glibc 2.6 or higher
> +-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
> ++// Define CPU_COUNT if it isn't already.
> ++#if !defined(CPU_COUNT)
> + #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
> + static int _CPU_COUNT(unsigned int *set, size_t len) {
> + 	int cnt;
> +-- 
> +2.1.1
> +
> diff --git a/patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch
> new file mode 100644
> index 0000000..dc9817e
> --- /dev/null
> +++ b/patches/gcc/4.9.0/010-libgo-do-not-redefine-CPU_COUNT.patch
> @@ -0,0 +1,32 @@
> +From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
> +From: Bryan Hundven <bryanhundven@gmail.com>
> +Date: Thu, 25 Sep 2014 18:54:06 -0700
> +Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
> +
> +Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> +Rather then checking the version or brand of LIBC, just check if
> +CPU_COUNT is defined before redefining it.
> +
> +Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> +---
> + libgo/runtime/getncpu-linux.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
> +index 0122b77..4aab58f 100644
> +--- a/libgo/runtime/getncpu-linux.c
> ++++ b/libgo/runtime/getncpu-linux.c
> +@@ -5,8 +5,8 @@
> + #include <features.h>
> + #include <sched.h>
> + 
> +-// CPU_COUNT is only provided by glibc 2.6 or higher
> +-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
> ++// Define CPU_COUNT if it isn't already.
> ++#if !defined(CPU_COUNT)
> + #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
> + static int _CPU_COUNT(unsigned int *set, size_t len) {
> + 	int cnt;
> +-- 
> +2.1.1
> +
> diff --git a/patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch b/patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch
> new file mode 100644
> index 0000000..dc9817e
> --- /dev/null
> +++ b/patches/gcc/4.9.1/010-libgo-do-not-redefine-CPU_COUNT.patch
> @@ -0,0 +1,32 @@
> +From fe9d1f9b730f653039868515000a02cbb73e8941 Mon Sep 17 00:00:00 2001
> +From: Bryan Hundven <bryanhundven@gmail.com>
> +Date: Thu, 25 Sep 2014 18:54:06 -0700
> +Subject: [PATCH] libgo/runtime: Only define CPU_COUNT if not already defined
> +
> +Modern LIBCs #define CPU_COUNT and CPU_COUNT_S in sched.h.
> +Rather then checking the version or brand of LIBC, just check if
> +CPU_COUNT is defined before redefining it.
> +
> +Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
> +---
> + libgo/runtime/getncpu-linux.c | 4 ++--
> + 1 file changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/libgo/runtime/getncpu-linux.c b/libgo/runtime/getncpu-linux.c
> +index 0122b77..4aab58f 100644
> +--- a/libgo/runtime/getncpu-linux.c
> ++++ b/libgo/runtime/getncpu-linux.c
> +@@ -5,8 +5,8 @@
> + #include <features.h>
> + #include <sched.h>
> + 
> +-// CPU_COUNT is only provided by glibc 2.6 or higher
> +-#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 6)
> ++// Define CPU_COUNT if it isn't already.
> ++#if !defined(CPU_COUNT)
> + #define CPU_COUNT(set) _CPU_COUNT((unsigned int *)(set), sizeof(*(set))/sizeof(unsigned int))
> + static int _CPU_COUNT(unsigned int *set, size_t len) {
> + 	int cnt;
> +-- 
> +2.1.1
> +
> -- 
> 2.1.1
> 

This patch is now upstream, and will be in gcc-5.0:

https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=215832

https://code.google.com/p/gofrontend/issues/detail?id=38

So there is no reason to port it beyond 4.9.1 (hoping it gets back-ported to 4.9.2).

Cheers,

-Bryan


--
For unsubscribe information see http://sourceware.org/lists.html#faq

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-26  3:43 [PATCH] patches/gcc: Only define CPU_COUNT if not already defined Bryan Hundven
2014-10-03  7:35 ` Bryan Hundven

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 read-only IMAP folder(s) and NNTP newsgroup(s).