VirtualBox

Changeset 63491 in vbox


Ignore:
Timestamp:
Aug 15, 2016 4:41:16 PM (8 years ago)
Author:
vboxsync
Message:

iprt/types.h: On NetBSD after we include <stdbool.h> undef "bool" it
defines and provide a typedef instead. This is necessary because some
sloppy X11 code uses "bool" as a structure member name.

The end result is the same as for Darwin and Haiku clause just below,
but I think that explicit #include <stdbool.h> here (vs. checking for
its guard) is more clean, since it ensures that any code that includes
<stdbool.h> later will not cause additionall damage.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/types.h

    r63356 r63491  
    239239      */
    240240#    include <stdbool.h>
     241
     242     /*
     243      * ... but the story doesn't end here.  The C standard says that
     244      * <stdbool.h> defines preprocessor macro "bool" that expands to
     245      * "_Bool", but adds that a program may undefine/redefine it
     246      * (this is 7.16 in C99 and 7.18 in C11).  We have to play this
     247      * game here because X11 code uses "bool" as a struct member name
     248      * - so undefine "bool" and provide it as a typedef instead.  We
     249      * still keep #include <stdbool.h> so that any code that might
     250      * include it later doesn't mess things up.
     251      */
     252#    undef bool
     253     typedef _Bool bool;
    241254#   endif
    242255#  else
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette