tools: convert bitfields to unsigned type
PATCH 1/1 tools: convert bitfields to unsigned type
clang complains about the signed type:
implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
The potential ABI change in libxenvchan is covered by the Xen version based SONAME.
The xenalyze change follows the existing pattern in that file.
--- tools/include/libxenvchan.h | 6 +++--- tools/xentrace/xenalyze.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
tools/include/libxenvchan.h +3 -3
@@ -79,11 +79,11 @@ struct libxenvchan {xenevtchn_handle *event;uint32_t event_port;/* informative flags: are we acting as server? */ - int is_server:1; + unsigned int is_server:1;/* true if server remains active when client closes (allows reconnection) */ - int server_persist:1; + unsigned int server_persist:1;/* true if operations should block instead of returning 0 */ - int blocking:1; + unsigned int blocking:1;/* communication rings */ struct libxenvchan_ring read, write;/**
tools/xentrace/xenalyze.c +1 -1
@@ -1377,7 +1377,7 @@ struct hvm_data {tsc_t exit_tsc, arc_cycles, entry_tsc;unsigned long long rip;unsigned exit_reason, event_handler; - int short_summary_done:1, prealloc_unpin:1, wrmap_bf:1; + unsigned short_summary_done:1, prealloc_unpin:1, wrmap_bf:1;/* Immediate processing */ void *d;
Quoted 38 lines · Olaf Hering
clang complains about the signed type:
implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
The potential ABI change in libxenvchan is covered by the Xen version based SONAME.
The xenalyze change follows the existing pattern in that file.
Signed-off-by Olaf Hering <[email protected]>--- tools/include/libxenvchan.h | 6 +++--- tools/xentrace/xenalyze.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)tools/include/libxenvchan.h +3
-3@@ -79,11 +79,11 @@ struct libxenvchan {xenevtchn_handle *event;uint32_t event_port;/* informative flags: are we acting as server? */ - int is_server:1; + unsigned int is_server:1;/* true if server remains active when client closes (allows reconnection) */ - int server_persist:1; + unsigned int server_persist:1;/* true if operations should block instead of returning 0 */ - int blocking:1; + unsigned int blocking:1;/* communication rings */ struct libxenvchan_ring read, write;/** tools/xentrace/xenalyze.c +0
-0
tools/xentrace/xenalyze.c struct hvm_data { · line 1380
Quoted 5 lines
tools/xentrace/xenalyze.c +1
-1@@ -1377,7 +1377,7 @@ struct hvm_data {tsc_t exit_tsc, arc_cycles, entry_tsc;unsigned long long rip;unsigned exit_reason, event_handler; - int short_summary_done:1, prealloc_unpin:1, wrmap_bf:1; + unsigned short_summary_done:1, prealloc_unpin:1, wrmap_bf:1;
Please use "unsigned int" instead of a pure "unsigned".
With that you can add my:
Juergen
Mon, 8 May 2023 11:06:11 +0200 Juergen Gross <[email protected]>:
Quoted 3 lines
tools/xentrace/xenalyze.c struct hvm_data { · line 1380
Quoted 2 lines
tools/xentrace/xenalyze.c +1
-1- int short_summary_done:1, prealloc_unpin:1, wrmap_bf:1; + unsigned short_summary_done:1, prealloc_unpin:1, wrmap_bf:1;Please use "unsigned int" instead of a pure "unsigned".
The entire file uses just 'unsigned' for bitfields.
Olaf
Quoted 7 lines · Olaf Hering
Mon, 8 May 2023 11:06:11 +0200 Juergen Gross <[email protected]>:
Quoted 3 lines
tools/xentrace/xenalyze.c struct hvm_data { · line 1380
Quoted 2 lines
tools/xentrace/xenalyze.c +1
-1- int short_summary_done:1, prealloc_unpin:1, wrmap_bf:1; + unsigned short_summary_done:1, prealloc_unpin:1, wrmap_bf:1;Please use "unsigned int" instead of a pure "unsigned".
The entire file uses just 'unsigned' for bitfields.
I have found 18 lines using "unsigned int" for bitfields in this file.
Juergen
Mon, 8 May 2023 13:23:27 +0200 Juergen Gross <[email protected]>:
Quoted 1 line
I have found 18 lines using "unsigned int" for bitfields in this file.
There is indeed a mix of both variants in this file. I scrolled just down to line 6999, only looking for ':1'.
Olaf