2017-09-15 11:12 GMT+02:00 Eli Zaretskii : > > From: Fabrice Popineau > > Date: Fri, 15 Sep 2017 08:55:06 +0200 > > Cc: Emacs developers > > > > # define pDWP "16llx" > > ^ > > > > Should these be using the ptrdiff_t formatter pD from lisp.h ? > > > > I'd rather cast the values to "long long unsigned int" as these values > are assumed to be positive, > > and would be meaningless if printed in decimal. > > That's what I did. > > That's ok and no more warnings now. > > There are also a bunch of warnings in dispnew.c:adjust_glyph_matrix() > > because the w parameter could be NULL. Actually, some parts of the code > > are protected with if (w) { ... } but much more than those ones assume > that > > w is not NULL. > > That's because they really cannot be NULL at that point. GCC 7 > doesn't really understand the code, so it shouldn't emit these > warnings, if it wants them to be useful. > > > I wonder if the whole function should not just return if w is NULL. > > No! Ok. I see your eassert() added at this point. But clearly there is a problem with GCC 7, because it doesn't understand the implications of this eassert() : CC dispnew.o ../../emacs/src/dispnew.c: In function 'adjust_frame_glyphs': ../../emacs/src/dispnew.c:392:14: warning: null pointer dereference [-Wnull-dereference] left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_cols); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/dispnew.c:322:11: warning: null pointer dereference [-Wnull-dereference] int width = w->total_cols; ^~~~~ ../../emacs/src/dispnew.c:393:15: warning: null pointer dereference [-Wnull-dereference] right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_cols); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/dispnew.c:322:11: warning: null pointer dereference [-Wnull-dereference] int width = w->total_cols; ^~~~~ In file included from ../../emacs/src/frame.h:23:0, from ../../emacs/src/dispnew.c:34: ../../emacs/src/window.h:651:38: warning: null pointer dereference [-Wnull-dereference] #define WINDOW_LEFT_PIXEL_EDGE(W) (W)->pixel_left ~~~^~~ ../../emacs/src/dispnew.c:401:36: note: in expansion of macro 'WINDOW_LEFT_PIXEL_EDGE' && matrix->window_pixel_left == WINDOW_LEFT_PIXEL_EDGE (w) ^~~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/window.h:660:37: warning: null pointer dereference [-Wnull-dereference] #define WINDOW_TOP_PIXEL_EDGE(W) (W)->pixel_top ~~~^~~ ../../emacs/src/dispnew.c:402:35: note: in expansion of macro 'WINDOW_TOP_PIXEL_EDGE' && matrix->window_pixel_top == WINDOW_TOP_PIXEL_EDGE (w) ^~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/dispnew.c:404:34: warning: null pointer dereference [-Wnull-dereference] && matrix->window_vscroll == w->vscroll ~^~~~~~~~~ ../../emacs/src/dispnew.c:392:14: warning: null pointer dereference [-Wnull-dereference] left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_cols); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/dispnew.c:322:11: warning: null pointer dereference [-Wnull-dereference] int width = w->total_cols; ^~~~~ ../../emacs/src/dispnew.c:393:15: warning: null pointer dereference [-Wnull-dereference] right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_cols); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/dispnew.c:322:11: warning: null pointer dereference [-Wnull-dereference] int width = w->total_cols; ^~~~~ In file included from ../../emacs/src/frame.h:23:0, from ../../emacs/src/dispnew.c:34: ../../emacs/src/window.h:651:38: warning: null pointer dereference [-Wnull-dereference] #define WINDOW_LEFT_PIXEL_EDGE(W) (W)->pixel_left ~~~^~~ ../../emacs/src/dispnew.c:401:36: note: in expansion of macro 'WINDOW_LEFT_PIXEL_EDGE' && matrix->window_pixel_left == WINDOW_LEFT_PIXEL_EDGE (w) ^~~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/window.h:660:37: warning: null pointer dereference [-Wnull-dereference] #define WINDOW_TOP_PIXEL_EDGE(W) (W)->pixel_top ~~~^~~ ../../emacs/src/dispnew.c:402:35: note: in expansion of macro 'WINDOW_TOP_PIXEL_EDGE' && matrix->window_pixel_top == WINDOW_TOP_PIXEL_EDGE (w) ^~~~~~~~~~~~~~~~~~~~~ ../../emacs/src/dispnew.c:404:34: warning: null pointer dereference [-Wnull-dereference] && matrix->window_vscroll == w->vscroll ~^~~~~~~~~ cc1.exe: warning: null pointer dereference [-Wnull-dereference] cc1.exe: warning: null pointer dereference [-Wnull-dereference] -- Fabrice