FreeBSD: only define B_FALSE/B_TRUE if NEED_SOLARIS_BOOLEAN is not set

If NEED_SOLARIS_BOOLEAN is defined we define an enum boolean_t, which
defines B_TRUE/B_FALSE as well. If we have both the define and the enum
things don't build (because that translates to
'enum { 0, 1 }     boolean_t').

While here also remove an incorrect '#else'. With it in place we only
parse a section if the include guard is triggered. So we'd only use that
code if this file is included twice. This is clearly unintended, and
also means we don't get the 'boolean_t' definition. Fix this.

Reviewed-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Kristof Provost <kprovost@netgate.com>
Sponsored-By: Rubicon Communications, LLC ("Netgate")
Closes #13596
This commit is contained in:
Kristof Provost 2022-06-28 23:11:38 +02:00 committed by GitHub
parent 827322991f
commit 325096545a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,9 +78,6 @@ typedef id_t ctid_t;
typedef mode_t o_mode_t; typedef mode_t o_mode_t;
typedef uint64_t pgcnt_t; typedef uint64_t pgcnt_t;
#define B_FALSE 0
#define B_TRUE 1
typedef short index_t; typedef short index_t;
typedef off_t offset_t; typedef off_t offset_t;
#ifndef _PTRDIFF_T_DECLARED #ifndef _PTRDIFF_T_DECLARED
@ -90,13 +87,17 @@ typedef __ptrdiff_t ptrdiff_t; /* pointer difference */
typedef int64_t rlim64_t; typedef int64_t rlim64_t;
typedef int major_t; typedef int major_t;
#else
#ifdef NEED_SOLARIS_BOOLEAN #ifdef NEED_SOLARIS_BOOLEAN
#if defined(__XOPEN_OR_POSIX) #if defined(__XOPEN_OR_POSIX)
typedef enum { _B_FALSE, _B_TRUE } boolean_t; typedef enum { _B_FALSE, _B_TRUE } boolean_t;
#else #else
typedef enum { B_FALSE, B_TRUE } boolean_t; typedef enum { B_FALSE, B_TRUE } boolean_t;
#endif /* defined(__XOPEN_OR_POSIX) */ #endif /* defined(__XOPEN_OR_POSIX) */
#else
#define B_FALSE 0
#define B_TRUE 1
#endif #endif
typedef u_longlong_t u_offset_t; typedef u_longlong_t u_offset_t;