From 9d6026d8ec1ac503c1f08c036b0fa8afd3533b21 Mon Sep 17 00:00:00 2001 From: Aurelien Aptel Date: Fri, 30 Sep 2016 14:00:51 +0200 Subject: [PATCH 1/3] * src/alloc.c: call only non-null finalizers --- src/alloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/alloc.c b/src/alloc.c index 45234474a27..f33d93f83b4 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6899,7 +6899,8 @@ sweep_misc (void) else if (mblk->markers[i].m.u_any.type == Lisp_Misc_User_Ptr) { struct Lisp_User_Ptr *uptr = &mblk->markers[i].m.u_user_ptr; - uptr->finalizer (uptr->p); + if (uptr->finalizer) + uptr->finalizer (uptr->p); } #endif /* Set the type of the freed object to Lisp_Misc_Free. From 4ef9ea2b2ad0db53d674ce6c691b605d894ae558 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Tue, 4 Oct 2016 14:47:43 -0700 Subject: [PATCH 2/3] Add documentation note from Alex --- doc/misc/cc-mode.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 459369ed9c4..30b750ac03a 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi @@ -2553,7 +2553,9 @@ for C code in GNU programs. @item k&r @cindex K&R style -The classic Kernighan and Ritchie style for C code. +The classic Kernighan and Ritchie style for C code. If you're looking +for the style used in the 2nd edition of their book ``The C +Programming Language'', then check out the @code{stroustrup} style. @item bsd @cindex BSD style From 34b6df19a4dafe0227ab663c971079e68e17f393 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 6 Oct 2016 18:08:31 +0300 Subject: [PATCH 3/3] Fix compilation with MinGW runtime 3.22.2 and w32api 3.18.2 * nt/inc/ms-w32.h (_WIN32_WINNT) [!MINGW_W64]: Undefine before defining to avoid redefinition warnings. * nt/inc/sys/stat.h (_SYS_STAT_H, _INC_STAT_H): Define, to avoid inclusion of sys/stat.h from the system headers, which could then lead to compilation errors due to redefinition of 'struct stat' etc. This is needed because latest versions of MinGW runtime include sys/stat.h from wchar.h. * src/image.c (__MINGW_MAJOR_VERSION) [WINDOWSNT]: Temporarily redefine to 4 to avoid conflict between 2 definitions of MemoryBarrier. (Bug#24613) Do not merge to master! --- nt/inc/ms-w32.h | 1 + nt/inc/sys/stat.h | 8 ++++++++ src/image.c | 17 +++++++++++++++++ 3 files changed, 26 insertions(+) diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index d1534336c49..b4eb5622242 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -146,6 +146,7 @@ extern char *getenv (); in its system headers, and is not really compatible with values lower than 0x0500, so leave it alone. */ #ifndef MINGW_W64 +# undef _WIN32_WINNT # define _WIN32_WINNT 0x0400 #endif diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h index 45bc2ea1e0c..ea14f075471 100644 --- a/nt/inc/sys/stat.h +++ b/nt/inc/sys/stat.h @@ -30,6 +30,14 @@ along with GNU Emacs. If not, see . */ # define __MINGW_NOTHROW #endif +/* Prevent the MinGW stat.h header from being included, ever. */ +#ifndef _SYS_STAT_H +# define _SYS_STAT_H +#endif +#ifndef _INC_STAT_H +# define _INC_STAT_H +#endif + #include #include diff --git a/src/image.c b/src/image.c index a85d5149e7e..78539d91d2b 100644 --- a/src/image.c +++ b/src/image.c @@ -8994,10 +8994,27 @@ svg_image_p (Lisp_Object object) return fmt[SVG_FILE].count + fmt[SVG_DATA].count == 1; } +/* Some versions of glib's gatomic.h define MemoryBarrier, but MinGW + w32api 3.18 and later has its own definition. The following gross + hack avoids the clash. */ +# ifdef WINDOWSNT +# if (__W32API_MAJOR_VERSION + (__W32API_MINOR_VERSION >= 18)) >= 4 +# define W32_SAVE_MINGW_VERSION __MINGW_MAJOR_VERSION +# undef __MINGW_MAJOR_VERSION +# define __MINGW_MAJOR_VERSION 4 +# endif +# endif + # include # ifdef WINDOWSNT +# ifdef W32_SAVE_MINGW_VERSION +# undef __MINGW_MAJOR_VERSION +# define __MINGW_MAJOR_VERSION W32_SAVE_MINGW_VERSION +# undef W32_SAVE_MINGW_VERSION +# endif + /* SVG library functions. */ DEF_DLL_FN (RsvgHandle *, rsvg_handle_new, (void)); DEF_DLL_FN (void, rsvg_handle_get_dimensions,