Compiling with cygwin (gcc 10.2.0) on win10 fails because of "array
subscript has type 'char'" warnings. If isspace is called with a
negative char value it would invoke undefined behavior.
gcc -O3 -Wall -Werror -fpic -std=gnu99 -shared src/fzf.c -o build/libfzf.dll
In file included from src/fzf.c:4:
src/fzf.c: In function 'leading_whitespaces':
src/fzf.c:83:27: error: array subscript has type 'char' [-Werror=char-subscripts]
83 | if (!isspace(str->data[i])) {
| ~~~~~~~~~^~~
src/fzf.c: In function 'trailing_whitespaces':
src/fzf.c:94:27: error: array subscript has type 'char' [-Werror=char-subscripts]
94 | if (!isspace(str->data[i])) {
| ~~~~~~~~~^~~
src/fzf.c: In function '__prefix_match':
src/fzf.c:852:29: error: array subscript has type 'char' [-Werror=char-subscripts]
852 | if (!isspace(pattern->data[0])) {
| ~~~~~~~~~~~~~^~~
src/fzf.c: In function '__suffix_match':
src/fzf.c:894:49: error: array subscript has type 'char' [-Werror=char-subscripts]
894 | if (len_pattern == 0 || !isspace(pattern->data[len_pattern - 1])) {
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:19: build/libfzf.dll] Error 1
Using the same version of gcc from msys2 mingw64 doesn't have this issue.
Compiling with cygwin (gcc 10.2.0) on win10 fails because of "array subscript has type 'char'" warnings. If isspace is called with a negative char value it would invoke undefined behavior.
Using the same version of gcc from msys2 mingw64 doesn't have this issue.