]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libgomp: Don't include limits.h instead of hidden visibility block
authorJakub Jelinek <jakub@redhat.com>
Tue, 13 Jul 2021 07:50:49 +0000 (09:50 +0200)
committerJakub Jelinek <jakub@redhat.com>
Tue, 10 May 2022 08:14:25 +0000 (10:14 +0200)
sem.h is included in between # pragma GCC visibility push(hidden)
and # pragma GCC visibility pop and includes limits.h there, which
since the introduction of sysconf declaration in recent glibcs
in there causes trouble.  libgomp assumes it is compiled by gcc,
so we don't really need to include limits.h there and can use
-__INT_MAX__ - 1 instead (which clang and icc support too for years).

2021-07-13  Jakub Jelinek  <jakub@redhat.com>
    Florian Weimer  <fweimer@redhat.com>

* config/linux/sem.h: Don't include limits.h.
(SEM_WAIT): Define to -__INT_MAX__ - 1 instead of INT_MIN.
* config/linux/affinity.c: Include limits.h.

(cherry picked from commit 42f10ba5b57250506d69a0391ea7771c843ea286)

libgomp/config/linux/affinity.c
libgomp/config/linux/sem.h

index 0d6a7958b186fab9e3487ab0f988ca91cd847239..9d4c483add1e0961a8e2868953096af1afc2b09f 100644 (file)
@@ -35,6 +35,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <limits.h>
 
 #ifdef HAVE_PTHREAD_AFFINITY_NP
 
index 2e26a917a92d7ec6fc1aae499035df14aadf7d63..e0befd5e2961a40c2092ea11724a2afaa9f2921b 100644 (file)
 #ifndef GOMP_SEM_H
 #define GOMP_SEM_H 1
 
-#include <limits.h> /* For INT_MIN */
-
 typedef int gomp_sem_t;
-#define SEM_WAIT INT_MIN
+#define SEM_WAIT (-__INT_MAX__ - 1)
 #define SEM_INC 1
 
 extern void gomp_sem_wait_slow (gomp_sem_t *, int);