From: Bram Moolenaar Date: Tue, 26 Nov 2019 12:29:01 +0000 (+0100) Subject: patch 8.1.2344: Cygwin: warning for using strptime() X-Git-Tag: v8.1.2344 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6a228c6463935a73c8f21142cb7368545cfee317;p=vim patch 8.1.2344: Cygwin: warning for using strptime() Problem: Cygwin: warning for using strptime(). Solution: Move defining _XOPEN_SOURCE and __USE_XOPEN to vim.h. (Ken Takata, closes #5265) Use 700 for _XOPEN_SOURCE for mkdtemp(). --- diff --git a/src/os_unix.h b/src/os_unix.h index a7a0c841f..e1c7deee1 100644 --- a/src/os_unix.h +++ b/src/os_unix.h @@ -129,13 +129,6 @@ // on some systems time.h should not be included together with sys/time.h #if !defined(HAVE_SYS_TIME_H) || defined(TIME_WITH_SYS_TIME) -// Needed for strptime() -# ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE -# endif -# ifndef __USE_XOPEN -# define __USE_XOPEN -# endif # include #endif #ifdef HAVE_SYS_TIME_H diff --git a/src/version.c b/src/version.c index 9b8a02fac..9df71b8ad 100644 --- a/src/version.c +++ b/src/version.c @@ -737,6 +737,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2344, /**/ 2343, /**/ diff --git a/src/vim.h b/src/vim.h index 4d409d46f..c53b1416f 100644 --- a/src/vim.h +++ b/src/vim.h @@ -36,8 +36,21 @@ Error: configure did not run properly. Check auto/config.log. # endif +# ifdef UNIX +// Needed for strptime(). Needs to be done early, since header files can +// include other header files and end up including time.h, where these symbols +// matter for Vim. +// 700 is needed for mkdtemp(). +# ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 700 +# endif +# ifndef __USE_XOPEN +# define __USE_XOPEN +# endif +# endif + // for INT_MAX, LONG_MAX et al. -#include +# include /* * Cygwin may have fchdir() in a newer release, but in most versions it