unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* PIXEL_ALREADY_TYPEDEFED
@ 2016-06-14 14:09 Ken Brown
  2016-06-14 15:11 ` PIXEL_ALREADY_TYPEDEFED Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Ken Brown @ 2016-06-14 14:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Emacs

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

Eli,

To get rid of an "unused macro" warning in the Cygwin-w32 build, I want 
to remove the definition of PIXEL_ALREADY_TYPEDEFED from image.c.  (It's 
defined in simx.h, which is included by xpm.h, on Cygwin.)  In the 
course of doing this, I decided to do some cleanup that you suggested in 
the discussion of bug#18302.  See the attached patch, not yet installed.

Question: Should PIXEL_ALREADY_TYPEDEFED be removed unconditionally, or 
is it needed in the MinGW build?

Ken

[-- Attachment #2: 0001-Remove-system-specific-I-switch-from-Cygwin-w32-buil.patch --]
[-- Type: text/plain, Size: 2827 bytes --]

From 1b9f2aa93e2d8d024a1d0ec0b3b9227a99f017e2 Mon Sep 17 00:00:00 2001
From: Ken Brown <kbrown@cornell.edu>
Date: Tue, 14 Jun 2016 09:50:38 -0400
Subject: [PATCH] Remove system-specific -I switch from Cygwin-w32 build

Suggested by Eli Zaretskii in discussion of bug#18302.

* src/image.c [CYGWIN && HAVE_NTGUI]: Include "noX/xpm.h" instead
of "X11/xpm.h".  Remove the unused macro PIXEL_ALREADY_TYPEDEFED.

* configure.ac [CYGWIN && HAVE_W32]: Change the xpm test accordingly.
Don't add a -I switch to CPPFLAGS.
---
 configure.ac | 13 ++++---------
 src/image.c  |  8 ++++++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/configure.ac b/configure.ac
index 069a726..2674806 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3245,34 +3245,29 @@ AC_DEFUN
 
 ### Use -lXpm if available, unless '--with-xpm=no'.
 ### mingw32 doesn't use -lXpm, since it loads the library dynamically.
-### In the Cygwin-w32 build, we need to use /usr/include/noX/X11/xpm.h
-### rather than /usr/include/X11/xpm.h, so we set CPPFLAGS (and
-### LDFLAGS) accordingly.
+### The Cygwin-w32 build uses <noX/xpm.h> instead of <X11/xpm.h>, so
+### we need to set LDFLAGS accordingly.
 HAVE_XPM=no
 LIBXPM=
 if test "${HAVE_W32}" = "yes" && test "${opsys}" = "cygwin"; then
   if test "${with_xpm}" != "no"; then
-    SAVE_CPPFLAGS="$CPPFLAGS"
     SAVE_LDFLAGS="$LDFLAGS"
-    CPPFLAGS="$CPPFLAGS -I/usr/include/noX"
     LDFLAGS="$LDFLAGS -L/usr/lib/noX"
-    AC_CHECK_HEADER(X11/xpm.h,
+    AC_CHECK_HEADER(noX/xpm.h,
       [AC_CHECK_LIB(Xpm, XpmReadFileToImage, HAVE_XPM=yes)])
     if test "${HAVE_XPM}" = "yes"; then
       AC_MSG_CHECKING(for XpmReturnAllocPixels preprocessor define)
       AC_EGREP_CPP(no_return_alloc_pixels,
-      [#include "X11/xpm.h"
+      [#include "noX/xpm.h"
 #ifndef XpmReturnAllocPixels
 no_return_alloc_pixels
 #endif
       ], HAVE_XPM=no, HAVE_XPM=yes)
 
       if test "${HAVE_XPM}" = "yes"; then
-        REAL_CPPFLAGS="$REAL_CPPFLAGS -I/usr/include/noX"
 	AC_MSG_RESULT(yes)
       else
 	AC_MSG_RESULT(no)
-        CPPFLAGS="$SAVE_CPPFLAGS"
         LDFLAGS="$SAVE_LDFLAGS"
       fi
     fi
diff --git a/src/image.c b/src/image.c
index 38866e0..8d33c6d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3159,16 +3159,20 @@ static bool xpm_load (struct frame *f, struct image *img);
 #define XColor xpm_XColor
 #define XImage xpm_XImage
 #define Display xpm_Display
+#ifdef CYGWIN
+#include "noX/xpm.h"
+#else  /* not CYGWIN */
 #define PIXEL_ALREADY_TYPEDEFED
 #include "X11/xpm.h"
+#endif	/* not CYGWIN */
 #undef FOR_MSW
 #undef XColor
 #undef XImage
 #undef Display
 #undef PIXEL_ALREADY_TYPEDEFED
-#else
+#else  /* not HAVE_NTGUI */
 #include "X11/xpm.h"
-#endif /* HAVE_NTGUI */
+#endif /* not HAVE_NTGUI */
 #endif /* HAVE_XPM */
 
 #if defined (HAVE_XPM) || defined (HAVE_NS)
-- 
2.8.3


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

* Re: PIXEL_ALREADY_TYPEDEFED
  2016-06-14 14:09 PIXEL_ALREADY_TYPEDEFED Ken Brown
@ 2016-06-14 15:11 ` Eli Zaretskii
  2016-06-14 17:50   ` PIXEL_ALREADY_TYPEDEFED Ken Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2016-06-14 15:11 UTC (permalink / raw)
  To: Ken Brown; +Cc: emacs-devel

> Cc: Emacs <emacs-devel@gnu.org>
> From: Ken Brown <kbrown@cornell.edu>
> Date: Tue, 14 Jun 2016 10:09:27 -0400
> 
> To get rid of an "unused macro" warning in the Cygwin-w32 build, I want 
> to remove the definition of PIXEL_ALREADY_TYPEDEFED from image.c.  (It's 
> defined in simx.h, which is included by xpm.h, on Cygwin.)  In the 
> course of doing this, I decided to do some cleanup that you suggested in 
> the discussion of bug#18302.  See the attached patch, not yet installed.

Fine with me, it's a Cygwin-only change.

> Question: Should PIXEL_ALREADY_TYPEDEFED be removed unconditionally, or 
> is it needed in the MinGW build?

Deleting it causes no trouble with the version of libXpm headers I
have here (3.5.11), but I hope it won't give trouble to other
versions.  Let's remove it and see if someone hollers.

Thanks.



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

* Re: PIXEL_ALREADY_TYPEDEFED
  2016-06-14 15:11 ` PIXEL_ALREADY_TYPEDEFED Eli Zaretskii
@ 2016-06-14 17:50   ` Ken Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Ken Brown @ 2016-06-14 17:50 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On 6/14/2016 11:11 AM, Eli Zaretskii wrote:
>> From: Ken Brown <kbrown@cornell.edu>
>> Question: Should PIXEL_ALREADY_TYPEDEFED be removed unconditionally, or
>> is it needed in the MinGW build?
>
> Deleting it causes no trouble with the version of libXpm headers I
> have here (3.5.11), but I hope it won't give trouble to other
> versions.  Let's remove it and see if someone hollers.

Done as commit 61cfd6a.




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

end of thread, other threads:[~2016-06-14 17:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-14 14:09 PIXEL_ALREADY_TYPEDEFED Ken Brown
2016-06-14 15:11 ` PIXEL_ALREADY_TYPEDEFED Eli Zaretskii
2016-06-14 17:50   ` PIXEL_ALREADY_TYPEDEFED Ken Brown

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).