diff options
author | Gert Wollny <gert.wollny@collabora.com> | 2019-10-07 10:05:34 +0200 |
---|---|---|
committer | Gert Wollny <gert.wollny@collabora.com> | 2019-10-10 18:13:26 +0200 |
commit | 06d60e4705cc3766581dd0fbded15b5517cd94cb (patch) | |
tree | 57eee74b4f5899300e2e07cf3a6db84a423514c9 | |
parent | 4ac3a04cb8a4b0d419bccbb7798b59aa098487a6 (diff) |
vrend: silence warnings when NDEBUG is defined
For this introduce a NDEBUG_UNUSED macro
v2: Replace NDEBUG_UNUSED with MAYBE_UNUSED (Emil)
Silence unused warnings only if NDEBUG is defined
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
-rw-r--r-- | src/gallium/auxiliary/os/os_misc.h | 4 | ||||
-rw-r--r-- | src/vrend_blitter.c | 2 | ||||
-rw-r--r-- | src/vrend_renderer.c | 19 | ||||
-rw-r--r-- | src/vrend_shader.c | 4 |
4 files changed, 19 insertions, 10 deletions
diff --git a/src/gallium/auxiliary/os/os_misc.h b/src/gallium/auxiliary/os/os_misc.h index 4bb6939..a89256e 100644 --- a/src/gallium/auxiliary/os/os_misc.h +++ b/src/gallium/auxiliary/os/os_misc.h @@ -45,8 +45,12 @@ #ifdef __GNUC__ #define UNUSED __attribute__((unused)) +#ifdef NDEBUG #define MAYBE_UNUSED __attribute__((unused)) #else +#define MAYBE_UNUSED +#endif +#else #define UNUSED #define MAYBE_UNUSED #endif diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c index f49a444..ab5be2c 100644 --- a/src/vrend_blitter.c +++ b/src/vrend_blitter.c @@ -706,7 +706,7 @@ static void calc_dst_deltas_from_src(const struct pipe_blit_info *info, } /* implement blitting using OpenGL. */ -void vrend_renderer_blit_gl(struct vrend_context *ctx, +void vrend_renderer_blit_gl(MAYBE_UNUSED struct vrend_context *ctx, struct vrend_resource *src_res, struct vrend_resource *dst_res, GLenum blit_views[2], diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 4bb87a8..28ce9bd 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -815,6 +815,7 @@ static void __report_core_warn(const char *fname, struct vrend_context *ctx, #define GLES_WARN_LOGIC_OP 15 #define GLES_WARN_TIMESTAMP 16 +MAYBE_UNUSED static const char *vrend_gles_warn_strings[] = { [GLES_WARN_NONE] = "None", [GLES_WARN_STIPPLE] = "Stipple", @@ -834,15 +835,17 @@ static const char *vrend_gles_warn_strings[] = { [GLES_WARN_TIMESTAMP] = "GL_TIMESTAMP", }; -static void __report_gles_warn(const char *fname, struct vrend_context *ctx, - enum virgl_ctx_errors error) +static void __report_gles_warn(MAYBE_UNUSED const char *fname, + MAYBE_UNUSED struct vrend_context *ctx, + MAYBE_UNUSED enum virgl_ctx_errors error) { VREND_DEBUG(dbg_gles, ctx, "%s: GLES violation - %s\n", fname, vrend_gles_warn_strings[error]); } #define report_gles_warn(ctx, error) __report_gles_warn(__func__, ctx, error) -static void __report_gles_missing_func(const char *fname, - struct vrend_context *ctx, const char *missf) +static void __report_gles_missing_func(MAYBE_UNUSED const char *fname, + MAYBE_UNUSED struct vrend_context *ctx, + MAYBE_UNUSED const char *missf) { VREND_DEBUG(dbg_gles, ctx, "%s: GLES function %s is missing\n", fname, missf); } @@ -1123,6 +1126,7 @@ static void vrend_stencil_test_enable(struct vrend_context *ctx, bool stencil_te } } +MAYBE_UNUSED static void dump_stream_out(struct pipe_stream_output_info *so) { unsigned i; @@ -1170,7 +1174,8 @@ static char *get_skip_str(int *skip_val) return start_skip; } -static void set_stream_out_varyings(struct vrend_context *ctx, int prog_id, +static void set_stream_out_varyings(MAYBE_UNUSED struct vrend_context *ctx, + int prog_id, struct vrend_shader_info *sinfo) { struct pipe_stream_output_info *so = &sinfo->so_info; @@ -2108,9 +2113,9 @@ int vrend_create_sampler_view(struct vrend_context *ctx, } static -void debug_texture(const char *f, const struct vrend_resource *gt) +void debug_texture(MAYBE_UNUSED const char *f, const struct vrend_resource *gt) { - const struct pipe_resource *pr = >->base; + MAYBE_UNUSED const struct pipe_resource *pr = >->base; #define PRINT_TARGET(X) case X: vrend_printf( #X); break VREND_DEBUG_EXT(dbg_tex, NULL, vrend_printf("%s: ", f); diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 3927991..2fa7a69 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -6635,7 +6635,7 @@ static bool allocate_strbuffers(struct dump_ctx* ctx) return true; } -static void set_strbuffers(struct vrend_context *rctx, struct dump_ctx* ctx, +static void set_strbuffers(MAYBE_UNUSED struct vrend_context *rctx, struct dump_ctx* ctx, struct vrend_strarray *shader) { strarray_addstrbuf(shader, &ctx->glsl_ver_ext); @@ -6786,7 +6786,7 @@ static void require_gpu_shader5_and_msinterp(struct vrend_strarray *program) strbuf_append(&program->strings[SHADER_STRING_VER_EXT], gpu_shader5_and_msinterp_string); } -bool vrend_patch_vertex_shader_interpolants(struct vrend_context *rctx, +bool vrend_patch_vertex_shader_interpolants(MAYBE_UNUSED struct vrend_context *rctx, struct vrend_shader_cfg *cfg, struct vrend_strarray *prog_strings, struct vrend_shader_info *vs_info, |