Merge pull request #499 from gnustep/const_gcc_fix

Make old code-path for constant with enum available again for older GCC versions
This commit is contained in:
Riccardo 2025-04-10 00:23:01 +02:00 committed by GitHub
commit 9f8c181ab5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -292,7 +292,13 @@ typedef NS_ENUM(NSInteger, NSComparisonResult)
NSOrderedAscending = (NSInteger)-1, NSOrderedSame, NSOrderedDescending
};
// check for older versions of GCC and try to ignore clang pretending to know GNUC dialects
// in order to work around error "initializer element is not constant" in older GCC versions
#if defined(__GNUC__) && !defined(__clang__) && GCC_VERSION < 80000
#define NSNotFound NSIntegerMax
#else
static const NSInteger NSNotFound = NSIntegerMax;
#endif
DEFINE_BLOCK_TYPE(NSComparator, NSComparisonResult, id, id);