Commit: e1ea2736fea8fc6257af53e5fcef71d0c8d5841d
Parent: 8646b356c1342c833c6dae3c25653b051b7b5d17
Author: Randy Palamar
Date: Mon, 21 Oct 2024 09:05:13 -0600
cleanup compiler warnings/errors with GCC/glibc
Diffstat:
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/build.sh b/build.sh
@@ -9,7 +9,7 @@ cflags="-march=native -O3 -Wall -DVERSION=\"${version}\""
#cflags="${cflags} -Rpass-missed=.*"
ldflags="-lm -lGL -lglfw"
-testcflags="$cflags -O0 -ggdb -D_DEBUG -Wno-unused-function -Wno-undefined-internal"
+testcflags="$cflags -O0 -ggdb -D_DEBUG -Wno-unused-variable -Wno-unused-function -Wno-undefined-internal"
[ ! -s "./config.h" ] && cp config.def.h config.h
diff --git a/font.c b/font.c
@@ -185,7 +185,7 @@ render_glyph(Arena *a, FontAtlas *fa, u32 cp, enum face_style style, CachedGlyph
cg->tile_count = (((i32)x1 - 1) / (i32)fa->info.w) + 1;
ASSERT(cg->tile_count * fa->info.w >= x1);
- ASSERT(cg->tile_count >= 1);
+ ASSERT(cg->tile_count >= 1 && cg->tile_count < gc->tiles_in_x);
i32 out_width = fa->info.w * cg->tile_count;
i32 out_size = fa->info.h * out_width;
@@ -203,7 +203,7 @@ render_glyph(Arena *a, FontAtlas *fa, u32 cp, enum face_style style, CachedGlyph
if (!tile_index) {
/* NOTE: there may be a fancier way to do this but we will see if this causes
* any performance issue in practice */
- u32 x, y;
+ u32 x = 1, y = 1;
u8 *occupied = gc->occupied_tiles;
for (y = 0; !tile_index && y < gc->tiles_in_y; y++) {
for (x = 0; !tile_index && x < gc->tiles_in_x; x++) {
diff --git a/test.c b/test.c
@@ -1,10 +1,13 @@
+#define _XOPEN_SOURCE 700 /* wcwidth */
+#include <string.h> /* memcmp */
+#include <wchar.h> /* wcwidth */
+
#define GL_GLEXT_PROTOTYPES 1
#include <GLFW/glfw3.h>
#include "util.h"
#include "config.h"
-
/* NOTE: stubs for stuff we aren't testing */
#undef glfwSetWindowTitle
#undef glfwGetWindowTitle
@@ -15,6 +18,7 @@ const char *glfwGetWindowTitle(GLFWwindow *w) { return "test"; }
static void get_gpu_glyph_index(Arena, void *, void *, u32, u32, u32 *);
static GlyphCacheStats get_and_clear_glyph_cache_stats(void *p) { return (GlyphCacheStats){0}; }
static void init_font(void *a, void *b) {}
+static void push_char(RenderPushBuffer *r, GLCtx *g, v2 vs, v2 vo, v2 ts, uv2 co, i32 ci) {}
KEYBIND_FN(copy) { return 0; }
KEYBIND_FN(paste) { return 0; }
@@ -24,9 +28,6 @@ KEYBIND_FN(zoom) { return 0; }
#include "terminal.c"
#include "debug.c"
-#include <string.h> /* memcmp */
-#include <wchar.h> /* wcwidth */
-
static void
get_gpu_glyph_index(Arena a, void *b, void *c, u32 cp, u32 d, u32 *width)
{