]> granicus.if.org Git - vim/commitdiff
patch 8.1.2344: Cygwin: warning for using strptime() v8.1.2344
authorBram Moolenaar <Bram@vim.org>
Tue, 26 Nov 2019 12:29:01 +0000 (13:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 26 Nov 2019 12:29:01 +0000 (13:29 +0100)
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().

src/os_unix.h
src/version.c
src/vim.h

index a7a0c841f1454745329d9d446245da4df931df15..e1c7deee1c501b647c3cad2f0eb8b83b3288a81d 100644 (file)
 
 // 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 <time.h>
 #endif
 #ifdef HAVE_SYS_TIME_H
index 9b8a02fac1ddd5a102ffb706bde6f289034eb77f..9df71b8add048d2e4708fab23f2922e94ee487ae 100644 (file)
@@ -737,6 +737,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2344,
 /**/
     2343,
 /**/
index 4d409d46fd657fac3e3b881ca7570e3c1603ca14..c53b1416f2b7be5de511f0cad756fc7639752947 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
     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 <limits.h>
+# include <limits.h>
 
 /*
  * Cygwin may have fchdir() in a newer release, but in most versions it