Patrick Williams | 864cc43 | 2023-02-09 14:54:44 -0600 | [diff] [blame^] | 1 | From 491b3b153f6b5cbf2d23a9778e5676eb29a6705f Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 6 Feb 2023 16:37:19 -0800 |
| 4 | Subject: [PATCH] Fix type of single bit bitfields |
| 5 | |
| 6 | clang16 warns |
| 7 | trace.c:311:22: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion] |
| 8 | |
| 9 | quash the warning by using an unsigned type to allow |
| 10 | an assignment of 0 or 1 without implicit conversion. |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | --- |
| 15 | library.h | 6 +++--- |
| 16 | prototype.h | 2 +- |
| 17 | sysdeps/linux-gnu/trace.h | 10 +++++----- |
| 18 | 3 files changed, 9 insertions(+), 9 deletions(-) |
| 19 | |
| 20 | --- a/library.h |
| 21 | +++ b/library.h |
| 22 | @@ -71,20 +71,20 @@ struct library_symbol { |
| 23 | * looking up one in LIB->protolib. */ |
| 24 | struct prototype *proto; |
| 25 | |
| 26 | - int own_name : 1; |
| 27 | + unsigned int own_name : 1; |
| 28 | |
| 29 | /* This is relevant for PLT symbols. Latent PLT symbols are |
| 30 | * those that don't match any of the -e rules, but that might |
| 31 | * potentially become active if a library implementing them |
| 32 | * appears that matches a -l rule. Ltrace core is responsible |
| 33 | * for clearing latent flag. */ |
| 34 | - int latent : 1; |
| 35 | + unsigned latent : 1; |
| 36 | |
| 37 | /* Delayed symbols are those for which a breakpoint shouldn't |
| 38 | * be enabled yet. They are similar to latent symbols, but |
| 39 | * backend is responsible for clearing the delayed flag. See |
| 40 | * proc_activate_delayed_symbol. */ |
| 41 | - int delayed : 1; |
| 42 | + unsigned int delayed : 1; |
| 43 | |
| 44 | struct arch_library_symbol_data arch; |
| 45 | struct os_library_symbol_data os; |
| 46 | --- a/prototype.h |
| 47 | +++ b/prototype.h |
| 48 | @@ -162,7 +162,7 @@ struct protolib_cache { |
| 49 | |
| 50 | /* For tracking uses of cache during cache's own |
| 51 | * initialization. */ |
| 52 | - int bootstrap : 1; |
| 53 | + unsigned int bootstrap : 1; |
| 54 | }; |
| 55 | |
| 56 | /* Initialize CACHE. Returns 0 on success or a negative value on |
| 57 | --- a/sysdeps/linux-gnu/trace.h |
| 58 | +++ b/sysdeps/linux-gnu/trace.h |
| 59 | @@ -33,11 +33,11 @@ |
| 60 | struct pid_task { |
| 61 | pid_t pid; /* This may be 0 for tasks that exited |
| 62 | * mid-handling. */ |
| 63 | - int sigstopped : 1; |
| 64 | - int got_event : 1; |
| 65 | - int delivered : 1; |
| 66 | - int vforked : 1; |
| 67 | - int sysret : 1; |
| 68 | + unsigned int sigstopped : 1; |
| 69 | + unsigned int got_event : 1; |
| 70 | + unsigned int delivered : 1; |
| 71 | + unsigned int vforked : 1; |
| 72 | + unsigned int sysret : 1; |
| 73 | }; |
| 74 | |
| 75 | struct pid_set { |
| 76 | --- a/sysdeps/linux-gnu/trace.c |
| 77 | +++ b/sysdeps/linux-gnu/trace.c |
| 78 | @@ -1043,7 +1043,7 @@ ltrace_exiting_install_handler(struct pr |
| 79 | struct process_vfork_handler |
| 80 | { |
| 81 | struct event_handler super; |
| 82 | - int vfork_bp_refd:1; |
| 83 | + unsigned int vfork_bp_refd:1; |
| 84 | }; |
| 85 | |
| 86 | static Event * |