Subject: bug#22409: closed (Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 23 Jan 2016 09:15:02 +0000

Your bug report

#22409: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
22409: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22409
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
From: Paul Eggert <[email-masked]>
To: [email-masked]
Date: Sat, 23 Jan 2016 01:14:21 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

emacs-25 commit c07bddd69dab6252ce1e8a283a023d693b7d7ad6 should fix this, so I 
am closing the bug repor.

Subject: [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
From: Alexander Kuleshov <[email-masked]>
To: [email-masked]
Cc: Alexander Kuleshov <[email-masked]>
Date: Tue, 19 Jan 2016 17:52:07 +0600
List-Id: <debbugs-submit.debbugs.gnu.org>

This patch does not provide functional changes, but contains fixes
for compilation errors if GNU Emacs was configured with the
--enable-gcc-warnings option. Mostly "defined but not used" fixed.
---
 src/gtkutil.c |  2 +-
 src/image.c   | 46 +++++++++++++++++++++++++++++-----------------
 src/xterm.c   |  6 +++---
 3 files changed, 33 insertions(+), 21 deletions(-)

diff --git a/src/gtkutil.c b/src/gtkutil.c
index 768df34..bf7a067 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -4096,7 +4096,7 @@ xg_get_page_setup (void)
     orientation_symbol = Qlandscape;
   else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_PORTRAIT)
     orientation_symbol = Qreverse_portrait;
-  else if (orientation == GTK_PAGE_ORIENTATION_REVERSE_LANDSCAPE)
+  else
     orientation_symbol = Qreverse_landscape;
 
   return listn (CONSTYPE_HEAP, 7,
diff --git a/src/image.c b/src/image.c
index 8bb5ff7..03b4489 100644
--- a/src/image.c
+++ b/src/image.c
@@ -75,7 +75,9 @@ typedef struct x_bitmap_record Bitmap_Record;
 #endif
 
 /* W32_TODO : Color tables on W32.  */
+#ifdef COLOR_TABLE_SUPPORT
 #undef COLOR_TABLE_SUPPORT
+#endif
 
 typedef struct w32_bitmap_record Bitmap_Record;
 #define GET_PIXEL(ximg, x, y) GetPixel (ximg, x, y)
@@ -90,11 +92,16 @@ typedef struct w32_bitmap_record Bitmap_Record;
 #endif /* HAVE_NTGUI */
 
 #ifdef USE_CAIRO
+#ifdef COLOR_TABLE_SUPPORT
 #undef COLOR_TABLE_SUPPORT
 #endif
+#endif
 
 #ifdef HAVE_NS
+
+#ifdef COLOR_TABLE_SUPPORT
 #undef COLOR_TABLE_SUPPORT
+#endif
 
 typedef struct ns_bitmap_record Bitmap_Record;
 
@@ -4615,16 +4622,15 @@ colors_in_color_table (int *n)
 static unsigned long
 lookup_rgb_color (struct frame *f, int r, int g, int b)
 {
-  unsigned long pixel;
-
 #ifdef HAVE_NTGUI
-  pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
+  return PALETTERGB (r >> 8, g >> 8, b >> 8);
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
+  return RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
 #endif /* HAVE_NS */
-  return pixel;
+
+  return 0;
 }
 
 static void
@@ -7328,10 +7334,10 @@ tiff_load (struct frame *f, struct image *img)
         for (x = 0; x < width; ++x)
           {
             uint32 abgr = row[x];
-            int r = TIFFGetR (abgr);
-            int g = TIFFGetG (abgr);
-            int b = TIFFGetB (abgr);
-            int a = TIFFGetA (abgr);
+            r = TIFFGetR (abgr);
+            g = TIFFGetG (abgr);
+            b = TIFFGetB (abgr);
+            a = TIFFGetA (abgr);
             *dataptr++ = (a << 24) | (r << 16) | (g << 8) | b;
           }
       }
