misc: fix building with gcc

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2024-05-07 17:59:57 +01:00
parent 7a69534633
commit 311225be4d
No known key found for this signature in database
GPG Key ID: D3A4405BE6CC17F4
3 changed files with 10 additions and 1 deletions

View File

@ -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')

View File

@ -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);

View File

@ -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;
}
}