]> granicus.if.org Git - vim/commitdiff
patch 8.2.3566: build failure on old systems when using nano timestamp v8.2.3566
authorGary Johnson <garyjohn@spocom.com>
Thu, 28 Oct 2021 19:49:06 +0000 (20:49 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 28 Oct 2021 19:49:06 +0000 (20:49 +0100)
Problem:    Build failure on old systems when using nano timestamp.
Solution:   Define _BSD_SOURCE, _SVID_SOURCE and _DEFAULT_SOURCE. (Gary
            Johnson, closes #9054)

src/version.c
src/vim.h

index 857d72ef6dcb8b3bb930602e73786ae42caf1aac..570b7d067e990068bbcba5a9351c4f7ddf8673b4 100644 (file)
@@ -757,6 +757,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3566,
 /**/
     3565,
 /**/
index 31d4bdefe878ed6c38288c67c7b9f4a3aad01901..43fb8e052453a50daef13e4a20fc0b5de12b5e8d 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
 // 700 is needed for mkdtemp().
 #  ifndef _XOPEN_SOURCE
 #   define _XOPEN_SOURCE    700
+
+// On old systems, defining _XOPEN_SOURCE causes _BSD_SOURCE, _SVID_SOURCE
+// and/or // _DEFAULT_SOURCE not to be defined, so do that here.  Those are
+// needed to include nanosecond-resolution timestamps in struct stat.  On new
+// systems, _DEFAULT_SOURCE is needed to avoid warning messages about using
+// deprecated _BSD_SOURCE or _SVID_SOURCE.
+#   ifndef _BSD_SOURCE
+#    define _BSD_SOURCE 1
+#   endif
+#   ifndef _SVID_SOURCE
+#    define _SVID_SOURCE 1
+#   endif
+#   ifndef _DEFAULT_SOURCE
+#    define _DEFAULT_SOURCE 1
+#   endif
 #  endif
 # endif