From e83bfe734030020ed0d811ae31b3bb84241a2431 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 9 May 2020 00:29:37 +0200 Subject: [PATCH] limits-h: Define LONG_BIT correctly on Haiku/x86_64. * lib/limits.in.h: Define and test _GL_ALREADY_INCLUDING_LIMITS_H. --- ChangeLog | 5 +++++ lib/limits.in.h | 23 ++++++++++++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12955aea19..0a9cca9738 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-05-08 Bruno Haible + + limits-h: Define LONG_BIT correctly on Haiku/x86_64. + * lib/limits.in.h: Define and test _GL_ALREADY_INCLUDING_LIMITS_H. + 2020-05-08 Bruno Haible list: Update documentation. diff --git a/lib/limits.in.h b/lib/limits.in.h index d8d191688a..9103d2d15c 100644 --- a/lib/limits.in.h +++ b/lib/limits.in.h @@ -15,16 +15,32 @@ You should have received a copy of the GNU Lesser General Public License along with this program; if not, see . */ -#ifndef _@GUARD_PREFIX@_LIMITS_H - #if __GNUC__ >= 3 @PRAGMA_SYSTEM_HEADER@ #endif @PRAGMA_COLUMNS@ -/* The include_next requires a split double-inclusion guard. */ +#if defined _GL_ALREADY_INCLUDING_LIMITS_H +/* Special invocation convention: + On Haiku/x86_64, we have a sequence of nested includes + -> -> . + In this situation, LONG_MAX and INT_MAX are not yet defined, + therefore we should not attempt to define LONG_BIT. */ + #@INCLUDE_NEXT@ @NEXT_LIMITS_H@ +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_LIMITS_H + +# define _GL_ALREADY_INCLUDING_LIMITS_H + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_LIMITS_H@ + +# undef _GL_ALREADY_INCLUDING_LIMITS_H + #ifndef _@GUARD_PREFIX@_LIMITS_H #define _@GUARD_PREFIX@_LIMITS_H @@ -102,3 +118,4 @@ #endif /* _@GUARD_PREFIX@_LIMITS_H */ #endif /* _@GUARD_PREFIX@_LIMITS_H */ +#endif -- 2.39.5