all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] * image.c: Fix compiler warning due to missing const
@ 2015-09-10  3:38 Mitchel Humpherys
  2015-09-10  9:52 ` Paul Eggert
  0 siblings, 1 reply; 7+ messages in thread
From: Mitchel Humpherys @ 2015-09-10  3:38 UTC (permalink / raw)
  To: emacs-devel; +Cc: Mitchel Humpherys

The `GifErrorString' function from gif_lib has returned a `const char *'
since gif_lib commit [95f5da16b9a134e5706d54e8725413625c3b745d:
"Compiler waening cleanup."].  We currently store the return value in a
`char *', which results in the following compiler warning:

    image.c: In function ‘gif_load’:
    image.c:7984:26: warning: initialization discards ‘const’ qualifier from \
       pointer target type [-Wdiscarded-qualifiers]
           char *error_text = GifErrorString (gif_err);
                              ^

Fix this.
---
 src/image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/image.c b/src/image.c
index 85cf801f6a..f9d0df7626 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7981,7 +7981,7 @@ gif_load (struct frame *f, struct image *img)
   if (gif_close (gif, &gif_err) == GIF_ERROR)
     {
 #if 5 <= GIFLIB_MAJOR
-      char *error_text = GifErrorString (gif_err);
+      const char *error_text = GifErrorString (gif_err);
 
       if (error_text)
 	image_error ("Error closing `%s': %s",
-- 
2.5.1




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

* Re: [PATCH] * image.c: Fix compiler warning due to missing const
  2015-09-10  3:38 [PATCH] * image.c: Fix compiler warning due to missing const Mitchel Humpherys
@ 2015-09-10  9:52 ` Paul Eggert
  2015-09-10 15:38   ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2015-09-10  9:52 UTC (permalink / raw)
  To: Mitchel Humpherys, emacs-devel

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

Thanks for the bug reports.  I installed patches that should address the two 
issues you raised, though not quite in the ways you suggested.  GIFLIB before 
5.1 has problems with GifErrorString's signature; a simple workaround is to 
avoid using GifErrorString in GIFLIB 5.0.x.  Please see:

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6ee7eabb5dbdf39f2d7471c9e42fc90c315e6a9f

http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f962c5d6472804f788cdd54631bcc46aab5f59ce

[-- Attachment #2: 0001-Port-to-GIFLIB-5.0.6-and-later.patch --]
[-- Type: text/x-diff, Size: 3453 bytes --]

From 6db8d94a896ceef473b8883ab4252778163b8f51 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 10 Sep 2015 02:39:13 -0700
Subject: [PATCH 1/2] Port to GIFLIB 5.0.6 and later

Problem reported by Mitchel Humpherys in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00420.html
* src/image.c (HAVE_GIFERRORSTRING) [HAVE_GIF]: New macro.
(GifErrorString, init_gif_functions) [HAVE_GIF && WINDOWSNT]:
(gif_load) [HAVE_GIF]: Use it.
---
 src/image.c | 38 ++++++++++++++++++++++----------------
 1 file changed, 22 insertions(+), 16 deletions(-)

diff --git a/src/image.c b/src/image.c
index 85cf801..2aa01e4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7499,6 +7499,12 @@ gif_image_p (Lisp_Object object)
 #  define GIFLIB_MAJOR 4
 # endif
 
+/* GifErrorString is declared to return char const * when GIFLIB_MAJOR
+   and GIFLIB_MINOR indicate 5.1 or later.  Do not bother using it in
+   earlier releases, where either it returns char * or GIFLIB_MINOR
+   may be incorrect.  */
+# define HAVE_GIFERRORSTRING (5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR))
+
 # ifdef WINDOWSNT
 
 /* GIF library details.  */
@@ -7514,7 +7520,9 @@ DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *));
 #  else
 DEF_DLL_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
 DEF_DLL_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
-DEF_DLL_FN (char *, GifErrorString, (int));
+#  endif
+#  if HAVE_GIFERRORSTRING
+DEF_DLL_FN (char const *, GifErrorString, (int));
 #  endif
 
 static bool
@@ -7529,7 +7537,7 @@ init_gif_functions (void)
   LOAD_DLL_FN (library, DGifSlurp);
   LOAD_DLL_FN (library, DGifOpen);
   LOAD_DLL_FN (library, DGifOpenFileName);
-#  if GIFLIB_MAJOR >= 5
+#  if HAVE_GIFERRORSTRING
   LOAD_DLL_FN (library, GifErrorString);
 #  endif
   return 1;
@@ -7641,20 +7649,19 @@ gif_load (struct frame *f, struct image *img)
       /* Open the GIF file.  */
 #if GIFLIB_MAJOR < 5
       gif = DGifOpenFileName (SSDATA (encoded_file));
-      if (gif == NULL)
-	{
-	  image_error ("Cannot open `%s'", file);
-	  return 0;
-	}
 #else
       gif = DGifOpenFileName (SSDATA (encoded_file), &gif_err);
