#include "pal_collation.h"
+c_static_assert_msg(UCOL_EQUAL == 0, "managed side requires 0 for equal strings");
+c_static_assert_msg(UCOL_LESS < 0, "managed side requires less than zero for a < b");
+c_static_assert_msg(UCOL_GREATER > 0, "managed side requires greater than zero for a > b");
+c_static_assert_msg(USEARCH_DONE == -1, "managed side requires -1 for not found");
+
const int32_t CompareOptionsIgnoreCase = 0x1;
const int32_t CompareOptionsIgnoreNonSpace = 0x2;
const int32_t CompareOptionsIgnoreSymbols = 0x4;
int32_t GlobalizationNative_CompareString(
SortHandle* pSortHandle, const UChar* lpStr1, int32_t cwStr1Length, const UChar* lpStr2, int32_t cwStr2Length, int32_t options)
{
- static_assert(UCOL_EQUAL == 0, "managed side requires 0 for equal strings");
- static_assert(UCOL_LESS < 0, "managed side requires less than zero for a < b");
- static_assert(UCOL_GREATER > 0, "managed side requires greater than zero for a > b");
-
UCollationResult result = UCOL_EQUAL;
UErrorCode err = U_ZERO_ERROR;
const UCollator* pColl = GetCollatorFromSortHandle(pSortHandle, options, &err);
int32_t options,
int32_t* pMatchedLength)
{
- static_assert(USEARCH_DONE == -1, "managed side requires -1 for not found");
-
int32_t result = USEARCH_DONE;
UErrorCode err = U_ZERO_ERROR;
const UCollator* pColl = GetCollatorFromSortHandle(pSortHandle, options, &err);
int32_t cwSourceLength,
int32_t options)
{
- static_assert(USEARCH_DONE == -1, "managed side requires -1 for not found");
-
int32_t result = USEARCH_DONE;
UErrorCode err = U_ZERO_ERROR;
const UCollator* pColl = GetCollatorFromSortHandle(pSortHandle, options, &err);
#endif
#ifdef static_assert
-#define c_static_assert(e) static_assert((e),"")
+#define c_static_assert_msg(e, msg) static_assert((e), msg)
#elif __has_extension(c_static_assert)
-#define c_static_assert(e) _Static_assert((e), "")
+#define c_static_assert_msg(e, msg) _Static_assert((e), msg)
#else
-#define c_static_assert(e) typedef char __c_static_assert__[(e)?1:-1]
+#define c_static_assert_msg(e, msg) typedef char __c_static_assert__[(e)?1:-1]
#endif
#define DLLEXPORT __attribute__ ((__visibility__ ("default")))
bool FindICULibs(const char* versionPrefix, char* symbolName, char* symbolVersion)
{
#ifndef OSX_ICU_LIBRARY_PATH
- static_assert(false, "The ICU Library path is not defined");
+ c_static_assert_msg(false, "The ICU Library path is not defined");
#endif // OSX_ICU_LIBRARY_PATH
// Usually OSX_ICU_LIBRARY_PATH is "/usr/lib/libicucore.dylib"
char libicuucName[64];
char libicui18nName[64];
- static_assert(sizeof("libicuuc.so") + MaxICUVersionStringLength <= sizeof(libicuucName), "The libicuucName is too small");
+ c_static_assert_msg(sizeof("libicuuc.so") + MaxICUVersionStringLength <= sizeof(libicuucName), "The libicuucName is too small");
GetVersionedLibFileName("libicuuc.so", majorVer, minorVer, subVer, versionPrefix, libicuucName);
- static_assert(sizeof("libicui18n.so") + MaxICUVersionStringLength <= sizeof(libicui18nName), "The libicui18nName is too small");
+ c_static_assert_msg(sizeof("libicui18n.so") + MaxICUVersionStringLength <= sizeof(libicui18nName), "The libicui18nName is too small");
GetVersionedLibFileName("libicui18n.so", majorVer, minorVer, subVer, versionPrefix, libicui18nName);
libicuuc = dlopen(libicuucName, RTLD_LAZY);
// Get pointers to all the ICU functions that are needed
#define PER_FUNCTION_BLOCK(fn, lib) \
- static_assert((sizeof(#fn) + MaxICUVersionStringLength + 1) <= sizeof(symbolName), "The symbolName is too small for symbol " #fn); \
+ c_static_assert_msg((sizeof(#fn) + MaxICUVersionStringLength + 1) <= sizeof(symbolName), "The symbolName is too small for symbol " #fn); \
sprintf(symbolName, #fn "%s", symbolVersion); \
fn##_ptr = (__typeof(fn)*)dlsym(lib, symbolName); \
if (fn##_ptr == NULL) { fprintf(stderr, "Cannot get symbol %s from " #lib "\nError: %s\n", symbolName, dlerror()); abort(); }