From c1aaa6e4dba6984c3072cf371b7395720ad2b686 Mon Sep 17 00:00:00 2001 From: Bruno Haible <bruno@clisp.org> Date: Sat, 3 Sep 2022 22:40:05 +0200 Subject: [PATCH] Fix a compilation error in C++ mode on FreeBSD 13.1. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * lib/signal.in.h: Don't include <pthread.h> on FreeBSD ⥠8.0. * lib/sys_select.in.h: Don't include <sys/time.h> on FreeBSD. --- ChangeLog | 6 ++++++ lib/signal.in.h | 7 ++++--- lib/sys_select.in.h | 7 ++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7316fb0f12..fcc0fa263f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2022-09-03 Bruno Haible <bruno@clisp.org> + + Fix a compilation error in C++ mode on FreeBSD 13.1. + * lib/signal.in.h: Don't include <pthread.h> on FreeBSD ⥠8.0. + * lib/sys_select.in.h: Don't include <sys/time.h> on FreeBSD. + 2022-09-03 Bruno Haible <bruno@clisp.org> stdnoreturn: Document relation to C++. diff --git a/lib/signal.in.h b/lib/signal.in.h index 640b5022f5..5d2d80c99d 100644 --- a/lib/signal.in.h +++ b/lib/signal.in.h @@ -55,13 +55,14 @@ #ifndef _@GUARD_PREFIX@_SIGNAL_H #define _@GUARD_PREFIX@_SIGNAL_H -/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android, +/* Mac OS X 10.3, FreeBSD < 8.0, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android, OS/2 kLIBC declare pthread_sigmask in <pthread.h>, not in <signal.h>. But avoid namespace pollution on glibc systems.*/ #if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ && ((defined __APPLE__ && defined __MACH__) \ - || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \ - || defined __sun || defined __ANDROID__ || defined __KLIBC__) \ + || (defined __FreeBSD__ && __FreeBSD__ < 8) || defined __OpenBSD__ \ + || defined __osf__ || defined __sun || defined __ANDROID__ \ + || defined __KLIBC__) \ && ! defined __GLIBC__ # include <pthread.h> #endif diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h index 2bd0e0f79a..b424f1b803 100644 --- a/lib/sys_select.in.h +++ b/lib/sys_select.in.h @@ -82,9 +82,10 @@ of 'struct timeval', and no definition of this type. Also, Mac OS X, AIX, HP-UX, IRIX, Solaris, Interix declare select() in <sys/time.h>. - But avoid namespace pollution on glibc systems and "unknown type - name" problems on Cygwin. */ -# if !(defined __GLIBC__ || defined __CYGWIN__) + But avoid namespace pollution on glibc systems, a circular include + <sys/select.h> -> <sys/time.h> -> <sys/select.h> on FreeBSD 13.1, and + "unknown type name" problems on Cygwin. */ +# if !(defined __GLIBC__ || defined __FreeBSD__ || defined __CYGWIN__) # include <sys/time.h> # endif -- 2.39.5