[PATCH 5/5] wined3d: Fix an uninitialised variable warning.
Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/wined3d/context_gl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index a1aa3c0bb96..c21ecfd5c32 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -257,7 +257,7 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G }; GLint type, name, samples, width, height, old_texture, level, face, fmt, tex_target; - const char *tex_type_str; + const char *tex_type_str = NULL; unsigned int i; gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment, @@ -310,8 +310,6 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G } else { - tex_type_str = NULL; - for (i = 0; i < ARRAY_SIZE(texture_type); ++i) { if (!gl_info->supported[texture_type[i].extension]) -- 2.25.1
On Tue, 5 May 2020 at 17:17, Zhiyi Zhang <zzhang(a)codeweavers.com> wrote:
@@ -257,7 +257,7 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G };
GLint type, name, samples, width, height, old_texture, level, face, fmt, tex_target; - const char *tex_type_str; + const char *tex_type_str = NULL; unsigned int i;
gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment, @@ -310,8 +310,6 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G } else { - tex_type_str = NULL; - for (i = 0; i < ARRAY_SIZE(texture_type); ++i) { if (!gl_info->supported[texture_type[i].extension]) -- This is fine, but I have to wonder, are you using an unusual compiler or compile flags? The code doesn't seem all that complicated, and at least my version of gcc is able to figure out that the variable is initialised on all paths.
May 5, 2020 12:29 PM, "Henri Verbeet" <hverbeet(a)gmail.com> wrote:
On Tue, 5 May 2020 at 17:17, Zhiyi Zhang <zzhang(a)codeweavers.com> wrote:
@@ -257,7 +257,7 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G };
GLint type, name, samples, width, height, old_texture, level, face, fmt, tex_target; - const char *tex_type_str; + const char *tex_type_str = NULL; unsigned int i;
gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment, @@ -310,8 +310,6 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G } else { - tex_type_str = NULL; - for (i = 0; i < ARRAY_SIZE(texture_type); ++i) { if (!gl_info->supported[texture_type[i].extension]) --
This is fine, but I have to wonder, are you using an unusual compiler or compile flags? The code doesn't seem all that complicated, and at least my version of gcc is able to figure out that the variable is initialised on all paths.
So is my version of Clang; otherwise, I would've sent something like this myself. Chip
On 5/6/20 8:30 AM, Chip Davis wrote:
May 5, 2020 12:29 PM, "Henri Verbeet" <hverbeet(a)gmail.com> wrote:
On Tue, 5 May 2020 at 17:17, Zhiyi Zhang <zzhang(a)codeweavers.com> wrote:
@@ -257,7 +257,7 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G };
GLint type, name, samples, width, height, old_texture, level, face, fmt, tex_target; - const char *tex_type_str; + const char *tex_type_str = NULL; unsigned int i;
gl_info->fbo_ops.glGetFramebufferAttachmentParameteriv(target, attachment, @@ -310,8 +310,6 @@ static void context_dump_fbo_attachment(const struct wined3d_gl_info *gl_info, G } else { - tex_type_str = NULL; - for (i = 0; i < ARRAY_SIZE(texture_type); ++i) { if (!gl_info->supported[texture_type[i].extension]) -- This is fine, but I have to wonder, are you using an unusual compiler or compile flags? The code doesn't seem all that complicated, and at least my version of gcc is able to figure out that the variable is initialised on all paths. So is my version of Clang; otherwise, I would've sent something like this myself.
Chip Yeah. I am using -Og. The warning was a bit distracting so might as well silence it.
participants (4)
-
Chip Davis -
Henri Verbeet -
Henri Verbeet -
Zhiyi Zhang