diff options
author | Enze Li <enze.li@hotmail.com> | 2023-01-22 13:38:41 +0800 |
---|---|---|
committer | Enze Li <enze.li@hotmail.com> | 2023-01-24 11:17:16 +0800 |
commit | 59d49a8d83a289624a1dff4e8833f2b7c286d764 (patch) | |
tree | 0d669df41722691d0d4b7ee22db9c4fc520f73c7 /gdb/maint.c | |
parent | 7ebf464bbd5099a10189c9b3935bff64ddcf5ca8 (diff) | |
download | gdb-59d49a8d83a289624a1dff4e8833f2b7c286d764.zip gdb-59d49a8d83a289624a1dff4e8833f2b7c286d764.tar.gz gdb-59d49a8d83a289624a1dff4e8833f2b7c286d764.tar.bz2 |
gdb: some int to bool conversion
When building GDB with clang 16, I got this,
CXX maint.o
maint.c:1045:23: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
m_space_enabled = 1;
^ ~
maint.c:1057: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]
m_time_enabled = 1;
^ ~
maint.c:1073:24: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Werror,-Wsingle-bit-bitfield-constant-conversion]
m_symtab_enabled = 1;
^ ~
3 errors generated.
Work around this by using bool bitfields instead.
Tested by rebuilding on x86_64-linux with clang 16 and gcc 12.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/maint.c')
-rw-r--r-- | gdb/maint.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/maint.c b/gdb/maint.c index 1a226bf..52f91a3 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -1042,11 +1042,11 @@ scoped_command_stats::scoped_command_stats (bool msg_type) #ifdef HAVE_USEFUL_SBRK char *lim = (char *) sbrk (0); m_start_space = lim - lim_at_start; - m_space_enabled = 1; + m_space_enabled = true; #endif } else - m_space_enabled = 0; + m_space_enabled = false; if (msg_type == 0 || per_command_time) { @@ -1054,13 +1054,13 @@ scoped_command_stats::scoped_command_stats (bool msg_type) m_start_cpu_time = run_time_clock::now (); m_start_wall_time = steady_clock::now (); - m_time_enabled = 1; + m_time_enabled = true; if (per_command_time) print_time (_("command started")); } else - m_time_enabled = 0; + m_time_enabled = false; if (msg_type == 0 || per_command_symtab) { @@ -1070,10 +1070,10 @@ scoped_command_stats::scoped_command_stats (bool msg_type) m_start_nr_symtabs = nr_symtabs; m_start_nr_compunit_symtabs = nr_compunit_symtabs; m_start_nr_blocks = nr_blocks; - m_symtab_enabled = 1; + m_symtab_enabled = true; } else - m_symtab_enabled = 0; + m_symtab_enabled = false; /* Initialize timer to keep track of how long we waited for the user. */ reset_prompt_for_continue_wait_time (); |