libobjc2 icon indicating copy to clipboard operation
libobjc2 copied to clipboard

Support defining C99 bool as the BOOL type

Open dblsaiko opened this issue 1 year ago • 1 comments

Whether to use C99 bool can be set at build time using -DOBJC_BOOL_IS_BOOL_MODE=auto/always/never.

Default is to use C99 bool if __OBJC_BOOL_IS_BOOL is defined and set to 1, which is currently the case for Clang on newer Apple platforms. This matches the behavior of Apple's libobjc (especially when combined with STRICT_APPLE_COMPATIBILITY).

(See https://www.jviotti.com/2024/01/05/is-objective-c-bool-a-boolean-type-it-depends.html for more information about the __OBJC_BOOL_IS_BOOL definition.)


Note turning this on with GNUstep currently breaks Gorm files written with a different BOOL type just like https://github.com/gnustep/libs-gui/issues/318. Potentially needs this https://github.com/gnustep/libs-gui/issues/318#issuecomment-2476233276 to be usable.

dblsaiko avatar Dec 18 '24 14:12 dblsaiko

I think this should actually check that __OBJC_BOOL_IS_BOOL is 1 and not just defined. Oops. Hopefully the Windows tests pass now.

dblsaiko avatar May 02 '25 20:05 dblsaiko