Skip to contentSkip to conversation

cogl: fix compile error with -Werror=maybe-uninitialized

PATCH Superseded [email protected] 3 participants 10 messages Apr 2, 2019 – Apr 8, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cogl: fix compile error with -Werror=maybe-uninitialized

From: Changqing Li <[email protected]>

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;
|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
---
 ...mpile-error-with-Werror-maybe-uninitializ.patch | 40 ++++++++++++++++++++++
 meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb      |  4 ++-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch
meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +40 -0
new file mode 100644
index 0000000..3c99d25
@@ -0,0 +1,40 @@
+From e05ee89fcc978fceccab3e4724a3a37f7a338499 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Tue, 2 Apr 2019 14:48:49 +0800
+Subject: [PATCH] cogl: fix compile error with -Werror=maybe-uninitialized
+
+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;
+|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
+
+Upstream-Status: Submitted [https://github.com/GNOME/cogl/pull/4/commits/be7a7b983952d3f2ce2cbaa7b89f413b92e15066]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ cogl/driver/gl/gles/cogl-driver-gles.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
+index e94449f..a59d815 100644
+--- 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;
+ 
+   required_format = format;
+ 
+-- 
+2.7.4
+
meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb +3 -1
index 5901062..5ddeb4a 100644
@@ -1,7 +1,9 @@
 require cogl-1.0.inc
 
 SRC_URI += "file://test-backface-culling.c-fix-may-be-used-uninitialize.patch \
-            file://0001-Fix-an-incorrect-preprocessor-conditional.patch"
+            file://0001-Fix-an-incorrect-preprocessor-conditional.patch \
+            file://0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch \
+           "
 SRC_URI[archive.md5sum] = "d53b708ca7c4af03d7254e46945d6b33"
 SRC_URI[archive.sha256sum] = "39a718cdb64ea45225a7e94f88dddec1869ab37a21b339ad058a9d898782c00d"
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 11 lines · On Tue, Apr 02, 2019 at 05:08:33PM +0800, [email protected] wrote:

From: Changqing Li <[email protected]>

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?

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch line 34

Quoted 12 lines

+--- 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,

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +8 -0
+                                  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.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#2 lore raw
Quoted 5 lines · Adrian Bunk
Quoted 4 lines · On Tue, Apr 02, 2019 at 05:08:33PM +0800, [email protected] wrote:

From: Changqing Li <[email protected]>

fix below compile error with -Werror=maybe-uninitialized

Quoted 8 lines
Quoted 7 lines
| ../../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

Quoted 13 lines

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch line 34

Quoted 13 lines

+--- 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,

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +8 -0
+                                  GLenum *out_gltype)
+ {
+   CoglPixelFormat required_format;
+-  GLenum glintformat;
++  GLenum glintformat = 0;
+   GLenum glformat = 0;
+-  GLenum gltype;
++  GLenum gltype = 0;
...
Quoted 2 lines

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.

Quoted 4 lines

cu
Adrian

Signature · 3 lines
BRs

Sandy(Li Changqing)
#3 lore raw
Quoted 28 lines · Changqing Li
Quoted 5 lines · Adrian Bunk
Quoted 4 lines · On Tue, Apr 02, 2019 at 05:08:33PM +0800, [email protected] wrote:

From: Changqing Li <[email protected]>

fix below compile error with -Werror=maybe-uninitialized

Quoted 8 lines
Quoted 7 lines
| ../../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

Quoted 12 lines
Quoted 12 lines

+--- 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,

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +8 -0
+                                  GLenum *out_gltype)
+ {
+   CoglPixelFormat required_format;
+-  GLenum glintformat;
++  GLenum glintformat = 0;
+   GLenum glformat = 0;
+-  GLenum gltype;
++  GLenum gltype = 0;
...
Quoted 5 lines
Quoted 2 lines

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,

But glformat has an assert later to ensure the 0 doesn't leak anywhere.

Quoted 1 line

and 0 mean invalid pixel format.

For pixel format 0 means COGL_PIXEL_FORMAT_ANY.

For glintformat I don't know what would happen if 0 is used.

Quoted 9 lines

[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.

According to the current code.

If some future change breaks the code, it would pass invalid data at runtime instead of giving a compile warning.

Quoted 1 line

and the fix is just for eliminate the error when DEBUG_FLAGS is enabled.

Looking at the code, does passing --enable-maintainer-flags=no to configure work around this gcc bug?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#4 lore raw
Quoted 48 lines · Adrian Bunk
Quoted 27 lines · Changqing Li
Quoted 5 lines · Adrian Bunk
Quoted 4 lines · On Tue, Apr 02, 2019 at 05:08:33PM +0800, [email protected] wrote:

From: Changqing Li <[email protected]>

fix below compile error with -Werror=maybe-uninitialized

Quoted 8 lines
Quoted 7 lines
| ../../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

Quoted 12 lines
Quoted 12 lines

+--- 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,

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +8 -0
+                                  GLenum *out_gltype)
+ {
+   CoglPixelFormat required_format;
+-  GLenum glintformat;
++  GLenum glintformat = 0;
+   GLenum glformat = 0;
+-  GLenum gltype;
++  GLenum gltype = 0;
...
Quoted 4 lines
Quoted 2 lines

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,

But glformat has an assert later to ensure the 0 doesn't leak anywhere.

Quoted 1 line

and 0 mean invalid pixel format.

For pixel format 0 means COGL_PIXEL_FORMAT_ANY.

For glintformat I don't know what would happen if 0 is used.

Quoted 9 lines

[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.

Quoted 8 lines

According to the current code.

If some future change breaks the code, it would pass invalid data at runtime instead of giving a compile warning.

Quoted 1 line

and the fix is just for eliminate the error when DEBUG_FLAGS is enabled.

Looking at the code, does passing --enable-maintainer-flags=no to configure work around this gcc bug

Hi, Adrian

Thanks for your detailed comments. And the future change wrong is reasonable, but according to

current code,  seems it can assert from g_assert_not_reached or g_assert when glformat/glintformat is not assigned new value.

[snip]

    case xxx

           glformat=xxx

           glintformat=xxx

    case COGL_PIXEL_FORMAT_ANY:
    case COGL_PIXEL_FORMAT_YUV:
      g_assert_not_reached ();
      break;
    }

  /* All of the pixel formats are handled above so if this hits then we've been given an invalid pixel format */
  g_assert (glformat != 0);

And also upstream have use same way to fix under cogl/driver/gl/gl/cogl-driver-gl.c

https://gitlab.gnome.org/GNOME/cogl/commit/ca5226513eb64bceb38ca01994799c4e7cd9f5fa

so I think we can fix same way under this cogl/driver/gl/gles/cogl-driver-gles.c

Quoted 4 lines

cu
Adrian

Signature · 3 lines
BRs

Sandy(Li Changqing)
#5 lore raw
Quoted 5 lines · Changqing Li

...
And also upstream have use same way to fix under
cogl/driver/gl/gl/cogl-driver-gl.c

https://gitlab.gnome.org/GNOME/cogl/commit/ca5226513eb64bceb38ca01994799c4e7cd9f5fa

Have they?

This looks like a 4 year old commit that was never merged.

Quoted 2 lines

so I think we can fix same way under this
cogl/driver/gl/gles/cogl-driver-gles.c

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#6 lore raw
Quoted 9 lines · Adrian Bunk
Quoted 5 lines · Changqing Li

...
And also upstream have use same way to fix under
cogl/driver/gl/gl/cogl-driver-gl.c

https://gitlab.gnome.org/GNOME/cogl/commit/ca5226513eb64bceb38ca01994799c4e7cd9f5fa

Have they?

This looks like a 4 year old commit that was never merged.

Seems it merged to 1.22 branch,  I can see it switch to tag 1.22.2, but indeed,  it  not merge to master.

and this change also include in http://ftp.gnome.org/pub/GNOME/sources/cogl/1.22/cogl-1.22.2.tar.xz.

Quoted 6 lines
Quoted 3 lines

so I think we can fix same way under this
cogl/driver/gl/gles/cogl-driver-gles.c

cu
Adrian

Signature · 3 lines
BRs

Sandy(Li Changqing)
#7 lore raw
In reply to [email protected]

+Upstream-Status: Submitted
[https://github.com/GNOME/cogl/pull/4/commits/be7a7b983952d3f2ce2cbaa7b89f413b92e15066]

That's a GNOME mirror, note how your PR was closed. GNOME is at gitlab.gnome.org.

Ross

Quoted 88 lines · On Tue, 2 Apr 2019 at 10:37, <[email protected]> wrote:

From: Changqing Li <[email protected]>

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;
|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
---
 ...mpile-error-with-Werror-maybe-uninitializ.patch | 40 ++++++++++++++++++++++
 meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb      |  4 ++-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch
meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +40 -0
new file mode 100644
index 0000000..3c99d25
@@ -0,0 +1,40 @@
+From e05ee89fcc978fceccab3e4724a3a37f7a338499 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Tue, 2 Apr 2019 14:48:49 +0800
+Subject: [PATCH] cogl: fix compile error with -Werror=maybe-uninitialized
+
+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;
+|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
+
+Upstream-Status: Submitted [https://github.com/GNOME/cogl/pull/4/commits/be7a7b983952d3f2ce2cbaa7b89f413b92e15066]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ cogl/driver/gl/gles/cogl-driver-gles.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
+index e94449f..a59d815 100644
+--- 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;
+
+   required_format = format;
+
+--
+2.7.4
+
meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb +3 -2
index 5901062..5ddeb4a 100644
@@ -1,7 +1,9 @@
 require cogl-1.0.inc
 
 SRC_URI += "file://test-backface-culling.c-fix-may-be-used-uninitialize.patch \
-            file://0001-Fix-an-incorrect-preprocessor-conditional.patch"
+            file://0001-Fix-an-incorrect-preprocessor-conditional.patch \
+            file://0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch \
+           "
 SRC_URI[archive.md5sum] = "d53b708ca7c4af03d7254e46945d6b33"
 SRC_URI[archive.sha256sum] = "39a718cdb64ea45225a7e94f88dddec1869ab37a21b339ad058a9d898782c00d"
 
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#8 lore raw
Quoted 2 lines · Ross

+Upstream-Status: Submitted
[https://github.com/GNOME/cogl/pull/4/commits/be7a7b983952d3f2ce2cbaa7b89f413b92e15066]

The pull request has automatically  forwarded to GNOME gitlab,  I will send a V2 to fix this.

Quoted 94 lines

That's a GNOME mirror, note how your PR was closed. GNOME is at gitlab.gnome.org.

Ross

Quoted 87 lines · On Tue, 2 Apr 2019 at 10:37, <[email protected]> wrote:

From: Changqing Li <[email protected]>

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;
|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
---
  ...mpile-error-with-Werror-maybe-uninitializ.patch | 40 ++++++++++++++++++++++
  meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb      |  4 ++-
  2 files changed, 43 insertions(+), 1 deletion(-)

create mode 100644 meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch

meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +40 -0
new file mode 100644
index 0000000..3c99d25
@@ -0,0 +1,40 @@
+From e05ee89fcc978fceccab3e4724a3a37f7a338499 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Tue, 2 Apr 2019 14:48:49 +0800
+Subject: [PATCH] cogl: fix compile error with -Werror=maybe-uninitialized
+
+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;
+|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
+
+Upstream-Status: Submitted [https://github.com/GNOME/cogl/pull/4/commits/be7a7b983952d3f2ce2cbaa7b89f413b92e15066]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ cogl/driver/gl/gles/cogl-driver-gles.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
+index e94449f..a59d815 100644
+--- 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;
+
+   required_format = format;
+
+--
+2.7.4
+
meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb +3 -2
index 5901062..5ddeb4a 100644
@@ -1,7 +1,9 @@
  require cogl-1.0.inc
 
  SRC_URI += "file://test-backface-culling.c-fix-may-be-used-uninitialize.patch \
-            file://0001-Fix-an-incorrect-preprocessor-conditional.patch"
+            file://0001-Fix-an-incorrect-preprocessor-conditional.patch \
+            file://0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch \
+           "
  SRC_URI[archive.md5sum] = "d53b708ca7c4af03d7254e46945d6b33"
  SRC_URI[archive.sha256sum] = "39a718cdb64ea45225a7e94f88dddec1869ab37a21b339ad058a9d898782c00d"
 
--

2.7.4

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 3 lines
BRs

Sandy(Li Changqing)
#9 lore raw

PATCH v2 1/1 cogl: fix compile error with -Werror=maybe-uninitialized

In reply to Burton, Ross

From: Changqing Li <[email protected]>

fix below compile error with -Werror=maybe-uninitialized while DEBUG_BUILD is enabled

| ../../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;
|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
---
 ...mpile-error-with-Werror-maybe-uninitializ.patch | 40 ++++++++++++++++++++++
 meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb      |  4 ++-
 2 files changed, 43 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch
meta/recipes-graphics/cogl/cogl-1.0/0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch new file +40 -0
new file mode 100644
index 0000000..1cfd35c
@@ -0,0 +1,40 @@
+From e05ee89fcc978fceccab3e4724a3a37f7a338499 Mon Sep 17 00:00:00 2001
+From: Changqing Li <[email protected]>
+Date: Tue, 2 Apr 2019 14:48:49 +0800
+Subject: [PATCH] cogl: fix compile error with -Werror=maybe-uninitialized
+
+fix below compile error with -Werror=maybe-uninitialized when DEBUG_BUILD is enabled
+
+| ../../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;
+|      ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
+
+Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/cogl/issues/6]
+
+Signed-off-by: Changqing Li <[email protected]>
+---
+ cogl/driver/gl/gles/cogl-driver-gles.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/cogl/driver/gl/gles/cogl-driver-gles.c b/cogl/driver/gl/gles/cogl-driver-gles.c
+index e94449f..a59d815 100644
+--- 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;
+ 
+   required_format = format;
+ 
+-- 
+2.7.4
+
meta/recipes-graphics/cogl/cogl-1.0_1.22.2.bb +3 -1
index 5901062..5ddeb4a 100644
@@ -1,7 +1,9 @@
 require cogl-1.0.inc
 
 SRC_URI += "file://test-backface-culling.c-fix-may-be-used-uninitialize.patch \
-            file://0001-Fix-an-incorrect-preprocessor-conditional.patch"
+            file://0001-Fix-an-incorrect-preprocessor-conditional.patch \
+            file://0001-cogl-fix-compile-error-with-Werror-maybe-uninitializ.patch \
+           "
 SRC_URI[archive.md5sum] = "d53b708ca7c4af03d7254e46945d6b33"
 SRC_URI[archive.sha256sum] = "39a718cdb64ea45225a7e94f88dddec1869ab37a21b339ad058a9d898782c00d"
 
Signature · 1 line
2.7.4