From 311225be4d9187cbadf7388af87946d9fa62a924 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Tue, 7 May 2024 17:59:57 +0100 Subject: [PATCH] misc: fix building with gcc Signed-off-by: Yuxuan Shui --- meson.build | 8 ++++++++ src/backend/gl/blur.c | 1 + src/backend/gl/gl_common.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 528a53a0..eb72e576 100644 --- a/meson.build +++ b/meson.build @@ -59,6 +59,14 @@ if get_option('warning_level') != '0' 'sign-compare', 'type-limits', 'uninitialized', 'shift-negative-value', 'unused-but-set-parameter', 'unused-parameter', 'implicit-fallthrough=2', 'no-unknown-warning-option', 'no-missing-braces', 'conversion', 'empty-body' ] + bad_warns_ubsan = [ + 'no-format-overflow' # see gcc bug 87884, enabling UBSAN makes gcc spit out spurious warnings + # (if you saw this comment, went and checked gcc bugzilla, and found out + # bug has been fixed, please open a PR to remove this). + ] + if get_option('b_sanitize').contains('undefined') and cc.get_id() == 'gcc' + warns = warns + bad_warns_ubsan + endif foreach w : warns if cc.has_argument('-W'+w) add_global_arguments('-W'+w, language: 'c') diff --git a/src/backend/gl/blur.c b/src/backend/gl/blur.c index 2efb191d..9c28946f 100644 --- a/src/backend/gl/blur.c +++ b/src/backend/gl/blur.c @@ -290,6 +290,7 @@ static bool gl_blur_context_preallocate_textures(struct gl_blur_context *bctx, case BACKEND_IMAGE_FORMAT_PIXMAP_HIGH: format = GL_RGBA16; break; case BACKEND_IMAGE_FORMAT_PIXMAP: format = GL_RGBA8; break; case BACKEND_IMAGE_FORMAT_MASK: format = GL_R8; break; + default: unreachable(); } glTexImage2D(GL_TEXTURE_2D, 0, format, tex_size->width, tex_size->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL); diff --git a/src/backend/gl/gl_common.c b/src/backend/gl/gl_common.c index bc6bc8e2..f2698291 100644 --- a/src/backend/gl/gl_common.c +++ b/src/backend/gl/gl_common.c @@ -803,7 +803,7 @@ static inline void gl_init_uniform_bitmask(struct gl_shader *shader) { glGetActiveUniformName(shader->prog, (GLuint)i, sizeof(name), NULL, name); GLint loc = glGetUniformLocation(shader->prog, name); assert(loc >= 0 && loc <= UNIFORM_TEXSIZE_LOC); - shader->uniform_bitmask |= 1 << loc; + shader->uniform_bitmask |= 1U << loc; } }