On 4/2/19 7:31 PM, Adrian Bunk wrote:
On Tue, Apr 02, 2019 at 05:08:33PM +0800, changqing...@windriver.com wrote:
From: Changqing Li <changqing...@windriver.com>
fix below compile error with -Werror=maybe-uninitialized
| ../../cogl-1.22.2/cogl/driver/gl/gles/cogl-driver-gles.c:217:17: error:
'gltype' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
| *out_gltype = gltype;
| ~~~~~~~~~~~~^~~~~~~~
| ../../cogl-1.22.2/cogl/driver/gl/gles/cogl-driver-gles.c:213:22: error:
'glintformat' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
| *out_glintformat = glintformat;
| ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
...
Looking at the code, is this a failure that only happens with DEBUG_FLAGS?
Yes, only happen with DEBUG_FLAGS
+--- a/cogl/driver/gl/gles/cogl-driver-gles.c
++++ b/cogl/driver/gl/gles/cogl-driver-gles.c
+@@ -74,9 +74,9 @@ _cogl_driver_pixel_format_to_gl (CoglContext *context,
+ GLenum *out_gltype)
+ {
+ CoglPixelFormat required_format;
+- GLenum glintformat;
++ GLenum glintformat = 0;
+ GLenum glformat = 0;
+- GLenum gltype;
++ GLenum gltype = 0;
...
Assigning random values to variables is a bug,
they do not even seem to be valid values for these variables.
According to code logic, glformat and glintformat will assigned
simultaneously and usually with same value,
and 0 mean invalid pixel format.
[snip]
case COGL_PIXEL_FORMAT_DEPTH_24_STENCIL_8:
glintformat = GL_DEPTH_STENCIL;
glformat = GL_DEPTH_STENCIL;
gltype = GL_UNSIGNED_INT_24_8;
break;
and for gtype, there also should be no problem according to the code logic.
and the fix is just for eliminate the error when DEBUG_FLAGS is enabled.
cu
Adrian
--
BRs
Sandy(Li Changqing)
--
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core