unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27597: [PATCH] fix warnings in src/xdisp.c
@ 2017-07-06 11:47 Alexander Kuleshov
  2017-07-08  8:19 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kuleshov @ 2017-07-06 11:47 UTC (permalink / raw)
  To: 27597

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

Hello,

here is simple fix for following warnings:

xdisp.c: In function ‘Fdump_glyph_matrix’:
xdisp.c:19320:20: error: format ‘%lld’ expects argument of type ‘long
long int’, but argument 3 has type ‘ptrdiff_t {aka long int}’
[-Werror=format=]
   fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",

from src/xdisp.c

[-- Attachment #2: 0001-use-pD-directives-for-ptrdiff_t-values-to-get-rid-fr.patch --]
[-- Type: text/x-patch, Size: 3662 bytes --]

From 82beb984aa4d5009d0535d41f2de41bf2992deb9 Mon Sep 17 00:00:00 2001
From: Alexander Kuleshov <kuleshovmail@gmail.com>
Date: Thu, 6 Jul 2017 17:39:51 +0600
Subject: [PATCH] use pD directives for ptrdiff_t values to get rid from
 warnings

  * src/xdisp.c: use pD directives for ptrdiff_t values instead of
pI
---
 src/xdisp.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 8bc5d81..95d3784 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -19083,7 +19083,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
       || glyph->type == GLYPHLESS_GLYPH)
     {
       fprintf (stderr,
-	       "  %5"pD"d     %c %9"pI"d   %c %3d 0x%06x      %c %4d %1.1d%1.1d\n",
+	       "  %5"pD"d     %c %9"pD"d   %c %3d 0x%06x      %c %4d %1.1d%1.1d\n",
 	       glyph - row->glyphs[TEXT_AREA],
 	       (glyph->type == CHAR_GLYPH
 		? 'C'
@@ -19108,7 +19108,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
   else if (glyph->type == STRETCH_GLYPH)
     {
       fprintf (stderr,
-	       "  %5"pD"d     %c %9"pI"d   %c %3d 0x%06x      %c %4d %1.1d%1.1d\n",
+	       "  %5"pD"d     %c %9"pD"d   %c %3d 0x%06x      %c %4d %1.1d%1.1d\n",
 	       glyph - row->glyphs[TEXT_AREA],
 	       'S',
 	       glyph->charpos,
@@ -19129,7 +19129,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
   else if (glyph->type == IMAGE_GLYPH)
     {
       fprintf (stderr,
-	       "  %5"pD"d     %c %9"pI"d   %c %3d 0x%06x      %c %4d %1.1d%1.1d\n",
+	       "  %5"pD"d     %c %9"pD"d   %c %3d 0x%06x      %c %4d %1.1d%1.1d\n",
 	       glyph - row->glyphs[TEXT_AREA],
 	       'I',
 	       glyph->charpos,
@@ -19150,7 +19150,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
   else if (glyph->type == COMPOSITE_GLYPH)
     {
       fprintf (stderr,
-	       "  %5"pD"d     %c %9"pI"d   %c %3d 0x%06x",
+	       "  %5"pD"d     %c %9"pD"d   %c %3d 0x%06x",
 	       glyph - row->glyphs[TEXT_AREA],
 	       '+',
 	       glyph->charpos,
@@ -19211,7 +19211,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
       fprintf (stderr, "Row     Start       End Used oE><\\CTZFesm     X    Y    W    H    V    A    P\n");
       fprintf (stderr, "==============================================================================\n");
 
-      fprintf (stderr, "%3d %9"pI"d %9"pI"d %4d %1.1d%1.1d%1.1d%1.1d\
+      fprintf (stderr, "%3d %9"pD"d %9"pD"d %4d %1.1d%1.1d%1.1d%1.1d\
 %1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d%1.1d  %4d %4d %4d %4d %4d %4d %4d\n",
 	       vpos,
 	       MATRIX_ROW_START_CHARPOS (row),
@@ -19240,7 +19240,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs)
       fprintf (stderr, "    %9"pD"d %9"pD"d\t%5d\n", row->start.overlay_string_index,
 	       row->end.overlay_string_index,
 	       row->continuation_lines_width);
-      fprintf (stderr, "    %9"pI"d %9"pI"d\n",
+      fprintf (stderr, "    %9"pD"d %9"pD"d\n",
 	       CHARPOS (row->start.string_pos),
 	       CHARPOS (row->end.string_pos));
       fprintf (stderr, "    %9d %9d\n", row->start.dpvec_index,
@@ -19317,7 +19317,7 @@ with numeric argument, its value is passed as the GLYPHS flag.  */)
   struct window *w = XWINDOW (selected_window);
   struct buffer *buffer = XBUFFER (w->contents);
 
-  fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",
+  fprintf (stderr, "PT = %"pD"d, BEGV = %"pD"d. ZV = %"pD"d\n",
 	   BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer));
   fprintf (stderr, "Cursor x = %d, y = %d, hpos = %d, vpos = %d\n",
 	   w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos);
-- 
2.9.0.GIT


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

* bug#27597: [PATCH] fix warnings in src/xdisp.c
  2017-07-06 11:47 bug#27597: [PATCH] fix warnings in src/xdisp.c Alexander Kuleshov
@ 2017-07-08  8:19 ` Eli Zaretskii
  2017-07-08 10:28   ` Alexander Kuleshov
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2017-07-08  8:19 UTC (permalink / raw)
  To: Alexander Kuleshov; +Cc: 27597-done

> From: Alexander Kuleshov <kuleshovmail@gmail.com>
> Date: Thu, 6 Jul 2017 17:47:03 +0600
> 
> here is simple fix for following warnings:
> 
> xdisp.c: In function ‘Fdump_glyph_matrix’:
> xdisp.c:19320:20: error: format ‘%lld’ expects argument of type ‘long
> long int’, but argument 3 has type ‘ptrdiff_t {aka long int}’
> [-Werror=format=]
>    fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",
> 
> from src/xdisp.c

Thanks, pushed to master.

In the future, please provide a commit log message that is according
to our coding standards:

 . mention the names of functions in which you make changes
 . start sentences with a capital letter
 . mention the bug number

Here's the log message I used in this case:

	* src/xdisp.c (dump_glyph, dump_glyph_row, Fdump_glyph_matrix):
	Use pD directives for ptrdiff_t values instead of pI, to avoid
	compilation warnings on 64-bit hosts.  (Bug#27597)






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

* bug#27597: [PATCH] fix warnings in src/xdisp.c
  2017-07-08  8:19 ` Eli Zaretskii
@ 2017-07-08 10:28   ` Alexander Kuleshov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Kuleshov @ 2017-07-08 10:28 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 27597-done

On Sat, Jul 8, 2017 at 2:19 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Alexander Kuleshov <kuleshovmail@gmail.com>
>> Date: Thu, 6 Jul 2017 17:47:03 +0600
>>
>> here is simple fix for following warnings:
>>
>> xdisp.c: In function ‘Fdump_glyph_matrix’:
>> xdisp.c:19320:20: error: format ‘%lld’ expects argument of type ‘long
>> long int’, but argument 3 has type ‘ptrdiff_t {aka long int}’
>> [-Werror=format=]
>>    fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n",
>>
>> from src/xdisp.c
>
> Thanks, pushed to master.
>
> In the future, please provide a commit log message that is according
> to our coding standards:
>
>  . mention the names of functions in which you make changes
>  . start sentences with a capital letter
>  . mention the bug number
>
> Here's the log message I used in this case:
>
>         * src/xdisp.c (dump_glyph, dump_glyph_row, Fdump_glyph_matrix):
>         Use pD directives for ptrdiff_t values instead of pI, to avoid
>         compilation warnings on 64-bit hosts.  (Bug#27597)
>

Hello Eli,

Yes, thanks, I'll take into account code style next time.





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

end of thread, other threads:[~2017-07-08 10:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 11:47 bug#27597: [PATCH] fix warnings in src/xdisp.c Alexander Kuleshov
2017-07-08  8:19 ` Eli Zaretskii
2017-07-08 10:28   ` Alexander Kuleshov

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