[m-rev.] diff: Disable file IDs on Windows.
Peter Wang
novalazy at gmail.com
Thu Oct 6 18:00:15 AEDT 2016
Disable file IDs on Windows.
Since the original commit 89a4d190c53c13e276c7adf7a2fd71bddc2fb842, io.m
tested for the macro MR_BROKEN_STAT_ST_INO whereas mercury_conf_param.h
defined the macro MR_BROKEN_ST_INO. The effect was that file IDs were
allowed on Windows even though stat.st_ino will not distinguish files.
library/io.m:
Test directly for MR_WIN32 instead of MR_BROKEN_STAT_ST_INO.
Delete unreachable code.
runtime/mercury_conf_param.h:
Delete MR_BROKEN_ST_INO.
diff --git a/library/io.m b/library/io.m
index 5aad394..e161504 100644
--- a/library/io.m
+++ b/library/io.m
@@ -3749,14 +3749,9 @@ file_id(FileName, Result, !IO) :-
does_not_affect_liveness, no_sharing],
"
/* Win32 returns junk in the st_ino field of `struct stat'. */
-#if defined(MR_HAVE_STAT) && !defined(MR_BROKEN_STAT_ST_INO)
- #ifdef MR_WIN32
- struct _stat s;
- int stat_result = _wstat(ML_utf8_to_wide(FileName), &s);
- #else
+#if defined(MR_HAVE_STAT) && !defined(MR_WIN32)
struct stat s;
int stat_result = stat(FileName, &s);
- #endif
if (stat_result == 0) {
FileId.device = s.st_dev;
diff --git a/runtime/mercury_conf_param.h b/runtime/mercury_conf_param.h
index 75fe0cb..33c73d1 100644
--- a/runtime/mercury_conf_param.h
+++ b/runtime/mercury_conf_param.h
@@ -35,16 +35,11 @@
//
// MR_WIN32_GETSYSTEMINFO
// Is GetSystemInfo() available?
-//
-// MR_BROKEN_ST_INO
-// Is the st_ino field of `struct stat' junk? Windows doesn't fill in
-// this field correctly.
#ifdef _WIN32
#define MR_WIN32
#define MR_WIN32_GETSYSTEMINFO
#define MR_WIN32_GETPROCESSTIMES
- #define MR_BROKEN_ST_INO
#endif
////////////////////////////////////////////////////////////////////////////
More information about the reviews
mailing list