libs-base icon indicating copy to clipboard operation
libs-base copied to clipboard

Add common constants defined in `MacTypes.h` in the macOS SDKs?

Open ERobsham opened this issue 6 months ago • 2 comments

I work with a codebase that is regularly cross compiling for both mac and linux targets, there are a few semi-common constants defined in MacTypes.h in the macOS SDKs that end up getting used which break our linux builds anytime someone checks them in (unfortunately, we only have nightly CI job that catches these cross-compiling issues).

Excerpts from MacTypes.h:

//         noErr                   OSErr: function performed properly - no error
//         kNilOptions             OptionBits: all flags false
//         kInvalidID              KernelID: NULL is for pointers as kInvalidID is for ID's
//         kVariableLengthArray    array bounds: variable length array
...

enum {
  noErr                         = 0
};

enum {
  kNilOptions                   = 0
};

#define kInvalidID   0
enum {
  kVariableLengthArray  
#ifdef __has_extension
   #if __has_extension(enumerator_attributes)
		__attribute__((deprecated))  
	#endif
#endif
  = 1
};

enum {
  kUnknownType                  = 0x3F3F3F3F /* "????" QuickTime 3.0: default unknown ResType or OSType */
};

Would it make sense to include these definitions at the gnustep-base layer?

ERobsham avatar Aug 14 '25 16:08 ERobsham

I think this is an interesting issue, in spite of being simple.

gcasa avatar Aug 14 '25 22:08 gcasa

I don't see any particular problems adding another OSX compatibility header ... unless it breaks building on OSX somehow.

rfm avatar Oct 02 '25 10:10 rfm