+#endif
       if (gif == NULL)
 	{
+#if HAVE_GIFERRORSTRING
 	  image_error ("Cannot open `%s': %s",
 		       file, build_string (GifErrorString (gif_err)));
+#else
+	  image_error ("Cannot open `%s'", file);
+#endif
 	  return 0;
 	}
-#endif
     }
   else
     {
@@ -7672,20 +7679,19 @@ gif_load (struct frame *f, struct image *img)
 
 #if GIFLIB_MAJOR < 5
       gif = DGifOpen (&memsrc, gif_read_from_memory);
-      if (!gif)
-	{
-	  image_error ("Cannot open memory source `%s'", img->spec);
-	  return 0;
-	}
 #else
       gif = DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
+#endif
       if (!gif)
 	{
+#if HAVE_GIFERRORSTRING
 	  image_error ("Cannot open memory source `%s': %s",
 		       img->spec, build_string (GifErrorString (gif_err)));
+#else
+	  image_error ("Cannot open memory source `%s'", img->spec);
+#endif
 	  return 0;
 	}
-#endif
     }
 
   /* Before reading entire contents, check the declared image size. */
@@ -7980,8 +7986,8 @@ gif_load (struct frame *f, struct image *img)
 
   if (gif_close (gif, &gif_err) == GIF_ERROR)
     {
-#if 5 <= GIFLIB_MAJOR
-      char *error_text = GifErrorString (gif_err);
+#if HAVE_GIFERRORSTRING
+      char const *error_text = GifErrorString (gif_err);
 
       if (error_text)
 	image_error ("Error closing `%s': %s",
-- 
2.1.0


[-- Attachment #3: 0002-Add-patch-sending-instructions-to-git-workflow.patch --]
[-- Type: text/x-diff, Size: 1379 bytes --]

From 556a16fc5dd9996460fea9d7ff7df281723b3ff6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 10 Sep 2015 02:43:59 -0700
Subject: [PATCH 2/2] Add patch-sending instructions to git-workflow

From a suggestion by Mitchel Humpherys in:
http://lists.gnu.org/archive/html/emacs-devel/2015-09/msg00421.html
* admin/notes/git-workflow (Sending patches): New section.
---
 admin/notes/git-workflow | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/admin/notes/git-workflow b/admin/notes/git-workflow
index d1d105a..40dfa6b 100644
--- a/admin/notes/git-workflow
+++ b/admin/notes/git-workflow
@@ -46,6 +46,24 @@ top of that.  Then say
 git push
 
 
+Sending patches
+===============
+
+If you lack push access or would like feedback before pushing a patch,
+you can send a patch file as a bug report.  After committing your
+change locally, do:
+
+git format-patch -1
+
+This creates a file 0001-DESCRIPTION.patch containing the patch, where
+DESCRIPTION comes from the first line of your patch's commit message.
+You can attach the patch file to email that you send to
+bug-gnu-emacs@gnu.org.  You can also configure git to email patches
+directly (see <http://git-scm.com/docs/git-send-email>) and do:
+
+git send-email --to=bug-gnu-emacs@gnu.org 0001-DESCRIPTION.patch
+
+
 Backporting to emacs-24
 =======================
 
-- 
2.1.0


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

* Re: [PATCH] * image.c: Fix compiler warning due to missing const
  2015-09-10  9:52 ` Paul Eggert
@ 2015-09-10 15:38   ` Eli Zaretskii
  2015-09-10 15:49     ` Mitchel Humpherys
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2015-09-10 15:38 UTC (permalink / raw)
  To: Paul Eggert; +Cc: mitch.special, emacs-devel

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Thu, 10 Sep 2015 02:52:05 -0700
> 
> Thanks for the bug reports.  I installed patches that should address the two 
> issues you raised, though not quite in the ways you suggested.  GIFLIB before 
> 5.1 has problems with GifErrorString's signature; a simple workaround is to 
> avoid using GifErrorString in GIFLIB 5.0.x.  Please see:
> 
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=6ee7eabb5dbdf39f2d7471c9e42fc90c315e6a9f
> 
> http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=f962c5d6472804f788cdd54631bcc46aab5f59ce

Thanks, but I don't really know why we keep maintaining
admin/git-workflow.  The instructions should be in CONTRIBUTE (and in
this case, it already mentions "git format-patch").



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

* Re: [PATCH] * image.c: Fix compiler warning due to missing const
  2015-09-10 15:38   ` Eli Zaretskii
@ 2015-09-10 15:49     ` Mitchel Humpherys
  2015-09-10 15:58       ` Eli Zaretskii
  2015-09-10 18:25       ` Paul Eggert
  0 siblings, 2 replies; 7+ messages in thread
From: Mitchel Humpherys @ 2015-09-10 15:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Paul Eggert, emacs-devel

On Thu, Sep 10 2015 at 06:38:20 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> Thanks, but I don't really know why we keep maintaining
> admin/git-workflow.  The instructions should be in CONTRIBUTE (and in
> this case, it already mentions "git format-patch").

Yes, but CONTRIBUTE doesn't mention which mailing list you should send
it to (emacs-devel, emacs-diffs, something else?) and it doesn't mention
`git send-email' at all.  It seems to cater more to frequent
contributors, who arguably don't need the instructions to begin with...

-- 
Mitch



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

* Re: [PATCH] * image.c: Fix compiler warning due to missing const
  2015-09-10 15:49     ` Mitchel Humpherys
@ 2015-09-10 15:58       ` Eli Zaretskii
  2015-09-10 18:25       ` Paul Eggert
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2015-09-10 15:58 UTC (permalink / raw)
  To: Mitchel Humpherys; +Cc: eggert, emacs-devel

> From: Mitchel Humpherys <mitch.special@gmail.com>
> Cc: Paul Eggert <eggert@cs.ucla.edu>,  emacs-devel@gnu.org
> Date: Thu, 10 Sep 2015 08:49:00 -0700
> 
> On Thu, Sep 10 2015 at 06:38:20 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> > Thanks, but I don't really know why we keep maintaining
> > admin/git-workflow.  The instructions should be in CONTRIBUTE (and in
> > this case, it already mentions "git format-patch").
> 
> Yes, but CONTRIBUTE doesn't mention which mailing list you should send
> it to (emacs-devel, emacs-diffs, something else?) and it doesn't mention
> `git send-email' at all.

Patches to fix that are welcome, TIA.

> It seems to cater more to frequent contributors, who arguably don't
> need the instructions to begin with...

No, it's for those who do need them.  IOW, for everyone, and first and
foremost the _in_frequent contributors.



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

* Re: [PATCH] * image.c: Fix compiler warning due to missing const
  2015-09-10 15:49     ` Mitchel Humpherys
  2015-09-10 15:58       ` Eli Zaretskii
@ 2015-09-10 18:25       ` Paul Eggert
  2015-09-10 18:56         ` Eli Zaretskii
  1 sibling, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2015-09-10 18:25 UTC (permalink / raw)
  To: Mitchel Humpherys, Eli Zaretskii, Glenn Morris; +Cc: emacs-devel

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

Mitchel Humpherys wrote:

> CONTRIBUTE doesn't mention which mailing list you should send it to

Actually, it says to send fixes to bug-gnu-emacs@gnu.org.

> it doesn't mention `git send-email'

Fixed with the attached patch.

Glenn Morris wrote:
 > Paul Eggert wrote:
 >
 >> +git send-email --to=bug-gnu-emacs@gnu.org 0001-DESCRIPTION.patch
 >
 > I would like to discourage this usage because when there's more than one
 > patch in a sequence, it will create a separate report for each.
 > (http://debbugs.gnu.org/15361)

The attached patch changes CONTRIBUTE to suggest git send-email only with single 
patch files.  If we fix the bug-reporting mechanism to handle multiple patch 
files, we can update CONTRIBUTE accordingly.

Eli Zaretskii wrote:
 > I don't really know why we keep maintaining admin/git-workflow.

I don't know either.  Anyway, the attached patch tries to lessen the maintenance 
burden by having git-worflow defer to CONTRIBUTE here.

[-- Attachment #2: 0001-CONTRIBUTE-Move-send-email-here-from-git-workflow.patch --]
[-- Type: text/x-diff, Size: 1927 bytes --]

From fa7f8cfe28a7b5bcca607f316d16322af17d206e Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 10 Sep 2015 11:21:17 -0700
Subject: [PATCH] * CONTRIBUTE: Move send-email here from git-workflow.

---
 CONTRIBUTE               |  4 +++-
 admin/notes/git-workflow | 14 ++------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/CONTRIBUTE b/CONTRIBUTE
index 7e697dd..5821ee5 100644
--- a/CONTRIBUTE
+++ b/CONTRIBUTE
@@ -234,7 +234,9 @@ by following links from http://savannah.gnu.org/mail/?group=emacs .
 
 To email a patch you can use a shell command like 'git format-patch -1'
 to create a file, and then attach the file to your email.  This nicely
-packages the patch's commit message and changes.
+packages the patch's commit message and changes.  To send just one
+such patch without additional remarks, you can use a command like
+'git send-email --to=bug-gnu-emacs@gnu.org 0001-DESCRIPTION.patch'.
 
 ** Document your changes.
 
diff --git a/admin/notes/git-workflow b/admin/notes/git-workflow
index 40dfa6b..92dc791 100644
--- a/admin/notes/git-workflow
+++ b/admin/notes/git-workflow
@@ -50,18 +50,8 @@ Sending patches
 ===============
 
 If you lack push access or would like feedback before pushing a patch,
-you can send a patch file as a bug report.  After committing your
-change locally, do:
-
-git format-patch -1
-
-This creates a file 0001-DESCRIPTION.patch containing the patch, where
-DESCRIPTION comes from the first line of your patch's commit message.
-You can attach the patch file to email that you send to
-bug-gnu-emacs@gnu.org.  You can also configure git to email patches
-directly (see <http://git-scm.com/docs/git-send-email>) and do:
-
-git send-email --to=bug-gnu-emacs@gnu.org 0001-DESCRIPTION.patch
+you commit your change locally and then send a patch file as a bug report
+as described in ../../CONTRIBUTE.
 
 
 Backporting to emacs-24
-- 
2.1.0


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

* Re: [PATCH] * image.c: Fix compiler warning due to missing const
  2015-09-10 18:25       ` Paul Eggert
@ 2015-09-10 18:56         ` Eli Zaretskii
  0 siblings, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2015-09-10 18:56 UTC (permalink / raw)
  To: Paul Eggert; +Cc: mitch.special, rgm, emacs-devel

> Cc: emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Thu, 10 Sep 2015 11:25:20 -0700
> 
> Eli Zaretskii wrote:
>  > I don't really know why we keep maintaining admin/git-workflow.
> 
> I don't know either.  Anyway, the attached patch tries to lessen the maintenance 
> burden by having git-worflow defer to CONTRIBUTE here.

Thanks.



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

end of thread, other threads:[~2015-09-10 18:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-10  3:38 [PATCH] * image.c: Fix compiler warning due to missing const Mitchel Humpherys
2015-09-10  9:52 ` Paul Eggert
2015-09-10 15:38   ` Eli Zaretskii
2015-09-10 15:49     ` Mitchel Humpherys
2015-09-10 15:58       ` Eli Zaretskii
2015-09-10 18:25       ` Paul Eggert
2015-09-10 18:56         ` 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.