[gtk/matthiasc/for-master-2: 1/7] gdk: Silence some compiler warnings



commit 9e6ae7acd830b8aa382cdb494051f23e1d83ff1f
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 4 22:54:19 2020 +0100

    gdk: Silence some compiler warnings
    
    These cause unused variable warnings in release builds.

 gdk/gdkdrawcontext.c |  6 ------
 gdk/gdkglcontext.c   | 19 +++++--------------
 2 files changed, 5 insertions(+), 20 deletions(-)
---
diff --git a/gdk/gdkdrawcontext.c b/gdk/gdkdrawcontext.c
index 6f19c5fde6..5822ed7eb2 100644
--- a/gdk/gdkdrawcontext.c
+++ b/gdk/gdkdrawcontext.c
@@ -180,10 +180,8 @@ static guint pixels_counter;
 static void
 gdk_draw_context_init (GdkDrawContext *self)
 {
-#ifdef G_ENABLE_DEBUG
   if (pixels_counter == 0)
     pixels_counter = gdk_profiler_define_int_counter ("frame pixels", "Pixels drawn per frame");
-#endif
 }
 
 /**
@@ -322,7 +320,6 @@ gdk_draw_context_begin_frame (GdkDrawContext       *context,
   GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, priv->frame_region);
 }
 
-#ifdef G_ENABLE_DEBUG
 static gint64
 region_get_pixels (cairo_region_t *region)
 {
@@ -339,7 +336,6 @@ region_get_pixels (cairo_region_t *region)
 
   return pixels;
 }
-#endif
 
 /**
  * gdk_draw_context_end_frame:
@@ -380,12 +376,10 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
 
   GDK_DRAW_CONTEXT_GET_CLASS (context)->end_frame (context, priv->frame_region);
 
-#ifdef G_ENABLE_DEBUG
   if (gdk_profiler_is_running ())
     gdk_profiler_set_int_counter (pixels_counter,
                                   g_get_monotonic_time () * 1000,
                                   region_get_pixels (priv->frame_region));
-#endif
 
   g_clear_pointer (&priv->frame_region, cairo_region_destroy);
   g_clear_object (&priv->surface->paint_context);
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index ddf9cd3f95..20f4727b48 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -638,7 +638,6 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
                                      int           minor)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
-  GdkDisplay *display;
   int version, min_ver;
 
   g_return_if_fail (GDK_IS_GL_CONTEXT (context));
@@ -655,9 +654,7 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
   /* Enforce a minimum context version number of 3.2 */
   version = (major * 100) + minor;
 
-  display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
-
-  if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES))
+  if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT 
(context)), GL_GLES))
     min_ver = 200;
   else
     min_ver = 302;
@@ -686,15 +683,12 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
                                      int          *minor)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
-  GdkDisplay *display;
   int default_major, default_minor;
   int maj, min;
 
   g_return_if_fail (GDK_IS_GL_CONTEXT (context));
 
-  display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
-
-  if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES))
+  if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT 
(context)), GL_GLES))
     {
       default_major = 2;
       default_minor = 0;
@@ -941,7 +935,6 @@ static void
 gdk_gl_context_check_extensions (GdkGLContext *context)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
-  GdkDisplay *display;
   gboolean has_npot, has_texture_rectangle;
 
   if (!priv->realized)
@@ -1000,14 +993,12 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
         priv->is_legacy = TRUE;
     }
 
-  display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
-
-  if (priv->has_khr_debug && GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG))
+  if (priv->has_khr_debug && GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT 
(context)), GL_DEBUG))
     {
       priv->use_khr_debug = TRUE;
       glGetIntegerv (GL_MAX_LABEL_LENGTH, &priv->max_debug_label_length);
     }
-  if (!priv->use_es && GDK_DISPLAY_DEBUG_CHECK (display, GL_TEXTURE_RECT))
+  if (!priv->use_es && GDK_DISPLAY_DEBUG_CHECK (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), 
GL_TEXTURE_RECT))
     priv->use_texture_rectangle = TRUE;
   else if (has_npot)
     priv->use_texture_rectangle = FALSE;
@@ -1016,7 +1007,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
   else
     g_warning ("GL implementation doesn't support any form of non-power-of-two textures");
 
-  GDK_DISPLAY_NOTE (display, OPENGL,
+  GDK_DISPLAY_NOTE (gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context)), OPENGL,
     g_message ("%s version: %d.%d (%s)\n"
                        "* GLSL version: %s\n"
                        "* Extensions checked:\n"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]