public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] sys/_bitset.h: Fix fall-out from commit 5e04571cf3c
@ 2022-06-24 5:43 Sebastian Huber
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Huber @ 2022-06-24 5:43 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=6af6e295529bb2ba9941e7f3d7938799a668e5f6
commit 6af6e295529bb2ba9941e7f3d7938799a668e5f6
Author: Stefan Eßer <se@FreeBSD.org>
Date: Wed Dec 8 08:47:42 2021 +0100
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
Diff:
---
newlib/libc/sys/rtems/include/sys/_bitset.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/rtems/include/sys/_bitset.h
index 1c167daf3..70b9713ff 100644
--- a/newlib/libc/sys/rtems/include/sys/_bitset.h
+++ b/newlib/libc/sys/rtems/include/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_ */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [newlib-cygwin] sys/_bitset.h: Fix fall-out from commit 5e04571cf3c
@ 2022-06-24 5:43 Sebastian Huber
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Huber @ 2022-06-24 5:43 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c78c56c06dad8a9fe51382366266a5700614f2e9
commit c78c56c06dad8a9fe51382366266a5700614f2e9
Author: Stefan Eßer <se@FreeBSD.org>
Date: Tue Dec 7 20:29:26 2021 +0100
sys/_bitset.h: Fix fall-out from commit 5e04571cf3c
There is a reference to malloc() in #define __BITSET_ALLOC. Even
though this macro is only defined but not used, it causes the lang/gcc
ports to fail. The gcc ports "poison" a number of functions including
malloc() and prevent their use (including in macro definitions).
This commit moved the declaration of __BITSET_ALLOC into the
conditional block that depends on _KERNEL or _WANT_FREEBSD_BITSET
being defined.
There is no use of __BITSET_ALLOC in the FreeBSD sources, and userland
programs that want to use BITSEC_ALLOC will define _WANT_FREEBSD_BITSET
anyway.
This patch has been tested by building lang/gcc11 and a successful
make buildworld.
This commit shall be MFCed together with commit 5e04571cf3c.
MFC after: 1 month
Diff:
---
newlib/libc/sys/rtems/include/sys/bitset.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/newlib/libc/sys/rtems/include/sys/bitset.h b/newlib/libc/sys/rtems/include/sys/bitset.h
index 00bdc23f9..c9448a73a 100644
--- a/newlib/libc/sys/rtems/include/sys/bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/bitset.h
@@ -311,12 +311,12 @@
#define __BITSET_SIZE(_s) (__bitset_words((_s)) * sizeof(long))
+#if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET)
/*
* Dynamically allocate a bitset.
*/
#define __BITSET_ALLOC(_s, mt, mf) malloc(__BITSET_SIZE((_s)), mt, (mf))
-#if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET)
#define BIT_AND(_s, d, s) __BIT_AND(_s, d, s)
#define BIT_AND2(_s, d, s1, s2) __BIT_AND2(_s, d, s1, s2)
#define BIT_ANDNOT(_s, d, s) __BIT_ANDNOT(_s, d, s)
@@ -358,6 +358,6 @@
#define BITSET_FSET(n) __BITSET_FSET(n)
#define BITSET_SIZE(_s) __BITSET_SIZE(_s)
#define BITSET_T_INITIALIZER(x) __BITSET_T_INITIALIZER(x)
-#endif
+#endif /* defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET) */
#endif /* !_SYS_BITSET_H_ */
^ permalink raw reply [flat|nested] 3+ messages in thread
* [newlib-cygwin] sys/_bitset.h: Fix fall-out from commit 5e04571cf3c
@ 2022-06-24 5:43 Sebastian Huber
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Huber @ 2022-06-24 5:43 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=2f6651097e7c2bf6323745ff332cc8e9df0564b2
commit 2f6651097e7c2bf6323745ff332cc8e9df0564b2
Author: Konstantin Belousov <kib@FreeBSD.org>
Date: Tue Dec 7 20:15:30 2021 +0100
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 global variable "bitset" had been overlooked.
This name space pollution caused a compile failure in print/miktex.
This commit renames the bitset variable to __bitset with the same
mapping back to the bitset if _KERNEL or _WANT_FREEBSD_BITSET is
defined.
This fix has been suggested by kib. It has been tested to let the
build of the print/miktex port succeed and to not break buildworld.
This commit shall be MFCed together with commit 5e04571cf3c.
Reported by: arrowd
MFC after: 1 month
Diff:
---
newlib/libc/sys/rtems/include/sys/_bitset.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/newlib/libc/sys/rtems/include/sys/_bitset.h b/newlib/libc/sys/rtems/include/sys/_bitset.h
index 1c167daf3..8ce632333 100644
--- a/newlib/libc/sys/rtems/include/sys/_bitset.h
+++ b/newlib/libc/sys/rtems/include/sys/_bitset.h
@@ -61,11 +61,13 @@ struct _t { \
* Define a default type that can be used while manually specifying size
* to every call.
*/
-__BITSET_DEFINE(bitset, 1);
+__BITSET_DEFINE(__bitset, 1);
#if defined(_KERNEL) || defined(_WANT_FREEBSD_BITSET)
#define BITSET_DEFINE(_t, _s) __BITSET_DEFINE(_t, _s)
#define BITSET_DEFINE_VAR(_t) __BITSET_DEFINE_VAR(_t)
+
+#define bitset __bitset
#endif
#endif /* !_SYS__BITSET_H_ */
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-24 5:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-24 5:43 [newlib-cygwin] sys/_bitset.h: Fix fall-out from commit 5e04571cf3c Sebastian Huber
-- strict thread matches above, loose matches on Subject: below --
2022-06-24 5:43 Sebastian Huber
2022-06-24 5:43 Sebastian Huber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).