bakkeby / st-flexipatch

An st build with preprocessor directives to decide which patches to include during build time
MIT License
347 stars 107 forks source link

error: zero or negative size array ‘features’ #93

Closed bbergeron0 closed 1 year ago

bbergeron0 commented 1 year ago

On version e6a2fb489c192e2cd9439691014f48779d4966ad, with LIGATURES_PATCH 1:

st build options:
CFLAGS  = -I/usr/X11R6/include  -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include  -DVERSION="0.9" -D_XOPEN_SOURCE=600  -O1
LDFLAGS = -L/usr/X11R6/lib -lm -lrt -lX11 -lutil -lXft -lXrender  -lfontconfig -lfreetype   -lfreetype   -lharfbuzz  
CC      = c99
c99 -I/usr/X11R6/include  `pkg-config --cflags fontconfig`  `pkg-config --cflags freetype2`  `pkg-config --cflags harfbuzz` -DVERSION=\"0.9\" -D_XOPEN_SOURCE=600  -O1 -c hb.c
hb.c:30:27: warning: ISO C forbids empty initializer braces [-Wpedantic]
   30 | hb_feature_t features[] = { };
      |                           ^
hb.c:30:14: error: zero or negative size array ‘features’
   30 | hb_feature_t features[] = { };
      |              ^~~~~~~~
make: *** [Makefile:25: hb.o] Error 1

Setting CC to gcc fixes the issue, but adding -Wpedantic to CFLAGS will cause the same error.

bakkeby commented 1 year ago

I suppose it just wants a 0 initialiser?

diff --git a/hb.c b/hb.c
index dbd65c7..db845e7 100644
--- a/hb.c
+++ b/hb.c
@@ -27,7 +27,7 @@ static HbFontMatch *hbfontcache = NULL;
  * e. g.
  * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g')
  */
-hb_feature_t features[] = { };
+hb_feature_t features[] = { 0 };

 void
 hbunloadfonts()
bbergeron0 commented 1 year ago

Nice, that does it. Have a nice day.

gabrieldlima commented 1 year ago

I suppose it just wants a 0 initialiser?

diff --git a/hb.c b/hb.c
index dbd65c7..db845e7 100644
--- a/hb.c
+++ b/hb.c
@@ -27,7 +27,7 @@ static HbFontMatch *hbfontcache = NULL;
  * e. g.
  * FEATURE('c', 'a', 'l', 't'), FEATURE('d', 'l', 'i', 'g')
  */
-hb_feature_t features[] = { };
+hb_feature_t features[] = { 0 };

 void
 hbunloadfonts()

It's works, thank you very much!!