[CMake] add -Wvla #2301

pull/2303/head
nick black 3 years ago
parent f6443e2152
commit 548b4e2729
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -116,7 +116,7 @@ if(NOT WIN32)
add_compile_definitions(_FORTIFY_SOURCE=2)
add_compile_options(-Wformat -Werror=format-security)
endif()
add_compile_options(-Wall -Wextra -W -Wshadow)
add_compile_options(-Wall -Wextra -W -Wshadow -Wvla)
# -ffast-math dies on NaNs we draw from libav (by -ffinite-math-only)
add_compile_options(-fno-signed-zeros -fno-trapping-math -fassociative-math)
add_compile_options(-fno-math-errno -freciprocal-math -funsafe-math-optimizations)

@ -16,8 +16,8 @@ wipebitmap(struct notcurses* nc){
&cellpxy, &cellpxx, NULL, NULL);
int pixy = cellpxy * 6;
int pixx = cellpxx * 6;
uint32_t pixels[pixx * pixy];
memset(pixels, 0xff, sizeof(pixels));
uint32_t* pixels = malloc(sizeof(*pixels) * pixx * pixy);
memset(pixels, 0xff, sizeof(*pixels) * pixx * pixy);
struct ncvisual* ncv = ncvisual_from_rgba(pixels,
6 * cellpxy,
6 * cellpxx * 4,
@ -145,6 +145,7 @@ wipebitmap(struct notcurses* nc){
ncvisual_destroy(ncve);
ncvisual_destroy(ncv);
ncplane_destroy(n);
free(pixels);
return 0;
}

Loading…
Cancel
Save