diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-04-20 15:03:43 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-04-20 15:03:43 -0400 |
commit | adc0e91ddbe70c2127d39c337d9b4a09ea752425 (patch) | |
tree | 36d573976865ff5793812edb6ea3261799bfb742 | |
parent | a57a9682e74ff3609acb2ca6697fc6fa94c23fb6 (diff) |
silence GCC warnings
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | build.c | 2 | ||||
-rw-r--r-- | gl.c | 7 | ||||
-rw-r--r-- | math.c | 7 | ||||
-rw-r--r-- | syntax.c | 6 | ||||
-rw-r--r-- | text.c | 12 |
6 files changed, 23 insertions, 13 deletions
@@ -100,7 +100,7 @@ To install `ted` on Linux, you will need: These can be installed on Ubuntu/Debian with: ``` -sudo apt install gcc libsdl2-dev wget unzip cmake +sudo apt install clang libsdl2-dev wget unzip cmake ``` Then run @@ -160,7 +160,7 @@ static int parse_nonnegative_integer(char32_t **str, char32_t *end) { int n = 0; for (number_len = 0; s != end && s[number_len] >= '0' && s[number_len] <= '9'; ++number_len) { n *= 10; - n += s[number_len] - '0'; + n += (int)s[number_len] - '0'; } if (number_len == 0) return -1; @@ -66,7 +66,14 @@ static int gl_version_minor; static void gl_get_procs(void) { #define gl_get_proc(upper, lower) gl##lower = (PFNGL##upper##PROC)SDL_GL_GetProcAddress("gl" #lower); +#if __GNUC__ && !__clang__ + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wpedantic" +#endif gl_for_each_proc(gl_get_proc) +#if __GNUC__ && !__clang__ + #pragma GCC diagnostic pop +#endif #undef gl_get_proc } @@ -810,11 +810,12 @@ static u32 color_interpolate(float x, u32 color1, u32 color2) { // to make it interpolate more nicely, convert to hsv, interpolate in that space, then convert back c1 = color_rgba_to_hsva(c1); c2 = color_rgba_to_hsva(c2); - float h1 = c1.x, s1 = c1.y, v1 = c1.z, a1 = c1.w; - float h2 = c2.x, s2 = c2.y, v2 = c2.z, a2 = c2.w; + // v_1/2 named differently to avoid shadowing + float h1 = c1.x, s1 = c1.y, v_1 = c1.z, a1 = c1.w; + float h2 = c2.x, s2 = c2.y, v_2 = c2.z, a2 = c2.w; float s_out = lerpf(x, s1, s2); - float v_out = lerpf(x, v1, v2); + float v_out = lerpf(x, v_1, v_2); float a_out = lerpf(x, a1, a2); float h_out; @@ -573,8 +573,10 @@ static void syntax_highlight_python(SyntaxState *state, char32_t const *line, u3 } *state = 0; if (in_string && string_is_multiline) { - *state |= SYNTAX_STATE_PYTHON_STRING - | (SYNTAX_STATE_PYTHON_STRING_DBL_QUOTED * string_is_dbl_quoted); + *state |= (SyntaxState)( + SYNTAX_STATE_PYTHON_STRING + | (SYNTAX_STATE_PYTHON_STRING_DBL_QUOTED * string_is_dbl_quoted) + ); } } @@ -322,12 +322,12 @@ top: } if (state->render) { float r = state->color[0], g = state->color[1], b = state->color[2], a = state->color[3]; - TextVertex v1 = {{x0, y0}, {s0, t0}, {r, g, b, a}}; - TextVertex v2 = {{x0, y1}, {s0, t1}, {r, g, b, a}}; - TextVertex v3 = {{x1, y1}, {s1, t1}, {r, g, b, a}}; - TextVertex v4 = {{x1, y0}, {s1, t0}, {r, g, b, a}}; - TextTriangle triangle1 = {v1, v2, v3}; - TextTriangle triangle2 = {v3, v4, v1}; + TextVertex v_1 = {{x0, y0}, {s0, t0}, {r, g, b, a}}; + TextVertex v_2 = {{x0, y1}, {s0, t1}, {r, g, b, a}}; + TextVertex v_3 = {{x1, y1}, {s1, t1}, {r, g, b, a}}; + TextVertex v_4 = {{x1, y0}, {s1, t0}, {r, g, b, a}}; + TextTriangle triangle1 = {v_1, v_2, v_3}; + TextTriangle triangle2 = {v_3, v_4, v_1}; arr_add(font->triangles[page], triangle1); arr_add(font->triangles[page], triangle2); } |