* [PATCH v2 1/8] Use C++17 [[fallthrough]] attribute
2023-11-21 15:27 Tom Tromey
@ 2023-11-21 15:27 ` Tom Tromey
2023-11-30 18:03 ` Simon Marchi
2023-11-21 15:27 ` [PATCH v2 2/8] Switch to -Wimplicit-fallthrough=5 Tom Tromey
` (7 subsequent siblings)
8 siblings, 1 reply; 15+ messages in thread
From: Tom Tromey @ 2023-11-21 15:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey, John Baldwin, Luis Machado, Pedro Alves
This changes gdb to use the C++17 [[fallthrough]] attribute rather
than special comments.
This was mostly done by script, but I neglected a few spellings and so
also fixed it up by hand.
I suspect this fixes the bug mentioned below, by switching to a
standard approach that, presumably, clang supports.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=23159
Approved-By: John Baldwin <jhb@FreeBSD.org>
Approved-By: Luis Machado <luis.machado@arm.com>
Approved-By: Pedro Alves <pedro@palves.net>
---
gdb/aarch64-tdep.c | 2 +-
gdb/ada-exp.y | 2 +-
gdb/ada-lang.c | 2 +-
gdb/ada-valprint.c | 2 +-
gdb/amd64-windows-tdep.c | 2 +-
gdb/arch/arm.c | 2 +-
gdb/arm-tdep.c | 2 +-
gdb/c-exp.y | 6 ++--
gdb/cli/cli-setshow.c | 2 +-
gdb/coffread.c | 4 +--
gdb/compile/compile-c-support.c | 2 +-
gdb/compile/compile-c-symbols.c | 2 +-
gdb/compile/compile-cplus-symbols.c | 2 +-
gdb/cp-name-parser.y | 4 +--
gdb/cp-support.c | 2 +-
gdb/ctfread.c | 2 +-
gdb/d-exp.y | 4 +--
gdb/d-valprint.c | 2 +-
gdb/dbxread.c | 2 +-
gdb/disasm-selftests.c | 2 +-
gdb/dwarf2/macro.c | 4 +--
gdb/dwarf2/read.c | 22 ++++++------
gdb/eval.c | 2 +-
gdb/f-exp.y | 4 +--
gdb/fbsd-nat.c | 2 +-
gdb/gdbtypes.c | 10 +++---
gdb/go-exp.y | 4 +--
gdb/go-valprint.c | 2 +-
gdb/i386-tdep.c | 8 ++---
gdb/m2-typeprint.c | 2 +-
gdb/m2-valprint.c | 4 +--
gdb/machoread.c | 2 +-
gdb/mdebugread.c | 6 ++--
gdb/mi/mi-cmd-stack.c | 2 +-
gdb/minsyms.c | 2 +-
gdb/mips-tdep.c | 6 ++--
gdb/msp430-tdep.c | 2 +-
gdb/nat/linux-btrace.c | 3 +-
gdb/nat/windows-nat.c | 4 +--
gdb/nat/x86-dregs.c | 2 +-
gdb/p-exp.y | 2 +-
gdb/p-valprint.c | 2 +-
gdb/printcmd.c | 2 +-
gdb/record-btrace.c | 2 +-
gdb/remote.c | 6 ++--
gdb/riscv-tdep.c | 2 +-
gdb/rs6000-tdep.c | 52 ++++++++++++++---------------
gdb/rust-parse.c | 4 +--
gdb/s390-tdep.c | 28 ++++++++--------
gdb/stabsread.c | 6 ++--
gdb/symfile.c | 2 +-
gdb/utils.c | 2 +-
gdb/valops.c | 6 ++--
gdb/value.c | 2 +-
gdb/windows-nat.c | 4 +--
gdb/xcoffread.c | 4 +--
gdb/z80-tdep.c | 2 +-
gdbserver/netbsd-low.cc | 2 +-
gdbsupport/btrace-common.cc | 6 ++--
gdbsupport/format.cc | 4 +--
60 files changed, 140 insertions(+), 143 deletions(-)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index eaae2d91047..ba37b4969a3 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -1851,7 +1851,7 @@ pass_in_v_vfp_candidate (struct gdbarch *gdbarch, struct regcache *regcache,
if (arg_type->is_vector ())
return pass_in_v (gdbarch, regcache, info, arg_type->length (),
arg->contents ().data ());
- /* fall through. */
+ [[fallthrough]];
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y
index 3280a483a5e..fcb5aa4379b 100644
--- a/gdb/ada-exp.y
+++ b/gdb/ada-exp.y
@@ -1307,7 +1307,7 @@ write_object_renaming (struct parser_state *par_state,
break;
case 'L':
slice_state = LOWER_BOUND;
- /* FALLTHROUGH */
+ [[fallthrough]];
case 'S':
renaming_expr += 1;
if (isdigit (*renaming_expr))
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index ff7222c7eed..1a591567cda 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5508,7 +5508,7 @@ compare_names_with_case (const char *string1, const char *string2,
else
return 1;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
default:
if (*string2 == '(')
return strcmp_iw_ordered (string1, string2);
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index f1c4e8b0b70..0930df81061 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -89,7 +89,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type,
break;
case TYPE_CODE_UNDEF:
index_type = NULL;
- /* FALL THROUGH */
+ [[fallthrough]];
default:
if (low_bound == 1)
return 0;
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 9d69ec282d2..6be43434121 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -380,7 +380,7 @@ amd64_windows_return_value (struct gdbarch *gdbarch, struct value *function,
break;
}
}
- /* fall through */
+ [[fallthrough]];
default:
/* All other values that are 1, 2, 4 or 8 bytes long are returned
via RAX. */
diff --git a/gdb/arch/arm.c b/gdb/arch/arm.c
index 4720c201c53..6fc4c0e11cd 100644
--- a/gdb/arch/arm.c
+++ b/gdb/arch/arm.c
@@ -153,7 +153,7 @@ arm_instruction_changes_pc (uint32_t this_instr)
return 0;
}
/* Data processing instruction. */
- /* Fall through. */
+ [[fallthrough]];
case 0x1:
if (bits (this_instr, 12, 15) == 15)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 7a93b098247..23fecf7cf66 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -7600,7 +7600,7 @@ arm_decode_miscellaneous (struct gdbarch *gdbarch, uint32_t insn,
else if (op == 0x3)
/* Not really supported. */
return arm_copy_unmodified (gdbarch, insn, "smc", dsc);
- /* Fall through. */
+ [[fallthrough]];
default:
return arm_copy_undef (gdbarch, insn, dsc);
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index a27dbfa608f..2b4c21850d3 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -2731,7 +2731,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
last_was_structop = true;
goto symbol; /* Nope, must be a symbol. */
}
- /* FALL THRU. */
+ [[fallthrough]];
case '0':
case '1':
@@ -2828,7 +2828,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
return ENTRY;
}
}
- /* FALLTHRU */
+ [[fallthrough]];
case '+':
case '-':
case '*':
@@ -2855,7 +2855,7 @@ lex_one_token (struct parser_state *par_state, bool *is_quoted_name)
case 'U':
if (tokstart[1] != '"' && tokstart[1] != '\'')
break;
- /* Fall through. */
+ [[fallthrough]];
case '\'':
case '"':
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index c7bbac1666d..11f93068b68 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -379,7 +379,7 @@ do_set_command (const char *arg, int from_tty, struct cmd_list_element *c)
case var_filename:
if (*arg == '\0')
error_no_arg (_("filename to set it to."));
- /* FALLTHROUGH */
+ [[fallthrough]];
case var_optional_filename:
{
char *val = NULL;
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 5898b3a8e08..37363631915 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -896,7 +896,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
backtraces, so filter them out (from phdm@macqel.be). */
if (within_function)
break;
- /* Fall through. */
+ [[fallthrough]];
case C_STAT:
case C_THUMBLABEL:
case C_THUMBSTAT:
@@ -934,7 +934,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
that look like this. Ignore them. */
break;
/* For static symbols that don't start with '.'... */
- /* Fall through. */
+ [[fallthrough]];
case C_THUMBEXT:
case C_THUMBEXTFUNC:
case C_EXT:
diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
index 3a3e4d21136..f099504aab7 100644
--- a/gdb/compile/compile-c-support.c
+++ b/gdb/compile/compile-c-support.c
@@ -267,7 +267,7 @@ generate_register_struct (struct ui_file *stream, struct gdbarch *gdbarch,
}
}
- /* Fall through. */
+ [[fallthrough]];
default:
gdb_printf (stream,
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index 5982178170c..a80b9a43156 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -136,7 +136,7 @@ convert_one_symbol (compile_c_instance *context,
"be referenced from the current thread in "
"compiled code."),
sym.symbol->print_name ());
- /* FALLTHROUGH */
+ [[fallthrough]];
case LOC_UNRESOLVED:
/* 'symbol_name' cannot be used here as that one is used only for
local variables from compile_dwarf_expr_to_c.
diff --git a/gdb/compile/compile-cplus-symbols.c b/gdb/compile/compile-cplus-symbols.c
index 1edbf8f64b5..5cffe5cfebb 100644
--- a/gdb/compile/compile-cplus-symbols.c
+++ b/gdb/compile/compile-cplus-symbols.c
@@ -132,7 +132,7 @@ convert_one_symbol (compile_cplus_instance *instance,
"be referenced from the current thread in "
"compiled code."),
sym.symbol->print_name ());
- /* FALLTHROUGH */
+ [[fallthrough]];
case LOC_UNRESOLVED:
/* 'symbol_name' cannot be used here as that one is used only for
local variables from compile_dwarf_expr_to_c.
diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y
index e6c8c4c09a9..9a359d47b65 100644
--- a/gdb/cp-name-parser.y
+++ b/gdb/cp-name-parser.y
@@ -1604,7 +1604,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
sizeof "(anonymous namespace)" - 1);
return NAME;
}
- /* FALL THROUGH */
+ [[fallthrough]];
case ')':
case ',':
@@ -1641,7 +1641,7 @@ yylex (YYSTYPE *lvalp, cpname_state *state)
state->lexptr++;
return '-';
}
- /* FALL THRU. */
+ [[fallthrough]];
try_number:
case '0':
diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index cb169444d2a..9eb5577dd33 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -531,7 +531,7 @@ replace_typedefs (struct demangle_parse_info *info,
{
case DEMANGLE_COMPONENT_ARGLIST:
check_cv_qualifiers (ret_comp);
- /* Fall through */
+ [[fallthrough]];
case DEMANGLE_COMPONENT_FUNCTION_TYPE:
case DEMANGLE_COMPONENT_TEMPLATE:
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index c74ec044c18..03a042ec38c 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -1473,7 +1473,7 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
{
case CTF_K_ENUM:
ctf_psymtab_add_enums (ccp, tid);
- /* FALL THROUGH */
+ [[fallthrough]];
case CTF_K_STRUCT:
case CTF_K_UNION:
domain = STRUCT_DOMAIN;
diff --git a/gdb/d-exp.y b/gdb/d-exp.y
index 6c5569a1c8d..e2507982d50 100644
--- a/gdb/d-exp.y
+++ b/gdb/d-exp.y
@@ -1103,7 +1103,7 @@ lex_one_token (struct parser_state *par_state)
last_was_structop = 1;
goto symbol; /* Nope, must be a symbol. */
}
- /* FALL THRU. */
+ [[fallthrough]];
case '0':
case '1':
@@ -1180,7 +1180,7 @@ lex_one_token (struct parser_state *par_state)
return ENTRY;
}
}
- /* FALLTHRU */
+ [[fallthrough]];
case '+':
case '-':
case '*':
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index 38fb2a07c1f..4c3ea227750 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -85,7 +85,7 @@ d_value_print_inner (struct value *val, struct ui_file *stream, int recurse,
stream, recurse, val, options);
if (ret == 0)
break;
- /* Fall through. */
+ [[fallthrough]];
default:
c_value_print_inner (val, stream, recurse, options);
break;
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index b92193bdadd..99d9fba96ea 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -2806,7 +2806,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
case N_NBSTS:
case N_NBLCS:
unknown_symtype_complaint (hex_string (type));
- /* FALLTHROUGH */
+ [[fallthrough]];
define_a_symbol:
/* These symbol types don't need the address field relocated,
diff --git a/gdb/disasm-selftests.c b/gdb/disasm-selftests.c
index 0cf766a48b7..200d33aff4e 100644
--- a/gdb/disasm-selftests.c
+++ b/gdb/disasm-selftests.c
@@ -126,7 +126,7 @@ get_test_insn (struct gdbarch *gdbarch, size_t *len)
if (info->bits_per_address > sizeof (bfd_vma) * CHAR_BIT)
return insn;
}
- /* fall through */
+ [[fallthrough]];
default:
generic_case:
{
diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c
index 2e88e670216..7d86d16d0e3 100644
--- a/gdb/dwarf2/macro.c
+++ b/gdb/dwarf2/macro.c
@@ -784,7 +784,7 @@ dwarf_decode_macro_bytes (dwarf2_per_objfile *per_objfile,
/* We don't recognize any vendor extensions. */
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
default:
mac_ptr = skip_unknown_opcode (macinfo_type, opcode_definitions,
@@ -939,7 +939,7 @@ dwarf_decode_macros (dwarf2_per_objfile *per_objfile,
read_direct_string (abfd, mac_ptr, &bytes_read);
mac_ptr += bytes_read;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
default:
mac_ptr = skip_unknown_opcode (macinfo_type, opcode_definitions,
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ccf9f18b31b..ec21cb9e428 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -6494,7 +6494,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
&& die->parent != NULL
&& die->parent->tag == DW_TAG_subprogram)
cu->processing_has_namespace_info = true;
- /* Fall through. */
+ [[fallthrough]];
case DW_TAG_inlined_subroutine:
read_func_scope (die, cu);
break;
@@ -6536,7 +6536,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
instead. */
if (cu->lang () != language_ada)
break;
- /* FALLTHROUGH */
+ [[fallthrough]];
case DW_TAG_base_type:
case DW_TAG_subrange_type:
case DW_TAG_generic_subrange:
@@ -6564,7 +6564,7 @@ process_die (struct die_info *die, struct dwarf2_cu *cu)
break;
/* The declaration is neither a global namespace nor a variable
alias. */
- /* Fall through. */
+ [[fallthrough]];
case DW_TAG_imported_module:
cu->processing_has_namespace_info = true;
if (die->child != NULL && (die->tag == DW_TAG_imported_declaration
@@ -16487,7 +16487,7 @@ cooked_indexer::index_dies (cutu_reader *reader,
case DW_TAG_module:
if (this_entry == nullptr)
break;
- /* FALLTHROUGH */
+ [[fallthrough]];
case DW_TAG_namespace:
/* We don't check THIS_ENTRY for a namespace, to handle
the ancient G++ workaround pointed out above. */
@@ -17194,7 +17194,7 @@ read_attribute_value (const struct die_reader_specs *reader,
info_ptr += bytes_read;
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case DW_FORM_line_strp:
if (!cu->per_cu->is_dwz)
{
@@ -17204,7 +17204,7 @@ read_attribute_value (const struct die_reader_specs *reader,
info_ptr += bytes_read;
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case DW_FORM_GNU_strp_alt:
{
dwz_file *dwz = dwarf2_get_dwz_file (per_objfile->per_bfd, true);
@@ -19017,7 +19017,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
break;
case DW_TAG_template_value_param:
suppress_add = 1;
- /* Fall through. */
+ [[fallthrough]];
case DW_TAG_constant:
case DW_TAG_variable:
case DW_TAG_member:
@@ -19194,7 +19194,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
break;
case DW_TAG_template_type_param:
suppress_add = 1;
- /* Fall through. */
+ [[fallthrough]];
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
@@ -19248,7 +19248,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
case DW_TAG_unspecified_type:
if (cu->lang () == language_ada)
break;
- /* FALLTHROUGH */
+ [[fallthrough]];
case DW_TAG_typedef:
case DW_TAG_array_type:
case DW_TAG_base_type:
@@ -20044,7 +20044,7 @@ determine_prefix (struct die_info *die, struct dwarf2_cu *cu)
return parent_type->name ();
return "";
}
- /* Fall through. */
+ [[fallthrough]];
default:
return determine_prefix (parent, cu);
}
@@ -20228,7 +20228,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
case DW_TAG_template_value_param:
if (attr_name == nullptr)
return unnamed_template_tag_name (die, cu);
- /* FALLTHROUGH. */
+ [[fallthrough]];
case DW_TAG_class_type:
case DW_TAG_interface_type:
case DW_TAG_structure_type:
diff --git a/gdb/eval.c b/gdb/eval.c
index 3358b0d8d32..8192aeba364 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -172,7 +172,7 @@ fetch_subexp_value (struct expression *exp,
case MEMORY_ERROR:
if (!preserve_errors)
break;
- /* Fall through. */
+ [[fallthrough]];
default:
throw;
break;
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index 18566afd67f..e4e2171d641 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -1503,7 +1503,7 @@ yylex (void)
/* Might be a floating point number. */
if (pstate->lexptr[1] < '0' || pstate->lexptr[1] > '9')
goto symbol; /* Nope, must be a symbol. */
- /* FALL THRU. */
+ [[fallthrough]];
case '0':
case '1':
@@ -1571,7 +1571,7 @@ yylex (void)
case '%':
last_was_structop = true;
- /* Fall through. */
+ [[fallthrough]];
case '+':
case '-':
case '*':
diff --git a/gdb/fbsd-nat.c b/gdb/fbsd-nat.c
index 211b83f555a..b56e194b7d5 100644
--- a/gdb/fbsd-nat.c
+++ b/gdb/fbsd-nat.c
@@ -1641,7 +1641,7 @@ fbsd_nat_target::stop_process (inferior *inf)
if (status.sig () == GDB_SIGNAL_STOP)
break;
- /* FALLTHROUGH */
+ [[fallthrough]];
default:
/* Some other event has occurred. Save the current
event. */
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 04598c6f4be..b2624ac036d 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -1101,7 +1101,7 @@ get_discrete_low_bound (struct type *type)
if (!type->is_unsigned ())
return -(1 << (type->length () * TARGET_CHAR_BIT - 1));
- /* fall through */
+ [[fallthrough]];
case TYPE_CODE_CHAR:
return 0;
@@ -1171,7 +1171,7 @@ get_discrete_high_bound (struct type *type)
return -low - 1;
}
- /* fall through */
+ [[fallthrough]];
case TYPE_CODE_CHAR:
{
/* This round-about calculation is to avoid shifting by
@@ -4436,7 +4436,7 @@ rank_one_type_parm_ptr (struct type *parm, struct type *arg, struct value *value
return NS_INTEGER_POINTER_CONVERSION_BADNESS;
}
}
- /* fall through */
+ [[fallthrough]];
case TYPE_CODE_ENUM:
case TYPE_CODE_FLAGS:
case TYPE_CODE_CHAR:
@@ -4608,7 +4608,7 @@ rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *valu
return INTEGER_CONVERSION_BADNESS;
else if (arg->length () < parm->length ())
return INTEGER_PROMOTION_BADNESS;
- /* fall through */
+ [[fallthrough]];
case TYPE_CODE_CHAR:
/* Deal with signed, unsigned, and plain chars for C++ and
with int cases falling through from previous case. */
@@ -4741,7 +4741,7 @@ rank_one_type_parm_struct (struct type *parm, struct type *arg, struct value *va
rank.subrank = distance_to_ancestor (parm, arg, 0);
if (rank.subrank >= 0)
return sum_ranks (BASE_CONVERSION_BADNESS, rank);
- /* fall through */
+ [[fallthrough]];
default:
return INCOMPATIBLE_TYPE_BADNESS;
}
diff --git a/gdb/go-exp.y b/gdb/go-exp.y
index 28bf3f0ab33..c9b9c0b1ab7 100644
--- a/gdb/go-exp.y
+++ b/gdb/go-exp.y
@@ -1054,7 +1054,7 @@ lex_one_token (struct parser_state *par_state)
last_was_structop = 1;
goto symbol; /* Nope, must be a symbol. */
}
- /* FALL THRU. */
+ [[fallthrough]];
case '0':
case '1':
@@ -1129,7 +1129,7 @@ lex_one_token (struct parser_state *par_state)
return ENTRY;
}
}
- /* FALLTHRU */
+ [[fallthrough]];
case '+':
case '-':
case '*':
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 05788af15a6..ca1e6b5ba6f 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -114,7 +114,7 @@ go_language::value_print_inner (struct value *val, struct ui_file *stream,
break;
}
}
- /* Fall through. */
+ [[fallthrough]];
default:
c_value_print_inner (val, stream, recurse, options);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index f5ff55de47a..3795759c9d4 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -6011,7 +6011,7 @@ Do you want to stop the program?"),
ir.addr -= 1;
goto no_support;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case 0x0fb2: /* lss Gv */
case 0x0fb4: /* lfs Gv */
case 0x0fb5: /* lgs Gv */
@@ -6248,7 +6248,7 @@ Do you want to stop the program?"),
I386_SAVE_FPU_REGS))
return -1;
}
- /* Fall through */
+ [[fallthrough]];
default:
if (record_full_arch_list_add_mem (addr64, 2))
return -1;
@@ -6787,7 +6787,7 @@ Do you want to stop the program?"),
ir.addr -= 1;
goto no_support;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case 0xf5: /* cmc */
case 0xf8: /* clc */
case 0xf9: /* stc */
@@ -7229,7 +7229,7 @@ Do you want to stop the program?"),
else if (ir.rm == 1)
break;
}
- /* Fall through. */
+ [[fallthrough]];
case 3: /* lidt */
if (ir.mod == 3)
{
diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c
index 72f978205ab..179c3fccc30 100644
--- a/gdb/m2-typeprint.c
+++ b/gdb/m2-typeprint.c
@@ -389,7 +389,7 @@ m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
return 0;
}
}
- /* fall through */
+ [[fallthrough]];
default:
return get_discrete_bounds (type, lowp, highp);
}
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index 96a566fb810..c4570da2e18 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -373,7 +373,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
gdb_printf (stream, "{...}");
break;
}
- /* Fall through. */
+ [[fallthrough]];
case TYPE_CODE_STRUCT:
if (m2_is_long_set (type))
m2_print_long_set (type, valaddr, 0, address, stream);
@@ -451,7 +451,7 @@ m2_language::value_print_inner (struct value *val, struct ui_file *stream,
value_print_inner (v, stream, recurse, options);
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case TYPE_CODE_REF:
case TYPE_CODE_ENUM:
diff --git a/gdb/machoread.c b/gdb/machoread.c
index 38c252c2861..87d30ec8587 100644
--- a/gdb/machoread.c
+++ b/gdb/machoread.c
@@ -292,7 +292,7 @@ macho_symtab_read (minimal_symbol_reader &reader,
case N_FUN:
if (sym->name == NULL || sym->name[0] == 0)
break;
- /* Fall through. */
+ [[fallthrough]];
case N_STSYM:
/* Interesting symbol. */
nbr_syms++;
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index fc731605991..a28005031e6 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -2582,7 +2582,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
those too. */
if (name[0] == '.')
continue;
- /* Fall through. */
+ [[fallthrough]];
default:
ms_type = mst_unknown;
unknown_ext_complaint (name);
@@ -3430,7 +3430,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
mst_file_text,
SECT_OFF_TEXT (objfile));
- /* FALLTHROUGH */
+ [[fallthrough]];
case stProc:
/* Ignore all parameter symbol records. */
@@ -3666,7 +3666,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
default:
unknown_ext_complaint (debug_info->ssext + psh->iss);
/* Pretend it's global. */
- /* Fall through. */
+ [[fallthrough]];
case stGlobal:
/* Global common symbols are resolved by the runtime loader,
ignore them. */
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 6982338751a..401e7c40726 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -652,7 +652,7 @@ list_args_or_locals (const frame_print_options &fp_opts,
case PRINT_SIMPLE_VALUES:
if (!mi_simple_type_p (sym2->type ()))
break;
- /* FALLTHROUGH */
+ [[fallthrough]];
case PRINT_ALL_VALUES:
if (sym->is_argument ())
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index 72e500be959..71e22ce1a90 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -140,7 +140,7 @@ msymbol_is_function (struct objfile *objfile, minimal_symbol *minsym,
/* Ignore function symbol that is not a function entry. */
if (msymbol_is_cold_clone (minsym))
return false;
- /* fallthru */
+ [[fallthrough]];
default:
if (func_address_p != NULL)
*func_address_p = msym_addr;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 066c7c80669..c7157c19e7b 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -3992,7 +3992,7 @@ mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
&& (itype_rt (insn) & 0x2) == 0);
if (is_branch) /* BC1ANY2F, BC1ANY2T, BC1ANY4F, BC1ANY4T */
break;
- /* Fall through. */
+ [[fallthrough]];
case 18: /* COP2 */
case 19: /* COP3 */
is_branch = (itype_rs (insn) == 8); /* BCzF, BCzFL, BCzT, BCzTL */
@@ -4100,7 +4100,7 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
|| (insn & 0x3) != 0x1))
/* BC1ANY*: bits 010000 111xx xxx01 */
break;
- /* Fall through. */
+ [[fallthrough]];
case 0x25: /* BEQ: bits 100101 */
case 0x2d: /* BNE: bits 101101 */
@@ -4122,7 +4122,7 @@ micromips_deal_with_atomic_sequence (struct gdbarch *gdbarch,
/* JALR, JALR.HB: 000000 000x111100 111100 */
/* JALRS, JALRS.HB: 000000 010x111100 111100 */
break;
- /* Fall through. */
+ [[fallthrough]];
case 0x1d: /* JALS: bits 011101 */
case 0x35: /* J: bits 110101 */
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index 97d9073efbb..f65948f01d8 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -886,7 +886,7 @@ msp430_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
break;
}
}
- /* Fall through. */
+ [[fallthrough]];
default:
error (_("Unknown msp430 isa"));
break;
diff --git a/gdb/nat/linux-btrace.c b/gdb/nat/linux-btrace.c
index c0cebbb2f02..89bf28b5133 100644
--- a/gdb/nat/linux-btrace.c
+++ b/gdb/nat/linux-btrace.c
@@ -895,8 +895,7 @@ linux_read_pt (btrace_data_pt *btrace, linux_btrace_target_info *tinfo,
case BTRACE_READ_NEW:
if (!perf_event_new_data (&tinfo->pev))
return BTRACE_ERR_NONE;
-
- /* Fall through. */
+ [[fallthrough]];
case BTRACE_READ_ALL:
perf_event_read_all (&tinfo->pev, &btrace->data, &btrace->size);
return BTRACE_ERR_NONE;
diff --git a/gdb/nat/windows-nat.c b/gdb/nat/windows-nat.c
index bf4c4387886..3066ff96a19 100644
--- a/gdb/nat/windows-nat.c
+++ b/gdb/nat/windows-nat.c
@@ -456,7 +456,7 @@ windows_process_info::handle_exception (struct target_waitstatus *ourstatus,
break;
}
#endif
- /* FALLTHROUGH */
+ [[fallthrough]];
case STATUS_WX86_BREAKPOINT:
DEBUG_EXCEPTION_SIMPLE ("EXCEPTION_BREAKPOINT");
ourstatus->set_stopped (GDB_SIGNAL_TRAP);
@@ -495,7 +495,7 @@ windows_process_info::handle_exception (struct target_waitstatus *ourstatus,
break;
}
/* treat improperly formed exception as unknown */
- /* FALLTHROUGH */
+ [[fallthrough]];
default:
/* Treat unhandled first chance exceptions specially. */
if (current_event.u.Exception.dwFirstChance)
diff --git a/gdb/nat/x86-dregs.c b/gdb/nat/x86-dregs.c
index 731093dfa73..16669f69657 100644
--- a/gdb/nat/x86-dregs.c
+++ b/gdb/nat/x86-dregs.c
@@ -289,7 +289,7 @@ Invalid hardware breakpoint type %d in x86_length_and_rw_bits.\n"),
case 8:
if (TARGET_HAS_DR_LEN_8)
return (DR_LEN_8 | rw);
- /* FALL THROUGH */
+ [[fallthrough]];
default:
internal_error (_("\
Invalid hardware breakpoint length %d in x86_length_and_rw_bits.\n"), len);
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 2360a500476..b0f334897ad 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -1159,7 +1159,7 @@ yylex (void)
goto symbol; /* Nope, must be a symbol. */
}
- /* FALL THRU. */
+ [[fallthrough]];
case '0':
case '1':
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index fb9386293a6..678df5eee0d 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -298,7 +298,7 @@ pascal_language::value_print_inner (struct value *val,
gdb_printf (stream, "{...}");
break;
}
- /* Fall through. */
+ [[fallthrough]];
case TYPE_CODE_STRUCT:
if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
{
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 98f38b2598d..27a4eb3eec6 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -482,7 +482,7 @@ print_scalar_formatted (const gdb_byte *valaddr, struct type *type,
byte_order);
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case 'f':
print_floating (valaddr, type, stream);
break;
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index e084196b841..e8498fc4901 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -231,7 +231,7 @@ record_btrace_get_cpu (void)
case CS_NONE:
record_btrace_cpu.vendor = CV_UNKNOWN;
- /* Fall through. */
+ [[fallthrough]];
case CS_CPU:
return &record_btrace_cpu;
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 1bc59928dcf..21081d667d6 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -8123,7 +8123,7 @@ Packet: '%s'\n"),
if (event->ws.kind () != TARGET_WAITKIND_IGNORE)
break;
- /* fall through */
+ [[fallthrough]];
case 'S': /* Old style status, just signal only. */
{
int sig;
@@ -8647,7 +8647,7 @@ remote_target::wait_as (ptid_t ptid, target_waitstatus *status,
putpkt (buf);
break;
}
- /* fallthrough */
+ [[fallthrough]];
default:
warning (_("Invalid remote reply: %s"), buf);
break;
@@ -9990,7 +9990,7 @@ remote_target::putpkt_binary (const char *buf, int cnt)
return 1;
case '-':
remote_debug_printf_nofunc ("Received Nak");
- /* FALLTHROUGH */
+ [[fallthrough]];
case SERIAL_TIMEOUT:
tcount++;
if (tcount > 3)
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 3725be44276..8849483d4d4 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -3183,7 +3183,7 @@ riscv_arg_location (struct gdbarch *gdbarch,
riscv_call_arg_struct (ainfo, cinfo);
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
default:
riscv_call_arg_scalar_int (ainfo, cinfo);
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index fef47f8a6b0..16f3da9c011 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -4309,7 +4309,7 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
case 39: /* Vector Multiply-Sum Unsigned Halfword Saturate */
case 41: /* Vector Multiply-Sum Signed Halfword Saturate */
record_full_arch_list_add_reg (regcache, PPC_VSCR_REGNUM);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 20: /* Move To VSR Byte Mask Immediate opcode, b2 = 0,
ignore bit 31 */
case 21: /* Move To VSR Byte Mask Immediate opcode, b2 = 1,
@@ -4375,7 +4375,7 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
&& vra != 7 /* Decimal Convert From National */
&& vra != 31) /* Decimal Set Sign */
break;
- /* Fall through. */
+ [[fallthrough]];
/* 5.16 Decimal Integer Arithmetic Instructions */
case 1: /* Decimal Add Modulo */
case 65: /* Decimal Subtract Modulo */
@@ -4564,7 +4564,7 @@ ppc_process_record_op4 (struct gdbarch *gdbarch, struct regcache *regcache,
case 970: /* Vector Convert To Signed Fixed-Point Word Saturate */
case 906: /* Vector Convert To Unsigned Fixed-Point Word Saturate */
record_full_arch_list_add_reg (regcache, PPC_VSCR_REGNUM);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 12: /* Vector Merge High Byte */
case 14: /* Vector Pack Unsigned Halfword Unsigned Modulo */
case 76: /* Vector Merge High Halfword */
@@ -4897,7 +4897,7 @@ ppc_process_record_op19 (struct gdbarch *gdbarch, struct regcache *regcache,
case 560: /* Branch Conditional to Branch Target Address Register */
if ((PPC_BO (insn) & 0x4) == 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 528: /* Branch Conditional to Count Register */
if (PPC_LK (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum);
@@ -4988,7 +4988,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
case 491: /* Divide Word */
if (PPC_OE (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 9: /* Multiply High Doubleword Unsigned */
case 11: /* Multiply High Word Unsigned */
case 73: /* Multiply High Doubleword */
@@ -5080,7 +5080,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 0: /* Compare */
case 32: /* Compare logical */
case 144: /* Move To Condition Register Fields */
@@ -5103,7 +5103,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
case 373: /* Load Word Algebraic with Update Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 21: /* Load Doubleword Indexed */
case 52: /* Load Byte And Reserve Indexed */
case 116: /* Load Halfword And Reserve Indexed */
@@ -5176,7 +5176,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
case 631: /* Load Floating-Point Double with Update Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 535: /* Load Floating-Point Single Indexed */
case 599: /* Load Floating-Point Double Indexed */
case 855: /* Load Floating-Point as Integer Word Algebraic Indexed */
@@ -5272,7 +5272,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
case 759: /* Store Floating-Point Double with Update Indexed */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 135: /* Store Vector Element Byte Indexed */
case 167: /* Store Vector Element Halfword Indexed */
case 199: /* Store Vector Element Word Indexed */
@@ -5566,7 +5566,7 @@ ppc_process_record_op31 (struct gdbarch *gdbarch, struct regcache *regcache,
case 878: /* Transaction Abort Doubleword Conditional Immediate */
case 910: /* Transaction Abort */
record_full_arch_list_add_reg (regcache, tdep->ppc_ps_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 718: /* Transaction Check */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
return 0;
@@ -5790,7 +5790,7 @@ ppc_process_record_op60_XX2 (struct gdbarch *gdbarch,
case 24: /* VSX Vector Convert Half-Precision format to
Single-Precision format */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* Fall-through */
+ [[fallthrough]];
case 0: /* VSX Vector Extract Exponent Double-Precision */
case 1: /* VSX Vector Extract Significand Double-Precision */
case 7: /* VSX Vector Byte-Reverse Halfword */
@@ -5884,7 +5884,7 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
case 19: /* VSX Scalar Compare Greater Than or Equal
Double-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 240: /* VSX Vector Copy Sign Double-Precision */
case 208: /* VSX Vector Copy Sign Single-Precision */
case 130: /* VSX Logical AND */
@@ -6071,7 +6071,7 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
case 203: /* VSX Vector Square Root Double-Precision */
case 139: /* VSX Vector Square Root Single-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 345: /* VSX Scalar Absolute Value Double-Precision */
case 267: /* VSX Scalar Convert Scalar Single-Precision to
Vector Single-Precision format Non-signalling */
@@ -6094,7 +6094,7 @@ ppc_process_record_op60 (struct gdbarch *gdbarch, struct regcache *regcache,
case 298: /* VSX Scalar Test Data Class Single-Precision */
case 362: /* VSX Scalar Test Data Class Double-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 106: /* VSX Scalar Test for software Square Root
Double-Precision */
case 234: /* VSX Vector Test for software Square Root
@@ -6366,7 +6366,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
case 22: /* Move From FPSCR Control & set RN */
case 23: /* Move From FPSCR Control & set RN Immediate */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* Fall through. */
+ [[fallthrough]];
case 0: /* Move From FPSCR */
case 24: /* Move From FPSCR Lightweight */
if (PPC_FIELD (insn, 11, 5) == 0 && PPC_RC (insn))
@@ -6412,7 +6412,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
case 644: /* VSX Scalar Compare Unordered Quad-Precision */
case 708: /* VSX Scalar Test Data Class Quad-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 128: /* Floating Test for software Divide */
case 160: /* Floating Test for software Square Root */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
@@ -6449,7 +6449,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
}
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 68: /* VSX Scalar Compare Equal Quad-Precision */
case 196: /* VSX Scalar Compare Greater Than or Equal
Quad-Precision */
@@ -6457,7 +6457,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
case 676: /* VSX Scalar Maximum Type-C Quad-Precision */
case 740: /* VSX Scalar Minimum Type-C Quad-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 100: /* VSX Scalar Copy Sign Quad-Precision */
case 868: /* VSX Scalar Insert Exponent Quad-Precision */
ppc_record_vsr (regcache, tdep, PPC_VRT (insn) + 32);
@@ -6468,7 +6468,7 @@ ppc_process_record_op63 (struct gdbarch *gdbarch, struct regcache *regcache,
{
case 27: /* VSX Scalar Square Root Quad-Precision */
record_full_arch_list_add_reg (regcache, tdep->ppc_fpscr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 0: /* VSX Scalar Absolute Quad-Precision */
case 2: /* VSX Scalar Extract Exponent Quad-Precision */
case 8: /* VSX Scalar Negative Absolute Quad-Precision */
@@ -7233,10 +7233,10 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 13: /* Add Immediate Carrying and Record */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 12: /* Add Immediate Carrying */
record_full_arch_list_add_reg (regcache, tdep->ppc_xer_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 14: /* Add Immediate */
case 15: /* Add Immediate Shifted */
record_full_arch_list_add_reg (regcache,
@@ -7246,7 +7246,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 16: /* Branch Conditional */
if ((PPC_BO (insn) & 0x4) == 0)
record_full_arch_list_add_reg (regcache, tdep->ppc_ctr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 18: /* Branch */
if (PPC_LK (insn))
record_full_arch_list_add_reg (regcache, tdep->ppc_lr_regnum);
@@ -7275,7 +7275,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 28: /* AND Immediate */
case 29: /* AND Immediate Shifted */
record_full_arch_list_add_reg (regcache, tdep->ppc_cr_regnum);
- /* FALL-THROUGH */
+ [[fallthrough]];
case 24: /* OR Immediate */
case 25: /* OR Immediate Shifted */
case 26: /* XOR Immediate */
@@ -7295,7 +7295,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 43: /* Load Halfword Algebraic with Update */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 32: /* Load Word and Zero */
case 34: /* Load Byte and Zero */
case 40: /* Load Halfword and Zero */
@@ -7319,7 +7319,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 51: /* Load Floating-Point Double with Update */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 48: /* Load Floating-Point Single */
case 50: /* Load Floating-Point Double */
record_full_arch_list_add_reg (regcache,
@@ -7347,7 +7347,7 @@ ppc_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
case 55: /* Store Floating-Point Double with Update */
record_full_arch_list_add_reg (regcache,
tdep->ppc_gp0_regnum + PPC_RA (insn));
- /* FALL-THROUGH */
+ [[fallthrough]];
case 36: /* Store Word */
case 38: /* Store Byte */
case 44: /* Store Halfword */
diff --git a/gdb/rust-parse.c b/gdb/rust-parse.c
index d2f6008026f..aaf4cef0d7e 100644
--- a/gdb/rust-parse.c
+++ b/gdb/rust-parse.c
@@ -1386,7 +1386,7 @@ rust_parser::parse_binop (bool required)
case COMPOUND_ASSIGN:
compound_assign_op = current_opcode;
- /* FALLTHROUGH */
+ [[fallthrough]];
case '=':
precedence = ASSIGN_PREC;
lex ();
@@ -1831,7 +1831,7 @@ rust_parser::parse_path (bool for_expr)
if (current_token != COLONCOLON)
return "self";
lex ();
- /* FALLTHROUGH */
+ [[fallthrough]];
case KW_SUPER:
while (current_token == KW_SUPER)
{
diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c
index 54b5c89e5e3..5b58cb382e3 100644
--- a/gdb/s390-tdep.c
+++ b/gdb/s390-tdep.c
@@ -4376,7 +4376,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
}
/* For other instructions... */
- /* Fall through. */
+ [[fallthrough]];
default:
gdb_printf (gdb_stdlog, "Warning: Unknown KM* function %02x at %s.\n",
(int)tmp, paddress (gdbarch, addr));
@@ -4685,7 +4685,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
break;
}
/* For KLMD... */
- /* Fall through. */
+ [[fallthrough]];
default:
gdb_printf (gdb_stdlog, "Warning: Unknown KMAC function %02x at %s.\n",
(int)tmp, paddress (gdbarch, addr));
@@ -6542,7 +6542,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* op3c */
if (record_full_arch_list_add_reg (regcache, S390_R0_REGNUM + inib[3]))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x0c: /* CSST */
/* op4 */
if (record_full_arch_list_add_mem (oaddr2, 4))
@@ -6557,7 +6557,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 4))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x10: /* CSDST */
/* op6 */
if (target_read_memory (oaddr2 + 0x68, buf, 8))
@@ -6573,7 +6573,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 4))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x04: /* CS */
CS:
/* op1c */
@@ -6598,7 +6598,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 8))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x11: /* CSDSTG */
/* op6 */
if (target_read_memory (oaddr2 + 0x68, buf, 8))
@@ -6607,7 +6607,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 8))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x0d: /* CSSTG */
CSSTG:
/* op4 */
@@ -6617,7 +6617,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 8))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x05: /* CSG */
/* op1c */
if (record_full_arch_list_add_mem (oaddr2 + 0x08, 8))
@@ -6631,7 +6631,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
/* op3c */
if (s390_record_gpr_g (gdbarch, regcache, inib[3]))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x0e: /* CSSTGR */
/* op4 */
if (record_full_arch_list_add_mem (oaddr2, 8))
@@ -6646,7 +6646,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 8))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x12: /* CSDSTGR */
/* op6 */
if (target_read_memory (oaddr2 + 0x68, buf, 8))
@@ -6662,7 +6662,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 8))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x06: /* CSGR */
CSGR:
/* op1c */
@@ -6687,7 +6687,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 16))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x13: /* CSDSTX */
/* op6 */
if (target_read_memory (oaddr2 + 0x68, buf, 8))
@@ -6696,7 +6696,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 16))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x0f: /* CSSTX */
CSSTX:
/* op4 */
@@ -6706,7 +6706,7 @@ s390_process_record (struct gdbarch *gdbarch, struct regcache *regcache,
oaddr3 = s390_record_address_mask (gdbarch, regcache, oaddr3);
if (record_full_arch_list_add_mem (oaddr3, 16))
return -1;
- /* fallthru */
+ [[fallthrough]];
case 0x07: /* CSX */
/* op1c */
if (record_full_arch_list_add_mem (oaddr2 + 0x00, 16))
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 4011475f7ac..088058030a3 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1100,7 +1100,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
}
break;
}
- /* Fall through. */
+ [[fallthrough]];
case 'P':
/* acc seems to use P to declare the prototypes of functions that
@@ -1111,7 +1111,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
sym->set_type (read_type (&p, objfile));
goto process_prototype_types;
}
- /*FALLTHROUGH */
+ [[fallthrough]];
case 'R':
/* Parameter which is in a register. */
@@ -2499,7 +2499,7 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
complaint (_("member function type missing, got '%c'"),
(*pp)[-1]);
/* Normal member function. */
- /* Fall through. */
+ [[fallthrough]];
case '.':
/* normal member function. */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index c5af186ad33..09aa70be1d5 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3043,7 +3043,7 @@ section_is_mapped (struct obj_section *osect)
if (osect->ovly_mapped == -1)
gdbarch_overlay_update (gdbarch, osect);
}
- /* fall thru */
+ [[fallthrough]];
case ovly_on: /* overlay debugging manual */
return osect->ovly_mapped == 1;
}
diff --git a/gdb/utils.c b/gdb/utils.c
index 7a1841ba21e..5ec8c5671f3 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -218,7 +218,7 @@ can_dump_core (enum resource_limit_kind limit_kind)
case LIMIT_CUR:
if (rlim.rlim_cur == 0)
return 0;
- /* Fall through. */
+ [[fallthrough]];
case LIMIT_MAX:
if (rlim.rlim_max == 0)
diff --git a/gdb/valops.c b/gdb/valops.c
index a8760ccf3e4..6521580a1e8 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1280,7 +1280,7 @@ value_assign (struct value *toval, struct value *fromval)
break;
}
}
- /* Fall through. */
+ [[fallthrough]];
default:
error (_("Left operand of assignment is not an lvalue."));
@@ -2820,7 +2820,7 @@ find_overload_match (gdb::array_view<value *> args,
case where a xmethod is better than the source
method, except when the xmethod match quality is
non-standard. */
- /* FALLTHROUGH */
+ [[fallthrough]];
case 1: /* Src method and ext method are incompatible. */
/* If ext method match is not standard, then let source method
win. Otherwise, fallthrough to let xmethod win. */
@@ -2832,7 +2832,7 @@ find_overload_match (gdb::array_view<value *> args,
method_match_quality = src_method_match_quality;
break;
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case 2: /* Ext method is champion. */
method_oload_champ = ext_method_oload_champ;
method_badness = ext_method_badness;
diff --git a/gdb/value.c b/gdb/value.c
index 7067ae94df0..b4da9675039 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -3336,7 +3336,7 @@ pack_long (gdb_byte *buf, struct type *type, LONGEST num)
{
case TYPE_CODE_RANGE:
num -= type->bounds ()->bias;
- /* Fall through. */
+ [[fallthrough]];
case TYPE_CODE_INT:
case TYPE_CODE_CHAR:
case TYPE_CODE_ENUM:
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b3440344c74..6daea8ecf1c 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -2286,14 +2286,14 @@ redir_open (const char *redir_string, int *inp, int *out, int *err)
{
case '0':
fname++;
- /* FALLTHROUGH */
+ [[fallthrough]];
case '<':
fd = inp;
mode = O_RDONLY;
break;
case '1': case '2':
fname++;
- /* FALLTHROUGH */
+ [[fallthrough]];
case '>':
fd = (rc == '2') ? err : out;
mode = O_WRONLY | O_CREAT;
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index 829fc1f09c7..856fa134ed7 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1532,7 +1532,7 @@ process_xcoff_symbol (struct xcoff_symbol *cs, struct objfile *objfile)
default:
complaint (_("Unexpected storage class: %d"),
cs->c_sclass);
- /* FALLTHROUGH */
+ [[fallthrough]];
case C_DECL:
case C_PSYM:
@@ -2359,7 +2359,7 @@ scan_xcoff_symtab (minimal_symbol_reader &reader,
complaint (_("Storage class %d not recognized during scan"),
sclass);
}
- /* FALLTHROUGH */
+ [[fallthrough]];
case C_FCN:
/* C_FCN is .bf and .ef symbols. I think it is sufficient
diff --git a/gdb/z80-tdep.c b/gdb/z80-tdep.c
index ae328550b06..f0cc7c0d917 100644
--- a/gdb/z80-tdep.c
+++ b/gdb/z80-tdep.c
@@ -799,7 +799,7 @@ z80_software_single_step (struct regcache *regcache)
break;
case insn_jr_cc_d:
opcode &= 030; /* JR NZ,d has cc equal to 040, but others 000 */
- /* fall through */
+ [[fallthrough]];
case insn_jp_cc_nn:
case insn_call_cc_nn:
case insn_ret_cc:
diff --git a/gdbserver/netbsd-low.cc b/gdbserver/netbsd-low.cc
index 4defd79eee4..10d8d280b98 100644
--- a/gdbserver/netbsd-low.cc
+++ b/gdbserver/netbsd-low.cc
@@ -410,7 +410,7 @@ netbsd_process_target::wait (ptid_t ptid, struct target_waitstatus *ourstatus,
case TARGET_WAITKIND_THREAD_CREATED:
case TARGET_WAITKIND_THREAD_EXITED:
/* The core needlessly stops on these events. */
- /* FALLTHROUGH */
+ [[fallthrough]];
case TARGET_WAITKIND_SPURIOUS:
/* Spurious events are unhandled by the gdbserver core. */
if (ptrace (PT_CONTINUE, current_process ()->pid, (void *) 1, 0)
diff --git a/gdbsupport/btrace-common.cc b/gdbsupport/btrace-common.cc
index 932a11888b0..c09fd504270 100644
--- a/gdbsupport/btrace-common.cc
+++ b/gdbsupport/btrace-common.cc
@@ -134,8 +134,7 @@ btrace_data_append (struct btrace_data *dst,
case BTRACE_FORMAT_NONE:
dst->format = BTRACE_FORMAT_BTS;
dst->variant.bts.blocks = new std::vector<btrace_block>;
-
- /* Fall-through. */
+ [[fallthrough]];
case BTRACE_FORMAT_BTS:
{
unsigned int blk;
@@ -163,8 +162,7 @@ btrace_data_append (struct btrace_data *dst,
dst->format = BTRACE_FORMAT_PT;
dst->variant.pt.data = NULL;
dst->variant.pt.size = 0;
-
- /* fall-through. */
+ [[fallthrough]];
case BTRACE_FORMAT_PT:
{
gdb_byte *data;
diff --git a/gdbsupport/format.cc b/gdbsupport/format.cc
index 6e5a3cb6603..85d1f9a8905 100644
--- a/gdbsupport/format.cc
+++ b/gdbsupport/format.cc
@@ -257,14 +257,14 @@ format_pieces::format_pieces (const char **arg, bool gdb_extensions,
case 'u':
if (seen_hash)
bad = 1;
- /* FALLTHROUGH */
+ [[fallthrough]];
case 'o':
case 'x':
case 'X':
if (seen_space || seen_plus)
bad = 1;
- /* FALLTHROUGH */
+ [[fallthrough]];
case 'd':
case 'i':
--
2.41.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 8/8] Remove gdb_static_assert
2023-11-21 15:27 Tom Tromey
` (6 preceding siblings ...)
2023-11-21 15:27 ` [PATCH v2 7/8] Use C++17 void_t Tom Tromey
@ 2023-11-21 15:27 ` Tom Tromey
2023-11-29 23:28 ` (unknown) Tom Tromey
8 siblings, 0 replies; 15+ messages in thread
From: Tom Tromey @ 2023-11-21 15:27 UTC (permalink / raw)
To: gdb-patches; +Cc: Tom Tromey
C++17 makes the second parameter to static_assert optional, so we can
remove gdb_static_assert now.
---
gdb/aarch64-linux-nat.c | 8 ++---
gdb/aarch64-tdep.c | 4 +--
gdb/addrmap.c | 4 +--
gdb/alpha-tdep.c | 2 +-
gdb/arc-linux-tdep.c | 4 +--
gdb/arc-tdep.c | 2 +-
gdb/avr-tdep.c | 2 +-
gdb/bpf-tdep.c | 2 +-
gdb/charset.c | 2 +-
gdb/command.h | 4 +--
gdb/cris-tdep.c | 2 +-
gdb/defs.h | 2 +-
gdb/disasm.c | 2 +-
gdb/dwarf2/read-gdb-index.c | 4 +--
gdb/dwarf2/read.c | 2 +-
gdb/f-array-walker.h | 2 +-
gdb/ft32-tdep.c | 2 +-
gdb/gdb_bfd.c | 2 +-
gdb/hppa-tdep.c | 4 +--
gdb/iq2000-tdep.c | 2 +-
gdb/linux-tdep.c | 2 +-
gdb/lm32-tdep.c | 2 +-
gdb/m32r-tdep.c | 2 +-
gdb/m68k-tdep.c | 2 +-
gdb/mi/mi-common.c | 2 +-
gdb/microblaze-tdep.c | 2 +-
gdb/moxie-tdep.c | 2 +-
gdb/msp430-tdep.c | 2 +-
gdb/nat/amd64-linux-siginfo.c | 10 +++---
gdb/nios2-tdep.c | 2 +-
gdb/remote-notif.c | 2 +-
gdb/riscv-tdep.c | 2 +-
gdb/symfile-mem.c | 6 ++--
gdb/symtab.c | 2 +-
gdb/symtab.h | 6 ++--
gdb/tilegx-tdep.c | 2 +-
gdb/trad-frame.c | 2 +-
gdb/unittests/enum-flags-selftests.c | 46 ++++++++++++++--------------
gdb/unittests/packed-selftests.c | 18 +++++------
gdb/v850-tdep.c | 6 ++--
gdb/value.c | 2 +-
gdb/vax-tdep.c | 2 +-
gdb/windows-tdep.c | 2 +-
gdb/xstormy16-tdep.c | 2 +-
gdbserver/i387-fp.cc | 4 +--
gdbserver/server.cc | 2 +-
gdbserver/server.h | 2 +-
gdbsupport/gdb_assert.h | 5 ---
gdbsupport/packed.h | 16 +++++-----
gdbsupport/pathstuff.h | 2 +-
50 files changed, 106 insertions(+), 111 deletions(-)
diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c
index 0e87aaa9b7a..5b4e3c2bde1 100644
--- a/gdb/aarch64-linux-nat.c
+++ b/gdb/aarch64-linux-nat.c
@@ -137,7 +137,7 @@ fetch_gregs_from_thread (struct regcache *regcache)
/* Make sure REGS can hold all registers contents on both aarch64
and arm. */
- gdb_static_assert (sizeof (regs) >= 18 * 4);
+ static_assert (sizeof (regs) >= 18 * 4);
tid = regcache->ptid ().lwp ();
@@ -175,7 +175,7 @@ store_gregs_to_thread (const struct regcache *regcache)
/* Make sure REGS can hold all registers contents on both aarch64
and arm. */
- gdb_static_assert (sizeof (regs) >= 18 * 4);
+ static_assert (sizeof (regs) >= 18 * 4);
tid = regcache->ptid ().lwp ();
iovec.iov_base = ®s;
@@ -217,7 +217,7 @@ fetch_fpregs_from_thread (struct regcache *regcache)
/* Make sure REGS can hold all VFP registers contents on both aarch64
and arm. */
- gdb_static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
+ static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
tid = regcache->ptid ().lwp ();
@@ -264,7 +264,7 @@ store_fpregs_to_thread (const struct regcache *regcache)
/* Make sure REGS can hold all VFP registers contents on both aarch64
and arm. */
- gdb_static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
+ static_assert (sizeof regs >= ARM_VFP3_REGS_SIZE);
tid = regcache->ptid ().lwp ();
iovec.iov_base = ®s;
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index ba37b4969a3..4a7ce68e85a 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -3113,7 +3113,7 @@ aarch64_pseudo_read_value_1 (struct gdbarch *gdbarch,
/* Enough space for a full vector register. */
gdb_byte reg_buf[register_size (gdbarch, AARCH64_V0_REGNUM)];
- gdb_static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
+ static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
if (regcache->raw_read (v_regnum, reg_buf) != REG_VALID)
result_value->mark_bytes_unavailable (0,
@@ -3323,7 +3323,7 @@ aarch64_pseudo_write_1 (struct gdbarch *gdbarch, struct regcache *regcache,
/* Enough space for a full vector register. */
gdb_byte reg_buf[register_size (gdbarch, AARCH64_V0_REGNUM)];
- gdb_static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
+ static_assert (AARCH64_V0_REGNUM == AARCH64_SVE_Z0_REGNUM);
/* Ensure the register buffer is zero, we want gdb writes of the
various 'scalar' pseudo registers to behavior like architectural
diff --git a/gdb/addrmap.c b/gdb/addrmap.c
index 076062a0206..b10888008c9 100644
--- a/gdb/addrmap.c
+++ b/gdb/addrmap.c
@@ -24,8 +24,8 @@
/* Make sure splay trees can actually hold the values we want to
store in them. */
-gdb_static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *));
-gdb_static_assert (sizeof (splay_tree_value) >= sizeof (void *));
+static_assert (sizeof (splay_tree_key) >= sizeof (CORE_ADDR *));
+static_assert (sizeof (splay_tree_value) >= sizeof (void *));
\f
/* Fixed address maps. */
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index 9fb973597fc..0d3a4955053 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -98,7 +98,7 @@ alpha_register_name (struct gdbarch *gdbarch, int regno)
"pc", "", "unique"
};
- gdb_static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (register_names));
+ static_assert (ALPHA_NUM_REGS == ARRAY_SIZE (register_names));
return register_names[regno];
}
diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
index 8c0f7ae3c95..33dabc70d4c 100644
--- a/gdb/arc-linux-tdep.c
+++ b/gdb/arc-linux-tdep.c
@@ -549,7 +549,7 @@ arc_linux_supply_gregset (const struct regset *regset,
struct regcache *regcache,
int regnum, const void *gregs, size_t size)
{
- gdb_static_assert (ARC_LAST_REGNUM
+ static_assert (ARC_LAST_REGNUM
< ARRAY_SIZE (arc_linux_core_reg_offsets));
const bfd_byte *buf = (const bfd_byte *) gregs;
@@ -612,7 +612,7 @@ arc_linux_collect_gregset (const struct regset *regset,
const struct regcache *regcache,
int regnum, void *gregs, size_t size)
{
- gdb_static_assert (ARC_LAST_REGNUM
+ static_assert (ARC_LAST_REGNUM
< ARRAY_SIZE (arc_linux_core_reg_offsets));
gdb_byte *buf = (gdb_byte *) gregs;
diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index a22b5bff246..44e26ae2c1d 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -344,7 +344,7 @@ arc_insn_get_operand_value_signed (const struct arc_instruction &insn,
/* Convert unsigned raw value to signed one. This assumes 2's
complement arithmetic, but so is the LONG_MIN value from generic
defs.h and that assumption is true for ARC. */
- gdb_static_assert (sizeof (insn.limm_value) == sizeof (int));
+ static_assert (sizeof (insn.limm_value) == sizeof (int));
return (((LONGEST) insn.limm_value) ^ INT_MIN) - INT_MIN;
case ARC_OPERAND_KIND_SHIMM:
/* Sign conversion has been done by binutils. */
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 598d740883c..be0601056a8 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -216,7 +216,7 @@ avr_register_name (struct gdbarch *gdbarch, int regnum)
"SREG", "SP", "PC2",
"pc"
};
- gdb_static_assert (ARRAY_SIZE (register_names)
+ static_assert (ARRAY_SIZE (register_names)
== (AVR_NUM_REGS + AVR_NUM_PSEUDO_REGS));
return register_names[regnum];
}
diff --git a/gdb/bpf-tdep.c b/gdb/bpf-tdep.c
index 97a6d75a68b..d2b0d3f7ea2 100644
--- a/gdb/bpf-tdep.c
+++ b/gdb/bpf-tdep.c
@@ -93,7 +93,7 @@ static const char *bpf_register_names[] =
static const char *
bpf_register_name (struct gdbarch *gdbarch, int reg)
{
- gdb_static_assert (ARRAY_SIZE (bpf_register_names) == BPF_NUM_REGS);
+ static_assert (ARRAY_SIZE (bpf_register_names) == BPF_NUM_REGS);
return bpf_register_names[reg];
}
diff --git a/gdb/charset.c b/gdb/charset.c
index bce6050c97f..ac2613f4c88 100644
--- a/gdb/charset.c
+++ b/gdb/charset.c
@@ -939,7 +939,7 @@ default_auto_wide_charset (void)
/* GDB cannot handle strings correctly if this size is different. */
-gdb_static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4);
+static_assert (sizeof (gdb_wchar_t) == 2 || sizeof (gdb_wchar_t) == 4);
/* intermediate_encoding returns the charset used internally by
GDB to convert between target and host encodings. As the test above
diff --git a/gdb/command.h b/gdb/command.h
index 1ab953b996b..9d849575637 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -292,8 +292,8 @@ struct setting
/* Getters and setters are cast to and from the arbitrary `void (*) ()`
function pointer type. Make sure that the two types are really of the
same size. */
- gdb_static_assert (sizeof (m_getter) == sizeof (getter));
- gdb_static_assert (sizeof (m_setter) == sizeof (setter));
+ static_assert (sizeof (m_getter) == sizeof (getter));
+ static_assert (sizeof (m_setter) == sizeof (setter));
m_getter = reinterpret_cast<erased_func> (getter);
m_setter = reinterpret_cast<erased_func> (setter);
diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c
index 9847516d9b8..783042a920e 100644
--- a/gdb/cris-tdep.c
+++ b/gdb/cris-tdep.c
@@ -1669,7 +1669,7 @@ cris_register_name (struct gdbarch *gdbarch, int regno)
if (regno < NUM_GENREGS)
{
/* General register. */
- gdb_static_assert (ARRAY_SIZE (cris_genreg_names) == NUM_GENREGS);
+ static_assert (ARRAY_SIZE (cris_genreg_names) == NUM_GENREGS);
return cris_genreg_names[regno];
}
else if (regno >= NUM_GENREGS && regno < gdbarch_num_regs (gdbarch))
diff --git a/gdb/defs.h b/gdb/defs.h
index e6dd93e791e..bcce4f4c3e4 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -229,7 +229,7 @@ enum language
/* The number of bits needed to represent all languages, with enough
padding to allow for reasonable growth. */
#define LANGUAGE_BITS 5
-gdb_static_assert (nr_languages <= (1 << LANGUAGE_BITS));
+static_assert (nr_languages <= (1 << LANGUAGE_BITS));
/* The number of bytes needed to represent all languages. */
#define LANGUAGE_BYTES ((LANGUAGE_BITS + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT)
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 82b7e990ff9..32eabb71af1 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -1149,7 +1149,7 @@ gdb_disassembler::print_insn (CORE_ADDR memaddr,
To do this we perform an in-place new, but this time turn on
the styling support, then we can re-disassembly the
instruction, and gain any minimal styling GDB might add. */
- gdb_static_assert ((std::is_same<decltype (m_buffer),
+ static_assert ((std::is_same<decltype (m_buffer),
string_file>::value));
gdb_assert (!m_buffer.term_out ());
m_buffer.~string_file ();
diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c
index 7788626b67a..da180fa8a41 100644
--- a/gdb/dwarf2/read-gdb-index.c
+++ b/gdb/dwarf2/read-gdb-index.c
@@ -648,7 +648,7 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd,
{
for (offset_type i = 0; i < n_elements; i += 2)
{
- gdb_static_assert (sizeof (ULONGEST) >= 8);
+ static_assert (sizeof (ULONGEST) >= 8);
sect_offset sect_off
= (sect_offset) extract_unsigned_integer (cu_list, 8, BFD_ENDIAN_LITTLE);
@@ -700,7 +700,7 @@ create_signatured_type_table_from_gdb_index
void **slot;
cu_offset type_offset_in_tu;
- gdb_static_assert (sizeof (ULONGEST) >= 8);
+ static_assert (sizeof (ULONGEST) >= 8);
sect_offset sect_off
= (sect_offset) extract_unsigned_integer (bytes, 8, BFD_ENDIAN_LITTLE);
type_offset_in_tu
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index ec21cb9e428..bd3ee63be98 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -10292,7 +10292,7 @@ read_call_site_scope (struct die_info *die, struct dwarf2_cu *cu)
/* We never call the destructor of call_site, so we must ensure it is
trivially destructible. */
- gdb_static_assert(std::is_trivially_destructible<struct call_site>::value);
+ static_assert(std::is_trivially_destructible<struct call_site>::value);
if (dwarf2_flag_true_p (die, DW_AT_call_tail_call, cu)
|| dwarf2_flag_true_p (die, DW_AT_GNU_tail_call, cu))
diff --git a/gdb/f-array-walker.h b/gdb/f-array-walker.h
index 569636773f5..de40837cce9 100644
--- a/gdb/f-array-walker.h
+++ b/gdb/f-array-walker.h
@@ -187,7 +187,7 @@ class fortran_array_walker
/* Ensure that Impl is derived from the required base class. This just
ensures that all of the required API methods are available and have a
sensible default implementation. */
- gdb_static_assert ((std::is_base_of<fortran_array_walker_base_impl,Impl>::value));
+ static_assert ((std::is_base_of<fortran_array_walker_base_impl,Impl>::value));
public:
/* Create a new array walker. TYPE is the type of the array being walked
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index cac4b9ba6a2..8ec0aab0b88 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -96,7 +96,7 @@ static const char *const ft32_register_names[] =
static const char *
ft32_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- gdb_static_assert (ARRAY_SIZE (ft32_register_names) == FT32_NUM_REGS);
+ static_assert (ARRAY_SIZE (ft32_register_names) == FT32_NUM_REGS);
return ft32_register_names[reg_nr];
}
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index b72821f4c35..1c496c498ac 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -977,7 +977,7 @@ gdb_bfd_record_inclusion (bfd *includer, bfd *includee)
\f
-gdb_static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
+static_assert (ARRAY_SIZE (_bfd_std_section) == 4);
/* See gdb_bfd.h. */
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index c9452a1c96d..32793aa93f4 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -632,7 +632,7 @@ hppa32_register_name (struct gdbarch *gdbarch, int i)
"fr28", "fr28R", "fr29", "fr29R",
"fr30", "fr30R", "fr31", "fr31R"
};
- gdb_static_assert (ARRAY_SIZE (names) == hppa32_num_regs);
+ static_assert (ARRAY_SIZE (names) == hppa32_num_regs);
return names[i];
}
@@ -665,7 +665,7 @@ hppa64_register_name (struct gdbarch *gdbarch, int i)
"fr24", "fr25", "fr26", "fr27",
"fr28", "fr29", "fr30", "fr31"
};
- gdb_static_assert (ARRAY_SIZE (names) == hppa64_num_regs);
+ static_assert (ARRAY_SIZE (names) == hppa64_num_regs);
return names[i];
}
diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c
index d4509f93b74..48316e71164 100644
--- a/gdb/iq2000-tdep.c
+++ b/gdb/iq2000-tdep.c
@@ -135,7 +135,7 @@ iq2000_register_name (struct gdbarch *gdbarch, int regnum)
"r30", "r31",
"pc"
};
- gdb_static_assert (ARRAY_SIZE (names) == E_NUM_REGS);
+ static_assert (ARRAY_SIZE (names) == E_NUM_REGS);
return names[regnum];
}
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 26cf483b04a..22436c353b8 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1129,7 +1129,7 @@ linux_read_core_file_mappings
read_core_file_mappings_loop_ftype loop_cb)
{
/* Ensure that ULONGEST is big enough for reading 64-bit core files. */
- gdb_static_assert (sizeof (ULONGEST) >= 8);
+ static_assert (sizeof (ULONGEST) >= 8);
/* It's not required that the NT_FILE note exists, so return silently
if it's not found. Beyond this point though, we'll complain
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index 0eecdb6ac40..6744ba96c4e 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -91,7 +91,7 @@ lm32_register_name (struct gdbarch *gdbarch, int reg_nr)
"PC", "EID", "EBA", "DEBA", "IE", "IM", "IP"
};
- gdb_static_assert (ARRAY_SIZE (register_names) == SIM_LM32_NUM_REGS);
+ static_assert (ARRAY_SIZE (register_names) == SIM_LM32_NUM_REGS);
return register_names[reg_nr];
}
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index ba525998e0c..dfb2fdfcb66 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -212,7 +212,7 @@ static const char * const m32r_register_names[] = {
static const char *
m32r_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- gdb_static_assert (ARRAY_SIZE (m32r_register_names) == M32R_NUM_REGS);
+ static_assert (ARRAY_SIZE (m32r_register_names) == M32R_NUM_REGS);
return m32r_register_names[reg_nr];
}
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 5b2a29a350e..0b761d019f2 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -176,7 +176,7 @@ m68k_register_name (struct gdbarch *gdbarch, int regnum)
{
m68k_gdbarch_tdep *tdep = gdbarch_tdep<m68k_gdbarch_tdep> (gdbarch);
- gdb_static_assert (ARRAY_SIZE (m68k_register_names) == M68K_NUM_REGS);
+ static_assert (ARRAY_SIZE (m68k_register_names) == M68K_NUM_REGS);
if (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FPI_REGNUM
&& tdep->fpregs_present == 0)
return "";
diff --git a/gdb/mi/mi-common.c b/gdb/mi/mi-common.c
index ce70d11a912..1c1424ab57d 100644
--- a/gdb/mi/mi-common.c
+++ b/gdb/mi/mi-common.c
@@ -43,7 +43,7 @@ static const char * const async_reason_string_lookup[] =
NULL
};
-gdb_static_assert (ARRAY_SIZE (async_reason_string_lookup)
+static_assert (ARRAY_SIZE (async_reason_string_lookup)
== EXEC_ASYNC_LAST + 1);
const char *
diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c
index 74e70405b3a..e975b7cd553 100644
--- a/gdb/microblaze-tdep.c
+++ b/gdb/microblaze-tdep.c
@@ -92,7 +92,7 @@ static unsigned int microblaze_debug_flag = 0;
static const char *
microblaze_register_name (struct gdbarch *gdbarch, int regnum)
{
- gdb_static_assert (ARRAY_SIZE (microblaze_register_names)
+ static_assert (ARRAY_SIZE (microblaze_register_names)
== MICROBLAZE_NUM_REGS);
return microblaze_register_names[regnum];
}
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 600fb060b1e..14d20be2e38 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -81,7 +81,7 @@ static const char * const moxie_register_names[] = {
static const char *
moxie_register_name (struct gdbarch *gdbarch, int reg_nr)
{
- gdb_static_assert (ARRAY_SIZE (moxie_register_names) == MOXIE_NUM_REGS);
+ static_assert (ARRAY_SIZE (moxie_register_names) == MOXIE_NUM_REGS);
return moxie_register_names[reg_nr];
}
diff --git a/gdb/msp430-tdep.c b/gdb/msp430-tdep.c
index f65948f01d8..c03e12c9486 100644
--- a/gdb/msp430-tdep.c
+++ b/gdb/msp430-tdep.c
@@ -197,7 +197,7 @@ msp430_register_name (struct gdbarch *gdbarch, int regnr)
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15"
};
- gdb_static_assert (ARRAY_SIZE (reg_names) == (MSP430_NUM_REGS
+ static_assert (ARRAY_SIZE (reg_names) == (MSP430_NUM_REGS
+ MSP430_NUM_PSEUDO_REGS));
return reg_names[regnr];
}
diff --git a/gdb/nat/amd64-linux-siginfo.c b/gdb/nat/amd64-linux-siginfo.c
index 00bb5e522f4..0de370d013a 100644
--- a/gdb/nat/amd64-linux-siginfo.c
+++ b/gdb/nat/amd64-linux-siginfo.c
@@ -604,10 +604,10 @@ amd64_linux_siginfo_fixup_common (siginfo_t *ptrace, gdb_byte *inf,
/* Sanity check for the siginfo structure sizes. */
-gdb_static_assert (sizeof (siginfo_t) == GDB_SI_SIZE);
+static_assert (sizeof (siginfo_t) == GDB_SI_SIZE);
#ifndef __ILP32__
-gdb_static_assert (sizeof (nat_siginfo_t) == GDB_SI_SIZE);
+static_assert (sizeof (nat_siginfo_t) == GDB_SI_SIZE);
#endif
-gdb_static_assert (sizeof (compat_x32_siginfo_t) == GDB_SI_SIZE);
-gdb_static_assert (sizeof (compat_siginfo_t) == GDB_SI_SIZE);
-gdb_static_assert (sizeof (ptrace_siginfo_t) == GDB_SI_SIZE);
+static_assert (sizeof (compat_x32_siginfo_t) == GDB_SI_SIZE);
+static_assert (sizeof (compat_siginfo_t) == GDB_SI_SIZE);
+static_assert (sizeof (ptrace_siginfo_t) == GDB_SI_SIZE);
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 40d65b64b18..91c03895113 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -140,7 +140,7 @@ static int nios2_dwarf2gdb_regno_map[] =
NIOS2_MPUACC_REGNUM /* 48 */
};
-gdb_static_assert (ARRAY_SIZE (nios2_dwarf2gdb_regno_map) == NIOS2_NUM_REGS);
+static_assert (ARRAY_SIZE (nios2_dwarf2gdb_regno_map) == NIOS2_NUM_REGS);
/* Implement the dwarf2_reg_to_regnum gdbarch method. */
diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c
index dfa1d33a7e1..997b6e7ae26 100644
--- a/gdb/remote-notif.c
+++ b/gdb/remote-notif.c
@@ -51,7 +51,7 @@ static const notif_client *const notifs[] =
¬if_client_stop,
};
-gdb_static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
+static_assert (ARRAY_SIZE (notifs) == REMOTE_NOTIF_LAST);
/* Parse the BUF for the expected notification NC, and send packet to
acknowledge. */
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index 8849483d4d4..2b4b9e2a02a 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -441,7 +441,7 @@ struct riscv_freg_feature : public riscv_register_feature
RISCV_LAST_FP_REGNUM. */
const char *register_name (int regnum) const
{
- gdb_static_assert (RISCV_LAST_FP_REGNUM == RISCV_FIRST_FP_REGNUM + 31);
+ static_assert (RISCV_LAST_FP_REGNUM == RISCV_FIRST_FP_REGNUM + 31);
gdb_assert (regnum >= RISCV_FIRST_FP_REGNUM
&& regnum <= RISCV_LAST_FP_REGNUM);
regnum -= RISCV_FIRST_FP_REGNUM;
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 8ec61199d14..d35d45c7a86 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -58,9 +58,9 @@
/* Verify parameters of target_read_memory_bfd and target_read_memory are
compatible. */
-gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (bfd_vma));
-gdb_static_assert (sizeof (gdb_byte) == sizeof (bfd_byte));
-gdb_static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type));
+static_assert (sizeof (CORE_ADDR) >= sizeof (bfd_vma));
+static_assert (sizeof (gdb_byte) == sizeof (bfd_byte));
+static_assert (sizeof (ssize_t) <= sizeof (bfd_size_type));
/* Provide bfd/ compatible prototype for target_read_memory. Casting would not
be enough as LEN width may differ. */
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 15471554f32..9fd886c1d69 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -6392,7 +6392,7 @@ gdb::array_view<const struct symbol_impl> symbol_impls (symbol_impl);
/* Make sure we saved enough room in struct symbol. */
-gdb_static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_ACLASS_BITS));
+static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_ACLASS_BITS));
/* Register a computed symbol type. ACLASS must be LOC_COMPUTED. OPS
is the ops vector associated with this index. This returns the new
diff --git a/gdb/symtab.h b/gdb/symtab.h
index ec2ac4942d3..c224f479714 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -706,7 +706,7 @@ enum minimal_symbol_type
/* The number of enum minimal_symbol_type values, with some padding for
reasonable growth. */
#define MINSYM_TYPE_BITS 4
-gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS));
+static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS));
/* Define a simple structure used to hold some very basic information about
all defined global symbols (text, data, bss, abs, etc). The only required
@@ -924,7 +924,7 @@ enum domain_enum
/* The number of bits in a symbol used to represent the domain. */
#define SYMBOL_DOMAIN_BITS 3
-gdb_static_assert (NR_DOMAINS <= (1 << SYMBOL_DOMAIN_BITS));
+static_assert (NR_DOMAINS <= (1 << SYMBOL_DOMAIN_BITS));
extern const char *domain_name (domain_enum);
@@ -1070,7 +1070,7 @@ enum address_class
verify that we have reserved enough space for synthetic address
classes. */
#define SYMBOL_ACLASS_BITS 5
-gdb_static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
+static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS));
/* The methods needed to implement LOC_COMPUTED. These methods can
use the symbol's .aux_value for additional per-symbol information.
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 1ec37d45d79..d2140ad2157 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -155,7 +155,7 @@ tilegx_register_name (struct gdbarch *gdbarch, int regnum)
"pc", "faultnum",
};
- gdb_static_assert (TILEGX_NUM_REGS == ARRAY_SIZE (register_names));
+ static_assert (TILEGX_NUM_REGS == ARRAY_SIZE (register_names));
return register_names[regnum];
}
diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c
index 6dc7e9aec66..755d3b963b1 100644
--- a/gdb/trad-frame.c
+++ b/gdb/trad-frame.c
@@ -62,7 +62,7 @@ trad_frame_saved_reg *
trad_frame_alloc_saved_regs (struct gdbarch *gdbarch)
{
#ifdef HAVE_IS_TRIVIALLY_CONSTRUCTIBLE
- gdb_static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
+ static_assert (std::is_trivially_constructible<trad_frame_saved_reg>::value);
#endif
int numregs = gdbarch_num_cooked_regs (gdbarch);
diff --git a/gdb/unittests/enum-flags-selftests.c b/gdb/unittests/enum-flags-selftests.c
index 2d3c555d254..460cb7ff29a 100644
--- a/gdb/unittests/enum-flags-selftests.c
+++ b/gdb/unittests/enum-flags-selftests.c
@@ -67,7 +67,7 @@ DEF_ENUM_FLAGS_TYPE (URE, UEF);
/* So that std::vectors of types that have enum_flags fields can
reallocate efficiently memcpy. */
-gdb_static_assert (std::is_trivially_copyable<EF>::value);
+static_assert (std::is_trivially_copyable<EF>::value);
#endif
@@ -407,7 +407,7 @@ self_test ()
{
constexpr test_flags f;
- gdb_static_assert (f == 0);
+ static_assert (f == 0);
}
/* Check that assignment from zero works. */
@@ -428,16 +428,16 @@ self_test ()
constexpr test_flags zero3 {0};
constexpr test_flags zero4 = {0};
- gdb_static_assert (zero1 == 0);
- gdb_static_assert (zero2 == 0);
- gdb_static_assert (zero3 == 0);
- gdb_static_assert (zero4 == 0);
+ static_assert (zero1 == 0);
+ static_assert (zero2 == 0);
+ static_assert (zero3 == 0);
+ static_assert (zero4 == 0);
}
/* Check construction from enum value. */
{
- gdb_static_assert (test_flags (FLAG1) == FLAG1);
- gdb_static_assert (test_flags (FLAG2) != FLAG1);
+ static_assert (test_flags (FLAG1) == FLAG1);
+ static_assert (test_flags (FLAG2) != FLAG1);
}
/* Check copy/assignment. */
@@ -449,10 +449,10 @@ self_test ()
constexpr test_flags f3 {src};
constexpr test_flags f4 = {src};
- gdb_static_assert (f1 == FLAG1);
- gdb_static_assert (f2 == FLAG1);
- gdb_static_assert (f3 == FLAG1);
- gdb_static_assert (f4 == FLAG1);
+ static_assert (f1 == FLAG1);
+ static_assert (f2 == FLAG1);
+ static_assert (f3 == FLAG1);
+ static_assert (f4 == FLAG1);
}
/* Check moving. */
@@ -470,7 +470,7 @@ self_test ()
to test_flags would fail. */
{
constexpr test_flags f = FLAG1 | FLAG2;
- gdb_static_assert (f == (FLAG1 | FLAG2));
+ static_assert (f == (FLAG1 | FLAG2));
}
/* Similarly, check that "FLAG1 | FLAG2" on the rhs of an assignment
@@ -492,8 +492,8 @@ self_test ()
constexpr int some_bits (FLAG1 | FLAG2);
/* And comparison with int works too. */
- gdb_static_assert (some_bits == (FLAG1 | FLAG2));
- gdb_static_assert (some_bits == test_flags (FLAG1 | FLAG2));
+ static_assert (some_bits == (FLAG1 | FLAG2));
+ static_assert (some_bits == test_flags (FLAG1 | FLAG2));
}
/* Check operator| and operator|=. Particularly interesting is
@@ -536,7 +536,7 @@ self_test ()
/* Check the ^/^= operators. */
{
constexpr test_flags f = FLAG1 ^ FLAG2;
- gdb_static_assert (f == (FLAG1 ^ FLAG2));
+ static_assert (f == (FLAG1 ^ FLAG2));
}
{
@@ -554,7 +554,7 @@ self_test ()
{
constexpr test_uflags f1 = ~UFLAG1;
constexpr test_uflags f2 = ~f1;
- gdb_static_assert (f2 == UFLAG1);
+ static_assert (f2 == UFLAG1);
}
/* Check the ternary operator. */
@@ -562,18 +562,18 @@ self_test ()
{
/* raw enum, raw enum */
constexpr test_flags f1 = true ? FLAG1 : FLAG2;
- gdb_static_assert (f1 == FLAG1);
+ static_assert (f1 == FLAG1);
constexpr test_flags f2 = false ? FLAG1 : FLAG2;
- gdb_static_assert (f2 == FLAG2);
+ static_assert (f2 == FLAG2);
}
{
/* enum flags, raw enum */
constexpr test_flags src = FLAG1;
constexpr test_flags f1 = true ? src : FLAG2;
- gdb_static_assert (f1 == FLAG1);
+ static_assert (f1 == FLAG1);
constexpr test_flags f2 = false ? src : FLAG2;
- gdb_static_assert (f2 == FLAG2);
+ static_assert (f2 == FLAG2);
}
{
@@ -581,9 +581,9 @@ self_test ()
constexpr test_flags src1 = FLAG1;
constexpr test_flags src2 = FLAG2;
constexpr test_flags f1 = true ? src1 : src2;
- gdb_static_assert (f1 == src1);
+ static_assert (f1 == src1);
constexpr test_flags f2 = false ? src1 : src2;
- gdb_static_assert (f2 == src2);
+ static_assert (f2 == src2);
}
/* Check that we can use flags in switch expressions (requires
diff --git a/gdb/unittests/packed-selftests.c b/gdb/unittests/packed-selftests.c
index c5dd843b435..797a453513a 100644
--- a/gdb/unittests/packed-selftests.c
+++ b/gdb/unittests/packed-selftests.c
@@ -32,15 +32,15 @@ enum test_enum
TE_D = 4,
};
-gdb_static_assert (sizeof (packed<test_enum, 1>) == 1);
-gdb_static_assert (sizeof (packed<test_enum, 2>) == 2);
-gdb_static_assert (sizeof (packed<test_enum, 3>) == 3);
-gdb_static_assert (sizeof (packed<test_enum, 4>) == 4);
-
-gdb_static_assert (alignof (packed<test_enum, 1>) == 1);
-gdb_static_assert (alignof (packed<test_enum, 2>) == 1);
-gdb_static_assert (alignof (packed<test_enum, 3>) == 1);
-gdb_static_assert (alignof (packed<test_enum, 4>) == 1);
+static_assert (sizeof (packed<test_enum, 1>) == 1);
+static_assert (sizeof (packed<test_enum, 2>) == 2);
+static_assert (sizeof (packed<test_enum, 3>) == 3);
+static_assert (sizeof (packed<test_enum, 4>) == 4);
+
+static_assert (alignof (packed<test_enum, 1>) == 1);
+static_assert (alignof (packed<test_enum, 2>) == 1);
+static_assert (alignof (packed<test_enum, 3>) == 1);
+static_assert (alignof (packed<test_enum, 4>) == 1);
/* Triviality checks. */
#define CHECK_TRAIT(TRAIT) \
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 240536805d7..f93d57d3e52 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -312,7 +312,7 @@ v850_register_name (struct gdbarch *gdbarch, int regnum)
"sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
"pc", "fp"
};
- gdb_static_assert (E_NUM_OF_V850_REGS == ARRAY_SIZE (v850_reg_names));
+ static_assert (E_NUM_OF_V850_REGS == ARRAY_SIZE (v850_reg_names));
return v850_reg_names[regnum];
}
@@ -331,7 +331,7 @@ v850e_register_name (struct gdbarch *gdbarch, int regnum)
"sr24", "sr25", "sr26", "sr27", "sr28", "sr29", "sr30", "sr31",
"pc", "fp"
};
- gdb_static_assert (E_NUM_OF_V850E_REGS == ARRAY_SIZE (v850e_reg_names));
+ static_assert (E_NUM_OF_V850E_REGS == ARRAY_SIZE (v850e_reg_names));
return v850e_reg_names[regnum];
}
@@ -477,7 +477,7 @@ v850e3v5_register_name (struct gdbarch *gdbarch, int regnum)
"vr24", "vr25", "vr26", "vr27", "vr28", "vr29", "vr30", "vr31",
};
- gdb_static_assert (E_NUM_OF_V850E3V5_REGS
+ static_assert (E_NUM_OF_V850E3V5_REGS
== ARRAY_SIZE (v850e3v5_reg_names));
return v850e3v5_reg_names[regnum];
}
diff --git a/gdb/value.c b/gdb/value.c
index b4da9675039..1a3985582ba 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -762,7 +762,7 @@ static int max_value_size = 65536; /* 64k bytes */
is bigger than LONGEST on all GDB supported hosts we're fine. */
#define MIN_VALUE_FOR_MAX_VALUE_SIZE 16
-gdb_static_assert (sizeof (LONGEST) <= MIN_VALUE_FOR_MAX_VALUE_SIZE);
+static_assert (sizeof (LONGEST) <= MIN_VALUE_FOR_MAX_VALUE_SIZE);
/* Implement the "set max-value-size" command. */
diff --git a/gdb/vax-tdep.c b/gdb/vax-tdep.c
index 0f92a469d6c..54f7dd14fb2 100644
--- a/gdb/vax-tdep.c
+++ b/gdb/vax-tdep.c
@@ -45,7 +45,7 @@ vax_register_name (struct gdbarch *gdbarch, int regnum)
"ps",
};
- gdb_static_assert (VAX_NUM_REGS == ARRAY_SIZE (register_names));
+ static_assert (VAX_NUM_REGS == ARRAY_SIZE (register_names));
return register_names[regnum];
}
diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index c65cdb888f6..ee25896469f 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -975,7 +975,7 @@ struct pe_import_directory_entry
uint32_t import_address_table_rva;
};
-gdb_static_assert (sizeof (pe_import_directory_entry) == 20);
+static_assert (sizeof (pe_import_directory_entry) == 20);
/* See windows-tdep.h. */
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c
index 3f47c8d68a0..27be5afcd59 100644
--- a/gdb/xstormy16-tdep.c
+++ b/gdb/xstormy16-tdep.c
@@ -108,7 +108,7 @@ xstormy16_register_name (struct gdbarch *gdbarch, int regnum)
"psw", "sp", "pc"
};
- gdb_static_assert (ARRAY_SIZE (register_names) == E_NUM_REGS);
+ static_assert (ARRAY_SIZE (register_names) == E_NUM_REGS);
return register_names[regnum];
}
diff --git a/gdbserver/i387-fp.cc b/gdbserver/i387-fp.cc
index 27f8e2dbb73..f3457a87c7f 100644
--- a/gdbserver/i387-fp.cc
+++ b/gdbserver/i387-fp.cc
@@ -83,7 +83,7 @@ struct i387_fxsave
unsigned char xmm_space[256];
};
-gdb_static_assert (sizeof(i387_fxsave) == 416);
+static_assert (sizeof(i387_fxsave) == 416);
struct i387_xsave : public i387_fxsave
{
@@ -147,7 +147,7 @@ public:
{ return xsave () + xsave_layout.pkru_offset; }
};
-gdb_static_assert (sizeof(i387_xsave) == 576);
+static_assert (sizeof(i387_xsave) == 576);
void
i387_cache_to_fsave (struct regcache *regcache, void *buf)
diff --git a/gdbserver/server.cc b/gdbserver/server.cc
index c79b335813b..558339f985a 100644
--- a/gdbserver/server.cc
+++ b/gdbserver/server.cc
@@ -55,7 +55,7 @@
/* PBUFSIZ must also be at least as big as IPA_CMD_BUF_SIZE, because
the client state data is passed directly to some agent
functions. */
-gdb_static_assert (PBUFSIZ >= IPA_CMD_BUF_SIZE);
+static_assert (PBUFSIZ >= IPA_CMD_BUF_SIZE);
#define require_running_or_return(BUF) \
if (!target_running ()) \
diff --git a/gdbserver/server.h b/gdbserver/server.h
index 306d75d4e9b..2bca4718941 100644
--- a/gdbserver/server.h
+++ b/gdbserver/server.h
@@ -29,7 +29,7 @@
#include <config.h>
-gdb_static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
+static_assert (sizeof (CORE_ADDR) >= sizeof (void *));
#include "gdbsupport/version.h"
diff --git a/gdbsupport/gdb_assert.h b/gdbsupport/gdb_assert.h
index f399036e460..e5da39e19aa 100644
--- a/gdbsupport/gdb_assert.h
+++ b/gdbsupport/gdb_assert.h
@@ -21,11 +21,6 @@
#include "errors.h"
-/* A static assertion. This will cause a compile-time error if EXPR,
- which must be a compile-time constant, is false. */
-
-#define gdb_static_assert(expr) static_assert (expr, "")
-
/* PRAGMATICS: "gdb_assert.h":gdb_assert() is a lower case (rather
than upper case) macro since that provides the closest fit to the
existing lower case macro <assert.h>:assert() that it is
diff --git a/gdbsupport/packed.h b/gdbsupport/packed.h
index c9fcc5033cb..9407b596469 100644
--- a/gdbsupport/packed.h
+++ b/gdbsupport/packed.h
@@ -62,7 +62,7 @@ struct ATTRIBUTE_GCC_STRUCT packed
packed (T val)
{
- gdb_static_assert (sizeof (ULONGEST) >= sizeof (T));
+ static_assert (sizeof (ULONGEST) >= sizeof (T));
#if PACKED_USE_ARRAY
ULONGEST tmp = val;
@@ -76,17 +76,17 @@ struct ATTRIBUTE_GCC_STRUCT packed
#endif
/* Ensure size and aligment are what we expect. */
- gdb_static_assert (sizeof (packed) == Bytes);
- gdb_static_assert (alignof (packed) == 1);
+ static_assert (sizeof (packed) == Bytes);
+ static_assert (alignof (packed) == 1);
/* Make sure packed can be wrapped with std::atomic. */
#if HAVE_IS_TRIVIALLY_COPYABLE
- gdb_static_assert (std::is_trivially_copyable<packed>::value);
+ static_assert (std::is_trivially_copyable<packed>::value);
#endif
- gdb_static_assert (std::is_copy_constructible<packed>::value);
- gdb_static_assert (std::is_move_constructible<packed>::value);
- gdb_static_assert (std::is_copy_assignable<packed>::value);
- gdb_static_assert (std::is_move_assignable<packed>::value);
+ static_assert (std::is_copy_constructible<packed>::value);
+ static_assert (std::is_move_constructible<packed>::value);
+ static_assert (std::is_copy_assignable<packed>::value);
+ static_assert (std::is_move_assignable<packed>::value);
}
operator T () const noexcept
diff --git a/gdbsupport/pathstuff.h b/gdbsupport/pathstuff.h
index b22a521e68d..4a0a19ea298 100644
--- a/gdbsupport/pathstuff.h
+++ b/gdbsupport/pathstuff.h
@@ -76,7 +76,7 @@ std::string
path_join (Args... paths)
{
/* It doesn't make sense to join less than two paths. */
- gdb_static_assert (sizeof... (Args) >= 2);
+ static_assert (sizeof... (Args) >= 2);
std::array<const char *, sizeof... (Args)> path_array
{ paths... };
--
2.41.0
^ permalink raw reply [flat|nested] 15+ messages in thread