Message ID | alpine.LFD.2.21.2011151545390.4064799@eddie.linux-mips.org |
---|---|
State | Superseded |
Headers | show |
Series | Fixes for old version NetBSD targets | expand |
> gcc/ada/ > * adaint.c (__gnat_number_of_cpus): Check for the presence of > _SC_NPROCESSORS_ONLN before using it. > --- > NB we could probably replace the list of OS #ifdefs with just a check for > _SC_NPROCESSORS_ONLN, making use of it automagically with any new OS that > supports it, as from the length of the list has grown up to I gather the > `sysconf' API for this variable has become a semi-established standard now > even though not actually listed by the relevant standards. Indeed, so a better patch would be to use #if defined (_SC_NPROCESSORS_ONLN) instead as you noted, so let's do that. Arno
Index: gcc/gcc/ada/adaint.c =================================================================== --- gcc.orig/gcc/ada/adaint.c +++ gcc/gcc/ada/adaint.c @@ -2479,7 +2479,9 @@ __gnat_number_of_cpus (void) #if defined (__linux__) || defined (__sun__) || defined (_AIX) \ || defined (__APPLE__) || defined (__FreeBSD__) || defined (__OpenBSD__) \ || defined (__DragonFly__) || defined (__NetBSD__) +#ifdef _SC_NPROCESSORS_ONLN cores = (int) sysconf (_SC_NPROCESSORS_ONLN); +#endif #elif defined (__QNX__) cores = (int) _syspage_ptr->num_cpu;