[m-rev.] diff: Reduce list of Windows ERROR_ constants.

Peter Wang novalazy at gmail.com
Fri Aug 26 11:13:39 AEST 2022


Fix compilation with older versions of MinGW(-w64) and any other
compilers which don't have as many ERROR_ constants defined.

tools/generate_windows_error_name:
    Reduce the list of ERROR_ constants.

runtime/mercury_windows_error_name.c:
    Regenerate.

diff --git a/runtime/mercury_windows_error_name.c b/runtime/mercury_windows_error_name.c
index 536c7df98..92cfeeab2 100644
--- a/runtime/mercury_windows_error_name.c
+++ b/runtime/mercury_windows_error_name.c
@@ -213,12 +213,8 @@ MR_win32_error_name(DWORD errcode)
     case ERROR_INVALID_OPLOCK_PROTOCOL: return "ERROR_INVALID_OPLOCK_PROTOCOL";
     case ERROR_DISK_TOO_FRAGMENTED: return "ERROR_DISK_TOO_FRAGMENTED";
     case ERROR_DELETE_PENDING: return "ERROR_DELETE_PENDING";
-    case ERROR_INVALID_TOKEN: return "ERROR_INVALID_TOKEN";
     case ERROR_MR_MID_NOT_FOUND: return "ERROR_MR_MID_NOT_FOUND";
     case ERROR_SCOPE_NOT_FOUND: return "ERROR_SCOPE_NOT_FOUND";
-    case ERROR_OBJECT_NOT_EXTERNALLY_BACKED: return "ERROR_OBJECT_NOT_EXTERNALLY_BACKED";
-    case ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: return "ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN";
-    case ERROR_COMPRESSION_NOT_BENEFICIAL: return "ERROR_COMPRESSION_NOT_BENEFICIAL";
     case ERROR_INVALID_ADDRESS: return "ERROR_INVALID_ADDRESS";
     case ERROR_ARITHMETIC_OVERFLOW: return "ERROR_ARITHMETIC_OVERFLOW";
     case ERROR_PIPE_CONNECTED: return "ERROR_PIPE_CONNECTED";
@@ -606,15 +602,6 @@ MR_win32_error_name(DWORD errcode)
     case ERROR_TIMEOUT: return "ERROR_TIMEOUT";
     case ERROR_INVALID_MONITOR_HANDLE: return "ERROR_INVALID_MONITOR_HANDLE";
     case ERROR_INCORRECT_SIZE: return "ERROR_INCORRECT_SIZE";
-    case ERROR_SYMLINK_CLASS_DISABLED: return "ERROR_SYMLINK_CLASS_DISABLED";
-    case ERROR_SYMLINK_NOT_SUPPORTED: return "ERROR_SYMLINK_NOT_SUPPORTED";
-    case ERROR_XML_PARSE_ERROR: return "ERROR_XML_PARSE_ERROR";
-    case ERROR_XMLDSIG_ERROR: return "ERROR_XMLDSIG_ERROR";
-    case ERROR_RESTART_APPLICATION: return "ERROR_RESTART_APPLICATION";
-    case ERROR_WRONG_COMPARTMENT: return "ERROR_WRONG_COMPARTMENT";
-    case ERROR_AUTHIP_FAILURE: return "ERROR_AUTHIP_FAILURE";
-    case ERROR_NO_NVRAM_RESOURCES: return "ERROR_NO_NVRAM_RESOURCES";
-    case ERROR_NOT_GUI_PROCESS: return "ERROR_NOT_GUI_PROCESS";
     case ERROR_EVENTLOG_FILE_CORRUPT: return "ERROR_EVENTLOG_FILE_CORRUPT";
     case ERROR_EVENTLOG_CANT_START: return "ERROR_EVENTLOG_CANT_START";
     case ERROR_LOG_FILE_FULL: return "ERROR_LOG_FILE_FULL";
diff --git a/tools/generate_windows_error_name b/tools/generate_windows_error_name
index 06d2aaf09..0ca6b6cac 100755
--- a/tools/generate_windows_error_name
+++ b/tools/generate_windows_error_name
@@ -4,8 +4,10 @@
 #
 set -eu
 
-# This list is taken from the ERROR_ constants defined in the
-# MinGW-w64 winerror.h file:
+# For compatibility, we extract this list of ERROR_ constants from the
+# winerror.h of a relatively old version of MinGW-w64 (v5.0.1),
+# which should still be more that sufficient to cover the error codes that
+# will be encountered by a Mercury program.
 #
 #   grep -oE '^#define ERROR_[^ ]+' /usr/x86_64-w64-mingw32/include/winerror.h
 #
@@ -211,12 +213,8 @@ ERROR_OPLOCK_NOT_GRANTED
 ERROR_INVALID_OPLOCK_PROTOCOL
 ERROR_DISK_TOO_FRAGMENTED
 ERROR_DELETE_PENDING
-ERROR_INVALID_TOKEN
 ERROR_MR_MID_NOT_FOUND
 ERROR_SCOPE_NOT_FOUND
-ERROR_OBJECT_NOT_EXTERNALLY_BACKED
-ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN
-ERROR_COMPRESSION_NOT_BENEFICIAL
 ERROR_INVALID_ADDRESS
 ERROR_ARITHMETIC_OVERFLOW
 ERROR_PIPE_CONNECTED
@@ -604,15 +602,6 @@ ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION
 ERROR_TIMEOUT
 ERROR_INVALID_MONITOR_HANDLE
 ERROR_INCORRECT_SIZE
-ERROR_SYMLINK_CLASS_DISABLED
-ERROR_SYMLINK_NOT_SUPPORTED
-ERROR_XML_PARSE_ERROR
-ERROR_XMLDSIG_ERROR
-ERROR_RESTART_APPLICATION
-ERROR_WRONG_COMPARTMENT
-ERROR_AUTHIP_FAILURE
-ERROR_NO_NVRAM_RESOURCES
-ERROR_NOT_GUI_PROCESS
 ERROR_EVENTLOG_FILE_CORRUPT
 ERROR_EVENTLOG_CANT_START
 ERROR_LOG_FILE_FULL
-- 
2.37.1



More information about the reviews mailing list