@@ -7634,13 +7640,11 @@ gif_load (struct frame *f, struct image *img)
 {
   int rc, width, height, x, y, i, j;
   ColorMapObject *gif_color_map;
-  unsigned long pixel_colors[256];
   GifFileType *gif;
   gif_memory_source memsrc;
   Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
   Lisp_Object specified_file = image_spec_value (img->spec, QCfile, NULL);
   Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
-  unsigned long bgcolor = 0;
   EMACS_INT idx;
   int gif_err;
 
@@ -7648,6 +7652,8 @@ gif_load (struct frame *f, struct image *img)
   unsigned char *data = 0;
 #else
   XImagePtr ximg;
+  unsigned long pixel_colors[256];
+  unsigned long bgcolor = 0;
 #endif
 
   if (NILP (specified_data))
@@ -7834,8 +7840,12 @@ gif_load (struct frame *f, struct image *img)
 
   init_color_table ();
   if (STRINGP (specified_bg))
+#ifndef USE_CAIRO
     bgcolor = x_alloc_image_color (f, img, specified_bg,
-				   FRAME_BACKGROUND_PIXEL (f));
+                                FRAME_BACKGROUND_PIXEL (f));
+#else
+    x_alloc_image_color (f, img, specified_bg, FRAME_BACKGROUND_PIXEL (f));
+#endif
   for (j = 0; j <= idx; ++j)
     {
       /* We use a local variable `raster' here because RasterBits is a
@@ -9182,11 +9192,13 @@ svg_load_image (struct frame *f,         /* Pointer to emacs frame structure.  *
   int height;
   const guint8 *pixels;
   int rowstride;
-  XImagePtr ximg;
-  Lisp_Object specified_bg;
-  XColor background;
+#ifndef USE_CAIRO
   int x;
   int y;
+  XColor background;
+  XImagePtr ximg;
+  Lisp_Object specified_bg;
+#endif
 
 #if ! GLIB_CHECK_VERSION (2, 36, 0)
   /* g_type_init is a glib function that must be called prior to
@@ -9597,8 +9609,6 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
 			0, 0, img->width, img->height, ~0, ZPixmap);
       if (ximg)
 	{
-	  int x, y;
-
 	  /* Initialize the color table.  */
 	  init_color_table ();
 
@@ -9606,6 +9616,8 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
 	     color table.  After having done so, the color table will
 	     contain an entry for each color used by the image.  */
 #ifdef COLOR_TABLE_SUPPORT
+	  int x, y;
+
 	  for (y = 0; y < img->height; ++y)
 	    for (x = 0; x < img->width; ++x)
 	      {
diff --git a/src/xterm.c b/src/xterm.c
index 5a6d643..530c918 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1312,7 +1312,6 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
 {
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   Display *display = FRAME_X_DISPLAY (f);
-  Window window = FRAME_X_WINDOW (f);
   GC gc = f->output_data.x->normal_gc;
   struct face *face = p->face;
 
@@ -1359,6 +1358,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
       Pixmap pixmap, clipmask = (Pixmap) 0;
       int depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f));
       XGCValues gcv;
+      Window window = FRAME_X_WINDOW (f);
 
       if (p->wd > 8)
 	bits = (char *) (p->bits + p->dh);
@@ -3749,7 +3749,7 @@ x_delete_glyphs (struct frame *f, register int n)
   emacs_abort ();
 }
 
-
+#if !defined USE_CAIRO || !defined USE_TOOLKIT_SCROLL_BARS
 /* Like XClearArea, but check that WIDTH and HEIGHT are reasonable.
    If they are <= 0, this is probably an error.  */
 
@@ -3760,7 +3760,7 @@ x_clear_area1 (Display *dpy, Window window,
   eassert (width > 0 && height > 0);
   XClearArea (dpy, window, x, y, width, height, exposures);
 }
-
+#endif
 
 void
 x_clear_area (struct frame *f, int x, int y, int width, int height)
-- 
2.7.0.25.gfc10eb5