all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Gnulib bugs <bug-gnulib@gnu.org>, Bruno Haible <bruno@clisp.org>,
	kbrown@cornell.edu, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 085c7f6 2/2: Test format-time-string with zone arg
Date: Tue, 2 May 2017 00:52:03 -0700	[thread overview]
Message-ID: <80850259-8972-19b3-6435-2b8b9cc2319b@cs.ucla.edu> (raw)
In-Reply-To: <83pofrixf4.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1410 bytes --]

Eli Zaretskii wrote:

> the utimens.c file you've brought from Gnulib has 2 problems:
>
>   . it defines WIN32_LEAN_AND_MEAN unconditionally, which conflicts
>     with our own definition in nt/inc/ms-w32.h, which is processed
>     earlier;
>
>   . it includes msvc-nothrow.h, which is absent in the repository, it
>     should have been imported from Gnulib together with utimens.c
>
> I fixed the first of these temporarily, in a way that at least GCC
> lets utimens.c compile, but I think in general utimens.c should do
>
>   #ifndef WIN32_LEAN_AND_MEAN
>   # define WIN32_LEAN_AND_MEAN
>   #endif
>
> to avoid possible clashes with definitions elsewhere in the sources.

I'd like Bruno's opinion on the macro clash, and on the attached patch for the 
msvc-nothrow.h issue, a patch that I installed into Gnulib and into Emacs master 
to try to get the Emacs master build working again.

For quite some time Emacs has avoided Gnulib's msvc-nothrow and msvc-inval 
modules, the reason for which I do not understand (and don't particularly want 
to :-). It's trivial to add the msvc-nothrow and msvc-inval machinery to the 
Emacs source code, if this is necessary now for some reason: simply remove them 
from the AVOIDED_MODULES list in admin/merge-gnulib and then run 
admin/merge-gnulib. I don't know whether this would break other parts of the 
build on MS-Windows, though.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-utimens-port-to-Emacs-MS-Windows.patch --]
[-- Type: text/x-diff; name="0001-utimens-port-to-Emacs-MS-Windows.patch", Size: 2140 bytes --]

From fb26fc4b4ad7db1d12933aefc3d213c6f217092c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 2 May 2017 00:40:41 -0700
Subject: [PATCH] utimens: port to Emacs + MS-Windows

Skip the new MS-Windows-specific code if Emacs.
* lib/utimens.c [EMACS_CONFIGUATION]:
Avoid new MS-Windows-specific code.
(USE_SETFILETIME): New macro.
(fdutimens): Use it.
---
 ChangeLog     |  9 +++++++++
 lib/utimens.c | 10 ++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index ad44003..8c91b23 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2017-05-02  Paul Eggert  <eggert@cs.ucla.edu>
+
+	utimens: port to Emacs + MS-Windows
+	Skip the new MS-Windows-specific code if Emacs.
+	* lib/utimens.c [EMACS_CONFIGUATION]:
+	Avoid new MS-Windows-specific code.
+	(USE_SETFILETIME): New macro.
+	(fdutimens): Use it.
+
 2017-05-01  Paul Eggert  <eggert@cs.ucla.edu>
 
 	tzset: update doc for TZ problems on MS-Windows
diff --git a/lib/utimens.c b/lib/utimens.c
index 0b3b8e2..5f3a846 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -35,7 +35,13 @@
 #include "stat-time.h"
 #include "timespec.h"
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+/* On native Windows, use SetFileTime; but avoid this when compiling
+   GNU Emacs, which arranges for this in some other way and which
+   defines WIN32_LEAN_AND_MEAN itself.  */
+
+#if ((defined _WIN32 || defined __WIN32__) \
+     && ! defined __CYGWIN__ && ! defined EMACS_CONFIGURATION)
+# define USE_SETFILETIME
 # define WIN32_LEAN_AND_MEAN
 # include <windows.h>
 # include "msvc-nothrow.h"
@@ -277,7 +283,7 @@ fdutimens (int fd, char const *file, struct timespec const timespec[2])
   lutimensat_works_really = -1;
 #endif /* HAVE_UTIMENSAT || HAVE_FUTIMENS */
 
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
+#ifdef USE_SETFILETIME
   /* On native Windows, use SetFileTime(). See
      <https://msdn.microsoft.com/en-us/library/ms724933.aspx>
      <https://msdn.microsoft.com/en-us/library/ms724284.aspx>  */
-- 
2.7.4


  reply	other threads:[~2017-05-02  7:52 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170427222412.28742.14016@vcs0.savannah.gnu.org>
     [not found] ` <20170427222413.8FBA722040@vcs0.savannah.gnu.org>
2017-04-30 20:41   ` [Emacs-diffs] master 085c7f6 2/2: Test format-time-string with zone arg Ken Brown
2017-04-30 20:49     ` Paul Eggert
2017-04-30 21:28       ` Ken Brown
2017-05-01 15:02         ` Eli Zaretskii
2017-05-01 16:59           ` Ken Brown
2017-05-01  7:43       ` Eli Zaretskii
2017-05-01 17:49         ` Paul Eggert
2017-05-01 19:36           ` Eli Zaretskii
2017-05-01 23:05             ` Paul Eggert
2017-05-02  6:29               ` Eli Zaretskii
2017-05-02  7:52                 ` Paul Eggert [this message]
2017-05-02 17:09                   ` Eli Zaretskii
2017-05-02 21:55                     ` Bruno Haible
2017-05-02 22:35                       ` Paul Eggert
2017-05-03 15:49                         ` Eli Zaretskii
2017-05-03 15:33                       ` Eli Zaretskii
2017-05-03 19:33                       ` Davis Herring
2017-05-03 21:12                         ` Billy O'Neal (VC LIBS)
2017-05-04 14:26                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80850259-8972-19b3-6435-2b8b9cc2319b@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=kbrown@cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.