[RTEMS Project] #4667: include/sys/_bitset.h defines struct bitset, pollutes namespace

RTEMS trac trac at rtems.org
Wed Jun 22 04:10:04 UTC 2022


#4667: include/sys/_bitset.h defines struct bitset, pollutes namespace
------------------------------+--------------------
  Reporter:  Alexandre Oliva  |      Owner:  (none)
      Type:  defect           |     Status:  new
  Priority:  normal           |  Milestone:  6.1
 Component:  arch/aarch64     |    Version:  6
  Severity:  normal           |   Keywords:
Blocked By:                   |   Blocking:
------------------------------+--------------------
 sys/_bitset.h gets indirectly (*) included by sys/types.h, and should thus
 define only names that C and C++ standards reserve for the implementation.
 However, the line:

   BITSET_DEFINE(bitset, 1);

 expands to a definition of struct bitset in the global namespace.

 Some of GCC's libstdc++ tests were failing on aarch64-rtems6.0 because of
 the naming ambiguity that arises.
 https://gcc.gnu.org/pipermail/gcc-patches/2022-June/596918.html

 It would be best if user programs didn't have to resort to such trickery.
 In C++, it's not so hard; in C, it can be trickier.

 I have not checked whether this struct bitset is actually used for any
 purpose on aarch64-rtems, or whether it's present on other ports.  Maybe
 it could just be removed or renamed?  Maybe upstream (FreeBSD?) would
 consider dropping it?

 (*) sys/types.h includes sys/_pthreadtypes.h includes sys/cpuset.h
 includes sys/_cpuset.h includes sys/_bitset.h

--
Ticket URL: <http://devel.rtems.org/ticket/4667>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list