sys/_bitset.h: Fix fall-out from commit 5e04571cf3

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 5e04571cf3.

Reported by:    arrowd
MFC after:      1 month
This commit is contained in:
Stefan Eßer 2021-12-08 08:47:42 +01:00
parent 59f4abfaac
commit 49c2c62889

View File

@ -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_ */