Skip to content

gunicollate/cygwin: Don't use __STDC_ISO_10646__ for wchar_t related checks

The code in gunicollate uses __STDC_ISO_10646__ to check that wchar.h is avilable, that it includes the wide character related functions and that sizeof(wchar_t) == 4.

cygwin defines __STDC_ISO_10646__ and has sizeof(wchar_t) == 2 and the C standard text isn't that clear on whether wchar_t should always be 4 bytes in this case, so we better not use if for assuming the size here.

Instead of relying on __STDC_ISO_10646__ add HAVE_WCHAR_H and SIZEOF_WCHAR_T macros. With HAVE_WCHAR_H defined we assume wchar_t exists and wchar.h exists. With SIZEOF_WCHAR_T we guard the parts where the size of wchar_t is assumed to be 4 (currently all of them).

Note that this doesn't make the collate tests pass under cygwin, they fail before and after this patch for me.

See !755 (closed) for related discussions.

Edited by Christoph Reiter

Merge request reports