Subject: bug#46491: closed (Re: bug#46491: [feature/pgtk] Unused macro warning in image.c without ImageMagick)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 14 Feb 2021 12:34:02 +0000

Your bug report

#46491: [feature/pgtk] Unused macro warning in image.c without ImageMagick

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

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

Subject: Re: bug#46491: [feature/pgtk] Unused macro warning in image.c without ImageMagick
From: "Basil L. Contovounesios" <[email-masked]>
To: Yuuki Harano <[email-masked]>
Cc: [email-masked]
Date: Sun, 14 Feb 2021 12:33:10 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Yuuki Harano <[email-masked]> writes:

> On Sat, 13 Feb 2021 16:34:22 +0000,
> 	"Basil L. Contovounesios" <[email-masked]> wrote:
>> Is the attached patch the right fix?  If so, I can push it after adding
>> the bug#number to it.
>
> Thanks, confirmed.  Please push it.

Thanks, done.

Fix unused macro build warning in image.c
c4cc80e1fb 2021-02-14 12:29:25 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c4cc80e1fbbfb50486c6ce360f2d68e96fc45887

-- 
Basil

Subject: [feature/pgtk] Unused macro warning in image.c without ImageMagick
From: "Basil L. Contovounesios" <[email-masked]>
To: [email-masked]
Date: Sat, 13 Feb 2021 16:34:22 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

X-Debbugs-Cc: Yuuki Harano <[email-masked]>
Severity: minor
Tags: patch

The following is the only build warning I currently get on feature/pgtk:

  image.c:110: warning: macro "DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE"
    is not used [-Wunused-macros]
    110 | # define DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE

Is the attached patch the right fix?  If so, I can push it after adding
the bug#number to it.

Thanks,

-- 
Basil

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
 of 2021-02-13 built on tia
Repository revision: 175ebb010477ff0e174fe5145154397f43dee2d2
Repository branch: feature/pgtk
Windowing system distributor 'System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure 'CC=ccache gcc' 'CFLAGS=-O2 -march=native' --config-cache
 --prefix=/home/blc/.local --program-suffix=-pgtk
 --enable-checking=structs --with-file-notification=yes --with-pgtk
 --with-xwidgets'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NOTIFY INOTIFY
PDUMPER PGTK PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS XIM
XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_IE.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

>From d60bc973c8ac840e02297931f86ebb05b50b20e6 Mon Sep 17 00:00:00 2001
From: "Basil L. Contovounesios" <[email-masked]>
Date: Sat, 13 Feb 2021 14:51:48 +0000
Subject: [PATCH] Fix unused macro build warning in image.c

* src/image.c
[HAVE_PGTK] (DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE): Define only
if HAVE_IMAGEMAGICK is also defined, as it is otherwise unused.
(image_set_transform): Reduce nesting of preprocessor conditionals.
---
 src/image.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/image.c b/src/image.c
index cc97ca4d7c..09370fa833 100644
--- a/src/image.c
+++ b/src/image.c
@@ -99,7 +99,7 @@ #define BLUE16_FROM_ULONG(color)	(BLUE_FROM_ULONG (color) * 0x101)
 					      Lisp_Object, unsigned long);
 #endif	/* USE_CAIRO */
 
-#ifdef HAVE_PGTK
+#if defined HAVE_PGTK && defined HAVE_IMAGEMAGICK
 /* On pgtk, we don't want to create scaled image.
  * If we create scaled image on scale=2.0 environment,
  * the created image is half size and Gdk scales it back,
@@ -2307,12 +2307,11 @@ compute_image_rotation (struct image *img, double *rotation)
 static void
 image_set_transform (struct frame *f, struct image *img)
 {
-# ifdef HAVE_IMAGEMAGICK
-#  ifndef DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE
+# if (defined HAVE_IMAGEMAGICK \
+      && !defined DONT_CREATE_TRANSFORMED_IMAGEMAGICK_IMAGE)
   /* ImageMagick images already have the correct transform.  */
   if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick))
     return;
-#  endif
 # endif
 
 # if !defined USE_CAIRO && defined HAVE_XRENDER
-- 
2.30.0