changeset 26065:e38c45dbcc70 v8.2.3566

patch 8.2.3566: build failure on old systems when using nano timestamp Commit: https://github.com/vim/vim/commit/44db603f691b58a8531e8ff528e0a7ce644257b2 Author: Gary Johnson <garyjohn@spocom.com> Date: Thu Oct 28 20:49:06 2021 +0100 patch 8.2.3566: build failure on old systems when using nano timestamp Problem: Build failure on old systems when using nano timestamp. Solution: Define _BSD_SOURCE, _SVID_SOURCE and _DEFAULT_SOURCE. (Gary Johnson, closes #9054)
author Bram Moolenaar <Bram@vim.org>
date Thu, 28 Oct 2021 22:00:05 +0200
parents 3bf82ab6c4f7
children 70cc491acacc
files src/version.c src/vim.h
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3566,
+/**/
     3565,
 /**/
     3564,
--- a/src/vim.h
+++ b/src/vim.h
@@ -43,6 +43,21 @@
 // 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