[DRWTSN32] Fix Clang build. Addendum to bdab437f.
authorStanislav Motylkov <x86corez@gmail.com>
Sun, 25 Jul 2021 14:52:33 +0000 (17:52 +0300)
committerStanislav Motylkov <x86corez@gmail.com>
Sun, 25 Jul 2021 15:14:23 +0000 (18:14 +0300)
Also use a macro for better code readability.

Co-authored-by: Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
base/applications/drwtsn32/sysinfo.cpp

index eef86e3..bc96af0 100644 (file)
@@ -15,30 +15,31 @@ static const char* Exception2Str(DWORD code)
 {
     switch (code)
     {
 {
     switch (code)
     {
-    case EXCEPTION_ACCESS_VIOLATION: return "EXCEPTION_ACCESS_VIOLATION";
-    case EXCEPTION_DATATYPE_MISALIGNMENT: return "EXCEPTION_DATATYPE_MISALIGNMENT";
-    case EXCEPTION_BREAKPOINT: return "EXCEPTION_BREAKPOINT";
-    case EXCEPTION_SINGLE_STEP: return "EXCEPTION_SINGLE_STEP";
-    case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: return "EXCEPTION_ARRAY_BOUNDS_EXCEEDED";
-    case EXCEPTION_FLT_DENORMAL_OPERAND: return "EXCEPTION_FLT_DENORMAL_OPERAND";
-    case EXCEPTION_FLT_DIVIDE_BY_ZERO: return "EXCEPTION_FLT_DIVIDE_BY_ZERO";
-    case EXCEPTION_FLT_INEXACT_RESULT: return "EXCEPTION_FLT_INEXACT_RESULT";
-    case EXCEPTION_FLT_INVALID_OPERATION: return "EXCEPTION_FLT_INVALID_OPERATION";
-    case EXCEPTION_FLT_OVERFLOW: return "EXCEPTION_FLT_OVERFLOW";
-    case EXCEPTION_FLT_STACK_CHECK: return "EXCEPTION_FLT_STACK_CHECK";
-    case EXCEPTION_FLT_UNDERFLOW: return "EXCEPTION_FLT_UNDERFLOW";
-    case EXCEPTION_INT_DIVIDE_BY_ZERO: return "EXCEPTION_INT_DIVIDE_BY_ZERO";
-    case EXCEPTION_INT_OVERFLOW: return "EXCEPTION_INT_OVERFLOW";
-    case EXCEPTION_PRIV_INSTRUCTION: return "EXCEPTION_PRIV_INSTRUCTION";
-    case EXCEPTION_IN_PAGE_ERROR: return "EXCEPTION_IN_PAGE_ERROR";
-    case EXCEPTION_ILLEGAL_INSTRUCTION: return "EXCEPTION_ILLEGAL_INSTRUCTION";
-    case EXCEPTION_NONCONTINUABLE_EXCEPTION: return "EXCEPTION_NONCONTINUABLE_EXCEPTION";
-    case EXCEPTION_STACK_OVERFLOW: return "EXCEPTION_STACK_OVERFLOW";
-    case EXCEPTION_INVALID_DISPOSITION: return "EXCEPTION_INVALID_DISPOSITION";
-    case EXCEPTION_GUARD_PAGE: return "EXCEPTION_GUARD_PAGE";
-    case EXCEPTION_INVALID_HANDLE: return "EXCEPTION_INVALID_HANDLE";
-    case EXCEPTION_WINE_STUB: return "EXCEPTION_WINE_STUB";
-    case STATUS_ASSERTION_FAILURE: return "STATUS_ASSERTION_FAILURE";
+#define EX_TO_STR(name)    case (DWORD)(name): return #name
+        EX_TO_STR(EXCEPTION_ACCESS_VIOLATION);
+        EX_TO_STR(EXCEPTION_DATATYPE_MISALIGNMENT);
+        EX_TO_STR(EXCEPTION_BREAKPOINT);
+        EX_TO_STR(EXCEPTION_SINGLE_STEP);
+        EX_TO_STR(EXCEPTION_ARRAY_BOUNDS_EXCEEDED);
+        EX_TO_STR(EXCEPTION_FLT_DENORMAL_OPERAND);
+        EX_TO_STR(EXCEPTION_FLT_DIVIDE_BY_ZERO);
+        EX_TO_STR(EXCEPTION_FLT_INEXACT_RESULT);
+        EX_TO_STR(EXCEPTION_FLT_INVALID_OPERATION);
+        EX_TO_STR(EXCEPTION_FLT_OVERFLOW);
+        EX_TO_STR(EXCEPTION_FLT_STACK_CHECK);
+        EX_TO_STR(EXCEPTION_FLT_UNDERFLOW);
+        EX_TO_STR(EXCEPTION_INT_DIVIDE_BY_ZERO);
+        EX_TO_STR(EXCEPTION_INT_OVERFLOW);
+        EX_TO_STR(EXCEPTION_PRIV_INSTRUCTION);
+        EX_TO_STR(EXCEPTION_IN_PAGE_ERROR);
+        EX_TO_STR(EXCEPTION_ILLEGAL_INSTRUCTION);
+        EX_TO_STR(EXCEPTION_NONCONTINUABLE_EXCEPTION);
+        EX_TO_STR(EXCEPTION_STACK_OVERFLOW);
+        EX_TO_STR(EXCEPTION_INVALID_DISPOSITION);
+        EX_TO_STR(EXCEPTION_GUARD_PAGE);
+        EX_TO_STR(EXCEPTION_INVALID_HANDLE);
+        EX_TO_STR(EXCEPTION_WINE_STUB);
+        EX_TO_STR(STATUS_ASSERTION_FAILURE);
     }
 
     return "--";
     }
 
     return "--";