From abc448faec08a03134b70fadd6d76d57c1dde1e7 Mon Sep 17 00:00:00 2001 From: Tim Angus Date: Mon, 14 Jul 2025 17:40:33 +0100 Subject: [PATCH] Selectively disable -Warray-bounds --- code/renderergl1/tr_sky.c | 12 ++++++++++++ code/renderergl2/tr_sky.c | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/code/renderergl1/tr_sky.c b/code/renderergl1/tr_sky.c index 2f5f7786..304d01ea 100644 --- a/code/renderergl1/tr_sky.c +++ b/code/renderergl1/tr_sky.c @@ -49,6 +49,14 @@ static vec3_t sky_clip[6] = static float sky_mins[2][6], sky_maxs[2][6]; static float sky_min, sky_max; +#ifdef __GNUC__ +#pragma GCC diagnostic push +// AddSkyPolygon and ClipSkyPolygon both technically do +// unbounded access of their vecs parameter, though in +// practice the size of what they're passed makes it safe +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + /* ================ AddSkyPolygon @@ -238,6 +246,10 @@ static void ClipSkyPolygon (int nump, vec3_t vecs, int stage) ClipSkyPolygon (newc[1], newv[1][0], stage+1); } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + /* ============== ClearSkyBox diff --git a/code/renderergl2/tr_sky.c b/code/renderergl2/tr_sky.c index c79f48f5..fee9e685 100644 --- a/code/renderergl2/tr_sky.c +++ b/code/renderergl2/tr_sky.c @@ -49,6 +49,14 @@ static vec3_t sky_clip[6] = static float sky_mins[2][6], sky_maxs[2][6]; static float sky_min, sky_max; +#ifdef __GNUC__ +#pragma GCC diagnostic push +// AddSkyPolygon and ClipSkyPolygon both technically do +// unbounded access of their vecs parameter, though in +// practice the size of what they're passed makes it safe +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + /* ================ AddSkyPolygon @@ -238,6 +246,10 @@ static void ClipSkyPolygon (int nump, vec3_t vecs, int stage) ClipSkyPolygon (newc[1], newv[1][0], stage+1); } +#ifdef __GNUC__ +#pragma GCC diagnostic pop +#endif + /* ============== ClearSkyBox