From: Tom Tromey Date: Wed, 5 Feb 2025 03:20:17 +0000 (-0700) Subject: Return bool from dwarf2_read_gdb_index X-Git-Tag: binutils-2_45~1665 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=61ff640a3579dfdfde5e931e45c8454887654591;p=thirdparty%2Fbinutils-gdb.git Return bool from dwarf2_read_gdb_index This changes dwarf2_read_gdb_index to return bool rather than int. --- diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index 6719fbf6a37..a8706d02c4c 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -1478,7 +1478,7 @@ set_main_name_from_gdb_index (dwarf2_per_objfile *per_objfile, /* See read-gdb-index.h. */ -int +bool dwarf2_read_gdb_index (dwarf2_per_objfile *per_objfile, get_gdb_index_contents_ftype get_gdb_index_contents, @@ -1494,7 +1494,7 @@ dwarf2_read_gdb_index = get_gdb_index_contents (objfile, per_bfd); if (main_index_contents.empty ()) - return 0; + return false; auto map = std::make_unique (); if (!read_gdb_index_from_buffer (objfile_name (objfile), @@ -1502,11 +1502,11 @@ dwarf2_read_gdb_index main_index_contents, map.get (), &cu_list, &cu_list_elements, &types_list, &types_list_elements)) - return 0; + return false; /* Don't use the index if it's empty. */ if (map->symbol_table.empty ()) - return 0; + return false; /* If there is a .dwz file, read it so we can get its CU list as well. */ @@ -1521,7 +1521,7 @@ dwarf2_read_gdb_index = get_gdb_index_contents_dwz (objfile, dwz); if (dwz_index_content.empty ()) - return 0; + return false; if (!read_gdb_index_from_buffer (bfd_get_filename (dwz->dwz_bfd.get ()), 1, dwz_index_content, &dwz_map, @@ -1531,7 +1531,7 @@ dwarf2_read_gdb_index { warning (_("could not read '.gdb_index' section from %s; skipping"), bfd_get_filename (dwz->dwz_bfd.get ())); - return 0; + return false; } } @@ -1546,7 +1546,7 @@ dwarf2_read_gdb_index || per_bfd->types.size () > 1) { per_bfd->all_units.clear (); - return 0; + return false; } dwarf2_section_info *section @@ -1568,7 +1568,7 @@ dwarf2_read_gdb_index per_bfd->quick_file_names_table = create_quick_file_names_table (per_bfd->all_units.size ()); - return 1; + return true; } void _initialize_read_gdb_index (); diff --git a/gdb/dwarf2/read-gdb-index.h b/gdb/dwarf2/read-gdb-index.h index 906e3bd0bed..e38a8318db8 100644 --- a/gdb/dwarf2/read-gdb-index.h +++ b/gdb/dwarf2/read-gdb-index.h @@ -37,9 +37,10 @@ typedef gdb::function_view get_gdb_index_contents_dwz_ftype; /* Read .gdb_index. If everything went ok, initialize the "quick" - elements of all the CUs and return 1. Otherwise, return 0. */ + elements of all the CUs and return true. Otherwise, return + false. */ -int dwarf2_read_gdb_index +bool dwarf2_read_gdb_index (dwarf2_per_objfile *per_objfile, get_gdb_index_contents_ftype get_gdb_index_contents, get_gdb_index_contents_dwz_ftype get_gdb_index_contents_dwz);