From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by sourceware.org (Postfix) with ESMTPS id 91CD23AA9422 for ; Sat, 17 Dec 2022 16:52:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 91CD23AA9422 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x1029.google.com with SMTP id z8-20020a17090abd8800b00219ed30ce47so9059748pjr.3 for ; Sat, 17 Dec 2022 08:52:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gLfpHaD3znFkyL3WwbBCFWVo4BEeUYD/0GjAtdFnXuo=; b=GHBty63+o6L8uo+osr/tEqsIjtyc4LUJ/w14BqvX1V6/aMwoBtEciEK/wY/uah/ISs Jmwo1O8Gt+NrAmUqG0sBq9XU1r4+rDSmoy1VlY4gxAtsJTGnqSPNk10LGFiqHK3WloE2 0953f4SE+5iy4Pjh9rdUt/vUsOZL51VembqR2Rkny0eZxN2CgOtueqd3fe8DRKeGdlYx 3uVBGA7MFmyfobrJOFd/5MmVfFHqYKjHpq7wx2yJ6k8QlLkP9LjaLFoXqupKYmCOZJtx IrfCcq37BwiyaPeEto25SZGLO1qrE/apSShk8Is28qoAZZn/UL1dCUHUxsBUemEvKbKR BszQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gLfpHaD3znFkyL3WwbBCFWVo4BEeUYD/0GjAtdFnXuo=; b=7bXAqpNslkIydootqOfCDzVKrVEZEqD7DanXAdxhxwESC3K4smTvNwq+Br1LM1+MK3 e3DJqioD6/zkBB0OPmZCdRWWMXGV7z20HRZHfYgSR4orlLjmW4c7WQXe3kKs8SOFdkWl UQZPFQAuS3/lruZY5l92a2kDaPz5H6g5QJnF0sg5Vs2uAzFFFIeXYfgX9Lt9D7E/lwR8 SAHVU96fepwjQ8lvt1cg/XQk284mQroj51sKwmk8jJf37/nr39sBlAh2xCrtnBf2dtDg yiAhtp1e7lbVYwI6jjwmIvwPlFRp8qpMhLPupb48G0cRoGh1DPs4rjj0wFmvStoiPBIb d1Bg== X-Gm-Message-State: AFqh2kqbzV7duF0oB4N6bz/Ws9qX1bwTLYbrKLbEnKbOlQLxKZnhyOTG n7fqRw8/qMgSd0CKmXfz/X9eEWLqLAY= X-Google-Smtp-Source: AMrXdXug4z54XI9m1oDJM5CehHez7OrchNpYsTLfMI6QyMqrNGr5KKa7/cIhfWLoiCOp6+1HX3IPgQ== X-Received: by 2002:a17:90a:7e08:b0:223:7922:654d with SMTP id i8-20020a17090a7e0800b002237922654dmr9209569pjl.5.1671295961169; Sat, 17 Dec 2022 08:52:41 -0800 (PST) Received: from localhost.localdomain ([103.94.185.75]) by smtp.googlemail.com with ESMTPSA id s92-20020a17090a2f6500b002191873187dsm6643229pjd.33.2022.12.17.08.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Dec 2022 08:52:40 -0800 (PST) From: Yonggang Luo To: elfutils-devel@sourceware.org Cc: Yonggang Luo Subject: [PATCH v2 04/16] Fixes usage of basename about prototype differences Date: Sun, 18 Dec 2022 00:52:01 +0800 Message-Id: <20221217165213.152-5-luoyonggang@gmail.com> X-Mailer: git-send-email 2.36.1.windows.1 In-Reply-To: <20221217165213.152-1-luoyonggang@gmail.com> References: <20221217165213.152-1-luoyonggang@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Signed-off-by: Yonggang Luo --- libdw/dwarf_getsrc_file.c | 2 +- libdwfl/dwfl_module_getsrc_file.c | 2 +- libdwfl/dwfl_segment_report_module.c | 2 +- libdwfl/find-debuginfo.c | 6 +++--- libdwfl/link_map.c | 2 +- src/addr2line.c | 4 ++-- src/nm.c | 4 ++-- src/stack.c | 2 +- src/strip.c | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/libdw/dwarf_getsrc_file.c b/libdw/dwarf_getsrc_file.c index 5289c7da..884fea32 100644 --- a/libdw/dwarf_getsrc_file.c +++ b/libdw/dwarf_getsrc_file.c @@ -98,7 +98,7 @@ dwarf_getsrc_file (Dwarf *dbg, const char *fname, int lineno, int column, /* Match the name with the name the user provided. */ const char *fname2 = line->files->info[lastfile].name; if (is_basename) - lastmatch = strcmp (basename (fname2), fname) == 0; + lastmatch = strcmp (basename ((char *)fname2), fname) == 0; else lastmatch = strcmp (fname2, fname) == 0; } diff --git a/libdwfl/dwfl_module_getsrc_file.c b/libdwfl/dwfl_module_getsrc_file.c index cea2ba41..6daf29d6 100644 --- a/libdwfl/dwfl_module_getsrc_file.c +++ b/libdwfl/dwfl_module_getsrc_file.c @@ -103,7 +103,7 @@ dwfl_module_getsrc_file (Dwfl_Module *mod, { /* Match the name with the name the user provided. */ lastfile = file; - lastmatch = !strcmp (is_basename ? basename (file) : file, + lastmatch = !strcmp (is_basename ? basename ((char *)file) : file, fname); } } diff --git a/libdwfl/dwfl_segment_report_module.c b/libdwfl/dwfl_segment_report_module.c index 19fa6ded..5342648a 100644 --- a/libdwfl/dwfl_segment_report_module.c +++ b/libdwfl/dwfl_segment_report_module.c @@ -719,7 +719,7 @@ dwfl_segment_report_module (Dwfl *dwfl, int ndx, const char *name, bias += fixup; if (module->name[0] != '\0') { - name = basename (module->name); + name = basename ((char *)module->name); name_is_final = true; } break; diff --git a/libdwfl/find-debuginfo.c b/libdwfl/find-debuginfo.c index 7f7ab632..a9b7be3d 100644 --- a/libdwfl/find-debuginfo.c +++ b/libdwfl/find-debuginfo.c @@ -164,7 +164,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, { bool cancheck = debuglink_crc != (GElf_Word) 0; - const char *file_basename = file_name == NULL ? NULL : basename (file_name); + const char *file_basename = file_name == NULL ? NULL : basename ((char *)file_name); char *localname = NULL; /* We invent a debuglink .debug name if NULL, but then want to try the @@ -278,7 +278,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, else { subdir = NULL; - file = basename (debuglink_file); + file = basename ((char *)debuglink_file); } try_file_basename = debuglink_null; break; @@ -306,7 +306,7 @@ find_debuginfo_in_path (Dwfl_Module *mod, const char *file_name, if (mod->dw != NULL && (p[0] == '\0' || p[0] == '/')) { fd = try_open (&main_stat, dir, ".dwz", - basename (file), &fname); + basename ((char *)file), &fname); if (fd < 0) { if (errno != ENOENT && errno != ENOTDIR) diff --git a/libdwfl/link_map.c b/libdwfl/link_map.c index 7ec7eca1..403d4ee5 100644 --- a/libdwfl/link_map.c +++ b/libdwfl/link_map.c @@ -469,7 +469,7 @@ report_r_debug (uint_fast8_t elfclass, uint_fast8_t elfdata, if (r_debug_info_module == NULL) { // XXX hook for sysroot - mod = __libdwfl_report_elf (dwfl, basename (name), + mod = __libdwfl_report_elf (dwfl, basename ((char *)name), name, fd, elf, base, true, true); if (mod != NULL) diff --git a/src/addr2line.c b/src/addr2line.c index 7768b266..3abf1d7a 100644 --- a/src/addr2line.c +++ b/src/addr2line.c @@ -381,7 +381,7 @@ print_dwarf_function (Dwfl_Module *mod, Dwarf_Addr addr) if (file == NULL) file = "???"; else if (only_basenames) - file = basename (file); + file = basename ((char *)file); else if (use_comp_dir && file[0] != '/') { const char *const *dirs; @@ -564,7 +564,7 @@ print_src (const char *src, int lineno, int linecol, Dwarf_Die *cu) const char *comp_dir_sep = ""; if (only_basenames) - src = basename (src); + src = basename ((char *)src); else if (use_comp_dir && src[0] != '/') { Dwarf_Attribute attr; diff --git a/src/nm.c b/src/nm.c index b46c1fd7..717ec0f6 100644 --- a/src/nm.c +++ b/src/nm.c @@ -1417,7 +1417,7 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr, int lineno; (void) dwarf_lineno (line, &lineno); const char *file = dwarf_linesrc (line, NULL, NULL); - file = (file != NULL) ? basename (file) : "???"; + file = (file != NULL) ? basename ((char *)file) : "???"; int n; n = obstack_printf (&whereob, "%s:%d%c", file, lineno, '\0'); @@ -1448,7 +1448,7 @@ show_symbols (int fd, Ebl *ebl, GElf_Ehdr *ehdr, { /* We found the line. */ int n = obstack_printf (&whereob, "%s:%" PRIu64 "%c", - basename ((*found)->file), + basename ((char *)(*found)->file), (*found)->lineno, '\0'); sym_mem[nentries_used].where = obstack_finish (&whereob); diff --git a/src/stack.c b/src/stack.c index 534aa93c..82413772 100644 --- a/src/stack.c +++ b/src/stack.c @@ -152,7 +152,7 @@ module_callback (Dwfl_Module *mod, void **userdata __attribute__((unused)), int width = get_addr_width (mod); printf ("0x%0*" PRIx64 "-0x%0*" PRIx64 " %s\n", - width, start, width, end, basename (name)); + width, start, width, end, basename ((char *)name)); const unsigned char *id; GElf_Addr id_vaddr; diff --git a/src/strip.c b/src/strip.c index 2a2cc801..6ac987fd 100644 --- a/src/strip.c +++ b/src/strip.c @@ -1800,7 +1800,7 @@ handle_elf (int fd, Elf *elf, const char *prefix, const char *fname, elf_errmsg (-1)); } - char *debug_basename = basename (debug_fname_embed ?: debug_fname); + char *debug_basename = basename ((char *)(debug_fname_embed ?: debug_fname)); off_t crc_offset = strlen (debug_basename) + 1; /* Align to 4 byte boundary */ crc_offset = ((crc_offset - 1) & ~3) + 4; -- 2.36.1.windows.1