[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New warning
From: |
Eshel Yaron |
Subject: |
Re: New warning |
Date: |
Tue, 06 Jun 2023 18:59:14 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Po Lu <luangruo@yahoo.com> writes:
> Since a previous commit, I get:
>
> ../../emacs/src/window.c: In function ‘window_wants_header_line’:
> ../../emacs/src/window.c:5546:19: warning: potential null pointer dereference
> [-Wnull-dereference]
> 5546 | || !null_header_line_format (BVAR (XBUFFER
> (WINDOW_BUFFER (w)),
> |
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 5547 | header_line_format),
> f))
> |
> ~~~~~~~~~~~~~~~~~~~~~~~
>
> Would someone please look into this?
> Thanks.
Hmm, clang doesn't emit this warning (and I didn't try compiling with
gcc before submitting that patch, sorry about that).
The following seems to silence this warning with gcc 13.1, but I'm not
sure I fully understand why/when WINDOW_BUFFER might return NULL, so I'm
not sure it's the right thing to do... Any insights?
diff --git a/src/window.c b/src/window.c
index 81578375498..644fcab9d04 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5540,6 +5540,7 @@ window_wants_header_line (struct window *w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_header_line_format, Qnone)
&& (!null_header_line_format (window_header_line_format, f)
+ || !WINDOW_BUFFER (w)
|| !null_header_line_format (BVAR (XBUFFER (WINDOW_BUFFER (w)),
header_line_format), f))
&& (WINDOW_PIXEL_HEIGHT (w)
- New warning, Po Lu, 2023/06/06
- Re: New warning,
Eshel Yaron <=