From 024eac7bab9c92ac895b424ea1d37fb86d495c58 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Fri, 29 Nov 2024 15:49:45 +0100 Subject: [PATCH] ld, nm: Silence on-by-default warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When compiling nvptx-tools with default settings, the following warnings are printed, which this commit silences: nvptx-ld.cc:878:20 and nvptx-nm.cc:670:20: In function ‘int main(int, char**)’: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘off_t’ {aka ‘long int’} [-Wsign-compare] nvptx-nm.cc:386:14: warning: unnecessary parentheses in declaration of ‘sorters’ [-Wparentheses] nvptx-nm.cc:386:14: note: remove parentheses nvptx-nm.cc:464:72: In function ‘void display_rel_file(std::__cxx11::list&, const std::string&)’: warning: unused parameter ‘name’ [-Wunused-parameter] --- nvptx-ld.cc | 2 +- nvptx-nm.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nvptx-ld.cc b/nvptx-ld.cc index 91af4e3..46bd1e3 100644 --- a/nvptx-ld.cc +++ b/nvptx-ld.cc @@ -875,7 +875,7 @@ This program has absolutely no warranty.\n"; char *buf = XNEWVEC (char, len + 1); size_t read_len = fread (buf, 1, len, f); buf[len] = '\0'; - if (read_len != len || ferror (f)) + if (read_len != static_cast(len) || ferror (f)) { std::cerr << "error reading " << name << "\n"; fclose (f); diff --git a/nvptx-nm.cc b/nvptx-nm.cc index 3d49e15..347a66d 100644 --- a/nvptx-nm.cc +++ b/nvptx-nm.cc @@ -383,7 +383,7 @@ numeric_reverse (const void *x, const void *y) return - numeric_forward (x, y); } -static int (*(sorters[2][2])) (const void *, const void *) = +static int (*sorters[2][2]) (const void *, const void *) = { { non_numeric_forward, non_numeric_reverse }, { numeric_forward, numeric_reverse } @@ -461,7 +461,7 @@ print_symbols (symbol_hash_entry **minisyms, } static void -display_rel_file (std::list &symbol_tables, const std::string &name) +display_rel_file (std::list &symbol_tables, const std::string &/*name*/) { size_t symcount = 0; for (std::list::iterator it = symbol_tables.begin (); @@ -667,7 +667,7 @@ This program has absolutely no warranty.\n"; char *buf = new char[len + 1]; size_t read_len = fread (buf, 1, len, f); buf[len] = '\0'; - if (read_len != len || ferror (f)) + if (read_len != static_cast(len) || ferror (f)) { std::cerr << "error reading " << name << "\n"; fclose (f);