aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/adaint.c
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-09-01 15:55:43 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-09-01 15:55:43 +0200
commit9f55bc6268042e7bb53627f366fa0e2d0e626ff5 (patch)
tree894bb96665c4da61e1c1a8cc7d06587a70198889 /gcc/ada/adaint.c
parentd7386a7a07949458aad3cfe7fdeb4a6b9024b11c (diff)
downloadgcc-9f55bc6268042e7bb53627f366fa0e2d0e626ff5.zip
gcc-9f55bc6268042e7bb53627f366fa0e2d0e626ff5.tar.gz
gcc-9f55bc6268042e7bb53627f366fa0e2d0e626ff5.tar.bz2
[multiple changes]
2011-09-01 Robert Dewar <dewar@adacore.com> * sem_ch3.adb, s-taprop-linux.adb, gnatls.adb: Minor reformatting. 2011-09-01 Jose Ruiz <ruiz@adacore.com> * adaint.h (__gnat_cpu_free): Fix the name of this profile. * adaint.c (__gnat_cpu_alloc, __gnat_cpu_alloc_size, __gnat_cpu_free, __gnat_cpu_zero, __gnat_cpu_set): Create version of these subprograms specific for systems where their glibc version does not define the routines to handle dynamically allocated CPU sets. 2011-09-01 Vincent Celier <celier@adacore.com> * prj-proc.adb, prj.ads, prj-nmsc.adb, prj-util.adb, prj-util.ads, prj-env.adb: Implement inheritance of naming exceptions in extending projects. From-SVN: r178418
Diffstat (limited to 'gcc/ada/adaint.c')
-rw-r--r--gcc/ada/adaint.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index 605cdaf..e470369 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -3790,6 +3790,14 @@ void *__gnat_lwp_self (void)
#include <sched.h>
+/* glibc versions earlier than 2.7 do not define the routines to handle
+ dynamically allocated CPU sets. For these targets, we use the static
+ versions. */
+
+#ifdef CPU_ALLOC
+
+/* Dynamic cpu sets */
+
cpu_set_t *__gnat_cpu_alloc (size_t count)
{
return CPU_ALLOC (count);
@@ -3816,6 +3824,37 @@ void __gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)
CPU by a 0, so we need to adjust. */
CPU_SET_S (cpu - 1, count, set);
}
+
+#else
+
+/* Static cpu sets */
+
+cpu_set_t *__gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)
+{
+ return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));
+}
+
+size_t __gnat_cpu_alloc_size (size_t count ATTRIBUTE_UNUSED)
+{
+ return sizeof (cpu_set_t);
+}
+
+void __gnat_cpu_free (cpu_set_t *set)
+{
+ free (set);
+}
+
+void __gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
+{
+ CPU_ZERO (set);
+}
+
+void __gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)
+{
+ /* Ada handles CPU numbers starting from 1, while C identifies the first
+ CPU by a 0, so we need to adjust. */
+ CPU_SET (cpu - 1, set);
+}
#endif
#ifdef __cplusplus