public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Maciej W. Rozycki <macro@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r11-5211] libada: Check for the presence of _SC_NPROCESSORS_ONLN
Date: Fri, 20 Nov 2020 21:15:03 +0000 (GMT)	[thread overview]
Message-ID: <20201120211503.E2D2E3851C21@sourceware.org> (raw)

https://gcc.gnu.org/g:9e071b6e5ed5a07a4ce621382904c084431f9d47

commit r11-5211-g9e071b6e5ed5a07a4ce621382904c084431f9d47
Author: Maciej W. Rozycki <macro@linux-mips.org>
Date:   Fri Nov 20 21:11:22 2020 +0000

    libada: Check for the presence of _SC_NPROCESSORS_ONLN
    
    Check for the presence of _SC_NPROCESSORS_ONLN rather than using a list
    of OS-specific macros to decide whether to use `sysconf' like elsewhere
    across GCC sources, fixing a compilation error:
    
    adaint.c: In function '__gnat_number_of_cpus':
    adaint.c:2398:26: error: '_SC_NPROCESSORS_ONLN' undeclared (first use in this function)
     2398 |   cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
          |                          ^~~~~~~~~~~~~~~~~~~~
    adaint.c:2398:26: note: each undeclared identifier is reported only once for each function it appears in
    
    at least with with VAX/NetBSD 1.6.2.
    
            gcc/ada/
            * adaint.c (__gnat_number_of_cpus): Check for the presence of
            _SC_NPROCESSORS_ONLN rather than a list of OS-specific macros
            to decide whether to use `sysconf'.

Diff:
---
 gcc/ada/adaint.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/ada/adaint.c b/gcc/ada/adaint.c
index f5432626ee6..554123c905b 100644
--- a/gcc/ada/adaint.c
+++ b/gcc/ada/adaint.c
@@ -2483,9 +2483,7 @@ __gnat_number_of_cpus (void)
 {
   int cores = 1;
 
-#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);
 
 #elif defined (__QNX__)


                 reply	other threads:[~2020-11-20 21:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201120211503.E2D2E3851C21@sourceware.org \
    --to=macro@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).