[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master updated (05b7953 -> b2b1ccb)
From: |
Alex Gramiak |
Subject: |
Re: [Emacs-diffs] master updated (05b7953 -> b2b1ccb) |
Date: |
Mon, 20 May 2019 12:47:07 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
Lars Ingebrigtsen <address@hidden> writes:
> This patch series seems to introduce the following warnings?
>
> xdisp.c: In function ‘normal_char_ascent_descent’:
> xdisp.c:26433:13: warning: potential null pointer dereference
> [-Wnull-dereference]
> if (!(pcm->width == 0 && pcm->rbearing == 0 && pcm->lbearing == 0))
> ~~~^~~~~~~
> xdisp.c: In function ‘gui_produce_glyphs’:
> xdisp.c:28482:15: warning: potential null pointer dereference
> [-Wnull-dereference]
> if (pcm->width == 0
> ~~~^~~~~~~
> xdisp.c:28745:16: warning: potential null pointer dereference
> [-Wnull-dereference]
> if (pcm->width == 0
> ~~~^~~~~~~
Hmm, this is weird: the warnings seem to be legitimate
(get_per_char_metric can return NULL), but I don't see how my patch
would _introduce_ these warnings.
Also, I don't get these warnings; what's your compiler version? If it's
GCC 9, perhaps the warning detection has improved. I don't suppose you
happened to update your compiler at the same time as updating your local
branch?
It's good to plug these anyway, but it would be nice to figure out why
they're only popping up now.
The below diff should silence the warnings.
diff --git a/src/xdisp.c b/src/xdisp.c
index c561ea9e36..ca95f8f944 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -26430,7 +26430,10 @@ normal_char_ascent_descent (struct font *font, int c,
int *ascent, int *descent)
{
struct font_metrics *pcm = get_per_char_metric (font, &char2b);
- if (!(pcm->width == 0 && pcm->rbearing == 0 && pcm->lbearing == 0))
+ if (!(pcm
+ && pcm->width == 0
+ && pcm->rbearing == 0
+ && pcm->lbearing == 0))
{
/* We add 1 pixel to character dimensions as heuristics
that produces nicer display, e.g. when the face has
@@ -28479,8 +28482,10 @@ gui_produce_glyphs (struct it *it)
if (get_char_glyph_code (it->char_to_display, font, &char2b))
{
pcm = get_per_char_metric (font, &char2b);
- if (pcm->width == 0
- && pcm->rbearing == 0 && pcm->lbearing == 0)
+ if (pcm
+ && pcm->width == 0
+ && pcm->rbearing == 0
+ && pcm->lbearing == 0)
pcm = NULL;
}
@@ -28742,8 +28747,10 @@ gui_produce_glyphs (struct it *it)
if (get_char_glyph_code (' ', font, &char2b))
{
pcm = get_per_char_metric (font, &char2b);
- if (pcm->width == 0
- && pcm->rbearing == 0 && pcm->lbearing == 0)
+ if (pcm
+ && pcm->width == 0
+ && pcm->rbearing == 0
+ && pcm->lbearing == 0)
pcm = NULL;
}
- [Emacs-diffs] master updated (05b7953 -> b2b1ccb), Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master 44d5779 3/7: Introduce Emacs_Pixmap typedef, Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master 462b1fd 4/7: Introduce Emacs_Rectangle struct and typedef, Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master 06db2a0 2/7: Introduce Emacs_Cursor typedef, Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master b3d3c0d 5/7: Introduce Emacs_GC struct and typedef, Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master a4fe9c7 6/7: Replace XChar2b with unsigned in all font backends, Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master c0e146e 1/7: Introduce Emacs_Color struct and typedef, Alexander Gramiak, 2019/05/19
- [Emacs-diffs] master b2b1ccb 7/7: Introduce Emacs_Pix_Container and Emacs_Pix_Context typedefs, Alexander Gramiak, 2019/05/19
- Re: [Emacs-diffs] master updated (05b7953 -> b2b1ccb), Lars Ingebrigtsen, 2019/05/20
- Re: [Emacs-diffs] master updated (05b7953 -> b2b1ccb),
Alex Gramiak <=