[gtk/ci-jobs: 2/2] Fix compiler warnings in the release build



commit cd2a1cf4803df61b2621394bc8a1ac6105f063c8
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Jan 29 12:00:48 2020 +0100

    Fix compiler warnings in the release build
    
    We have a bunch of debug-only variables that get set and never used
    outside of debug code paths, and the compiler is not happy about it.

 gdk/gdkgl.c        | 18 +++++++++++-------
 gdk/gdkglcontext.c | 17 ++++++++++++++---
 2 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index b1073483a7..1e24e77687 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -443,7 +443,6 @@ gdk_gl_texture_from_surface (cairo_surface_t *cairo_surface,
                             cairo_region_t  *region)
 {
   GdkGLContext *paint_context;
-  GdkDisplay *display;
   cairo_surface_t *image;
   double device_x_offset, device_y_offset;
   cairo_rectangle_int_t rect, e;
@@ -458,13 +457,18 @@ gdk_gl_texture_from_surface (cairo_surface_t *cairo_surface,
   guint target;
 
   paint_context = gdk_gl_context_get_current ();
-  if (paint_context)
-    display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (paint_context));
-  else
-    display = NULL;
 
-  if (paint_context &&
-      GDK_DISPLAY_DEBUG_CHECK (display, GL_SOFTWARE) == 0 &&
+#ifdef G_ENABLE_DEBUG
+  if (paint_context != NULL)
+    {
+      GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (paint_context));
+
+      if (GDK_DISPLAY_DEBUG_CHECK (display, GL_SOFTWARE) == 0)
+        return;
+    }
+#endif
+
+  if (paint_context != NULL &&
       GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface &&
       GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface (paint_context, cairo_surface, region))
     return;
diff --git a/gdk/gdkglcontext.c b/gdk/gdkglcontext.c
index ddf9cd3f95..ee7d75dba9 100644
--- a/gdk/gdkglcontext.c
+++ b/gdk/gdkglcontext.c
@@ -638,8 +638,10 @@ 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;
+#ifdef G_ENABLE_DEBUG
+  GdkDisplay *display;
+#endif
 
   g_return_if_fail (GDK_IS_GL_CONTEXT (context));
   g_return_if_fail (!priv->realized);
@@ -655,8 +657,9 @@ gdk_gl_context_set_required_version (GdkGLContext *context,
   /* Enforce a minimum context version number of 3.2 */
   version = (major * 100) + minor;
 
+#ifdef G_ENABLE_DEBUG
   display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
-
+#endif
   if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES))
     min_ver = 200;
   else
@@ -686,13 +689,17 @@ gdk_gl_context_get_required_version (GdkGLContext *context,
                                      int          *minor)
 {
   GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (context);
+#ifdef G_ENABLE_DEBUG
   GdkDisplay *display;
+#endif
   int default_major, default_minor;
   int maj, min;
 
   g_return_if_fail (GDK_IS_GL_CONTEXT (context));
 
+#ifdef G_ENABLE_DEBUG
   display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
+#endif
 
   if (priv->use_es > 0 || GDK_DISPLAY_DEBUG_CHECK (display, GL_GLES))
     {
@@ -941,8 +948,10 @@ 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;
+#ifdef G_ENABLE_DEBUG
+  GdkDisplay *display;
+#endif
 
   if (!priv->realized)
     return;
@@ -1000,7 +1009,9 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
         priv->is_legacy = TRUE;
     }
 
+#ifdef G_ENABLE_DEBUG
   display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (context));
+#endif
 
   if (priv->has_khr_debug && GDK_DISPLAY_DEBUG_CHECK (display, GL_DEBUG))
     {


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