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>
macos/master
Gert Wollny 5 years ago
parent 4ac3a04cb8
commit 06d60e4705
  1. 4
      src/gallium/auxiliary/os/os_misc.h
  2. 2
      src/vrend_blitter.c
  3. 19
      src/vrend_renderer.c
  4. 4
      src/vrend_shader.c

@ -45,8 +45,12 @@
#ifdef __GNUC__ #ifdef __GNUC__
#define UNUSED __attribute__((unused)) #define UNUSED __attribute__((unused))
#ifdef NDEBUG
#define MAYBE_UNUSED __attribute__((unused)) #define MAYBE_UNUSED __attribute__((unused))
#else #else
#define MAYBE_UNUSED
#endif
#else
#define UNUSED #define UNUSED
#define MAYBE_UNUSED #define MAYBE_UNUSED
#endif #endif

@ -706,7 +706,7 @@ static void calc_dst_deltas_from_src(const struct pipe_blit_info *info,
} }
/* implement blitting using OpenGL. */ /* 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 *src_res,
struct vrend_resource *dst_res, struct vrend_resource *dst_res,
GLenum blit_views[2], GLenum blit_views[2],

@ -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_LOGIC_OP 15
#define GLES_WARN_TIMESTAMP 16 #define GLES_WARN_TIMESTAMP 16
MAYBE_UNUSED
static const char *vrend_gles_warn_strings[] = { static const char *vrend_gles_warn_strings[] = {
[GLES_WARN_NONE] = "None", [GLES_WARN_NONE] = "None",
[GLES_WARN_STIPPLE] = "Stipple", [GLES_WARN_STIPPLE] = "Stipple",
@ -834,15 +835,17 @@ static const char *vrend_gles_warn_strings[] = {
[GLES_WARN_TIMESTAMP] = "GL_TIMESTAMP", [GLES_WARN_TIMESTAMP] = "GL_TIMESTAMP",
}; };
static void __report_gles_warn(const char *fname, struct vrend_context *ctx, static void __report_gles_warn(MAYBE_UNUSED const char *fname,
enum virgl_ctx_errors error) 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]); 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) #define report_gles_warn(ctx, error) __report_gles_warn(__func__, ctx, error)
static void __report_gles_missing_func(const char *fname, static void __report_gles_missing_func(MAYBE_UNUSED const char *fname,
struct vrend_context *ctx, const char *missf) 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); 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) static void dump_stream_out(struct pipe_stream_output_info *so)
{ {
unsigned i; unsigned i;
@ -1170,7 +1174,8 @@ static char *get_skip_str(int *skip_val)
return start_skip; 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 vrend_shader_info *sinfo)
{ {
struct pipe_stream_output_info *so = &sinfo->so_info; struct pipe_stream_output_info *so = &sinfo->so_info;
@ -2108,9 +2113,9 @@ int vrend_create_sampler_view(struct vrend_context *ctx,
} }
static 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 = &gt->base; MAYBE_UNUSED const struct pipe_resource *pr = &gt->base;
#define PRINT_TARGET(X) case X: vrend_printf( #X); break #define PRINT_TARGET(X) case X: vrend_printf( #X); break
VREND_DEBUG_EXT(dbg_tex, NULL, VREND_DEBUG_EXT(dbg_tex, NULL,
vrend_printf("%s: ", f); vrend_printf("%s: ", f);

@ -6635,7 +6635,7 @@ static bool allocate_strbuffers(struct dump_ctx* ctx)
return true; 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) struct vrend_strarray *shader)
{ {
strarray_addstrbuf(shader, &ctx->glsl_ver_ext); 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); 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_shader_cfg *cfg,
struct vrend_strarray *prog_strings, struct vrend_strarray *prog_strings,
struct vrend_shader_info *vs_info, struct vrend_shader_info *vs_info,

Loading…
Cancel
Save