Skip to contentSkip to conversation

gd: fix compile error caused by -Werror=maybe-uninitialized

PATCH New [email protected] 1 participant 1 message Apr 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gd: fix compile error caused by -Werror=maybe-uninitialized

From: Changqing Li <[email protected]>

When enable DEBUG_BUILD, gd compile failed with error:

| ../../git/src/gd_tiff.c:961:64: error: 'image_type' may be used uninitialized in this function [-Werror=maybe-uninitialized]
|           (image_type == GD_PALETTE || image_type == GD_INDEXED || image_type == GD_GRAY)) {
|           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~

actually, this warning is misinformation, we can see the logic from:
https://github.com/libgd/libgd/blob/master/src/gd_tiff.c
image_type will be assigned no matter force_rgba is TRUE/FALSE.

---
 meta-oe/recipes-support/gd/gd_2.2.5.bb | 2 ++
 1 file changed, 2 insertions(+)
meta-oe/recipes-support/gd/gd_2.2.5.bb +2 -0
index 548d2c5..426af25 100644
@@ -35,6 +35,8 @@ EXTRA_OECONF += " --disable-rpath \
 
 EXTRA_OEMAKE = 'LDFLAGS="${LDFLAGS}"'
 
+DEBUG_OPTIMIZATION_append = " -Wno-error=maybe-uninitialized"
+
 do_install_append() {
     # cleanup buildpaths from gdlib.pc
     sed -i -e 's#${STAGING_DIR_HOST}##g' ${D}${libdir}/pkgconfig/gdlib.pc
Signature · 1 line
2.7.4