summarylogtreecommitdiffstats
path: root/017-fix-narrowing-conversion.patch
blob: 5ca8215675eeaaa93caf97477272cd1242e18e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
From ee6ae088673d14c407d4773855dbda821024653c Mon Sep 17 00:00:00 2001
From: Christian Hesse <mail@eworm.de>
Date: Sun, 17 May 2020 00:40:18 +0200
Subject: [PATCH 1/1] fix narrowing conversion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Building fails with:

/build/virtualbox/src/VirtualBox-6.1.8/src/VBox/Debugger/DBGCDumpImage.cpp: In function ‘const char* dbgcMachoCpuType(uint32_t, uint32_t)’:
/build/virtualbox/src/VirtualBox-6.1.8/include/iprt/formats/mach-o.h:41:46: error: narrowing conversion of ‘-1’ from ‘int’ to ‘unsigned int’ [-Wnarrowing]
   41 | #define CPU_TYPE_ANY                INT32_C(-1)
      |                                              ^
/build/virtualbox/src/VirtualBox-6.1.8/src/VBox/Debugger/DBGCDumpImage.cpp:471:14: note: in expansion of macro ‘CPU_TYPE_ANY’
  471 |         case CPU_TYPE_ANY:          return "CPU_TYPE_ANY";
      |              ^~~~~~~~~~~~

As uType is unsigned it can never match CPU_TYPE_ANY, which is -1.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 src/VBox/Debugger/DBGCDumpImage.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/VBox/Debugger/DBGCDumpImage.cpp b/src/VBox/Debugger/DBGCDumpImage.cpp
index 02ba3158..d906c37c 100644
--- a/src/VBox/Debugger/DBGCDumpImage.cpp
+++ b/src/VBox/Debugger/DBGCDumpImage.cpp
@@ -468,7 +468,6 @@ static const char *dbgcMachoCpuType(uint32_t uType, uint32_t uSubType)
 {
     switch (uType)
     {
-        case CPU_TYPE_ANY:          return "CPU_TYPE_ANY";
         case CPU_TYPE_VAX:          return "VAX";
         case CPU_TYPE_MC680x0:      return "MC680x0";
         case CPU_TYPE_X86:          return "X86";