all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Fix compilation erorr when --enable-gcc-warnings passed
@ 2016-01-22 10:54 Alexander Kuleshov
  2016-01-23  0:06 ` Paul Eggert
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Kuleshov @ 2016-01-22 10:54 UTC (permalink / raw)
  To: emacs-devel; +Cc: Alexander Kuleshov

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: set Qreverse_landscape if orientation symbol not
given. Prevents compilation error: orientation_symbol can be not
initialzed.
* src/image.c: add check that COLOR_TABLE_SUPPORT defined. Prevents
compilation error: macro COLOR_TABLE_SUPPORT defined but not used.
* src/xterm.c: move 'Window' declaration in the x_draw_fringe_bitmap()
to prevent errors "defined but not used".

---
 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




^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2016-01-24  8:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-22 10:54 [PATCH] Fix compilation erorr when --enable-gcc-warnings passed Alexander Kuleshov
2016-01-23  0:06 ` Paul Eggert
2016-01-23  6:28   ` Alexander Kuleshov
2016-01-23  9:08     ` Paul Eggert
2016-01-23  9:23       ` Eli Zaretskii
2016-01-23  9:41         ` Paul Eggert
2016-01-23 11:57       ` Alexander Kuleshov
2016-01-23 12:04       ` Alexander Kuleshov
2016-01-23 12:37         ` Alexander Kuleshov
2016-01-24  0:49           ` Paul Eggert
2016-01-24  7:34             ` Alexander Kuleshov
2016-01-24  8:49               ` bug#22442: " Paul Eggert
2016-01-23  9:12     ` bug#22442: 25.0.50; --with-cairo does not display PNG on GNU/Linux Paul Eggert
2016-01-23  9:25       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.