gdb: some int to bool conversion
authorEnze Li <enze.li@hotmail.com>
Sun, 22 Jan 2023 05:38:41 +0000 (13:38 +0800)
committerEnze Li <enze.li@hotmail.com>
Tue, 24 Jan 2023 03:17:16 +0000 (11:17 +0800)
commit59d49a8d83a289624a1dff4e8833f2b7c286d764
tree0d669df41722691d0d4b7ee22db9c4fc520f73c7
parent7ebf464bbd5099a10189c9b3935bff64ddcf5ca8
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>
gdb/maint.c
gdb/maint.h