git: 49c2c62889b0 - main - sys/_bitset.h: Fix fall-out from commit 5e04571cf3c

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Wed, 08 Dec 2021 07:53:57 UTC
The branch main has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=49c2c62889b06d781c5e1f96bce0e26fd21ceb04

commit 49c2c62889b06d781c5e1f96bce0e26fd21ceb04
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2021-12-08 07:47:42 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2021-12-08 07:52:56 +0000

    sys/_bitset.h: Fix fall-out from commit 5e04571cf3c
    
    The changes to the bitset macros allowed sched.h to be included
    into userland programs without name space pollution due to BIT_*
    and BITSET_* macros.
    
    The definition of a "struct bitset" had been overlooked. This name
    space pollution caused the build of port print/miktex to fail.
    
    This commit makes the definition of struct bitset depend on the
    same condition as the visibility of the BIT_* and BITSET_* macros,
    i.e. needs _KERNEL or _WANT_FREEBSD_BITSET to be defined before
    including sys/_bitset.h.
    
    It has been tested with "make universe" since a prior attempt to
    fix the issue broke the PowerPC64 kernel build.
    
    This commit shall be MFCed together with commit 5e04571cf3c.
    
    Reported by:    arrowd
    MFC after:      1 month
---
 sys/sys/_bitset.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sys/sys/_bitset.h b/sys/sys/_bitset.h
index 1c167daf3f09..70b9713ffada 100644
--- a/sys/sys/_bitset.h
+++ b/sys/sys/_bitset.h
@@ -52,7 +52,7 @@ struct _t {								\
 /*
  * Helper to declare a bitset without it's size being a constant.
  *
- * Sadly we cannot declare a bitset struct with '__bits[]', because it's
+ * Sadly we cannot declare a bitset struct with 'bits[]', because it's
  * the only member of the struct and the compiler complains.
  */
 #define __BITSET_DEFINE_VAR(_t)	__BITSET_DEFINE(_t, 1)
@@ -61,11 +61,12 @@ struct _t {								\
  * Define a default type that can be used while manually specifying size
  * to every call.
  */
-__BITSET_DEFINE(bitset, 1);
 
 #if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET)
+__BITSET_DEFINE(bitset, 1);
+
 #define	BITSET_DEFINE(_t, _s)	__BITSET_DEFINE(_t, _s)
 #define	BITSET_DEFINE_VAR(_t)	__BITSET_DEFINE_VAR(_t)
-#endif
+#endif /* defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) */
 
 #endif /* !_SYS__BITSET_H_ */