From 8e2f8c7b2d28f9c81bf15cfced8a4b519897654e Mon Sep 17 00:00:00 2001 From: zhouwenpei Date: Fri, 8 Apr 2022 09:18:31 +0800 Subject: [PATCH] Add int type cast to resolve gcc issue for option Wformat=2 --- ...-init-type-cast-to-resolve-gcc-issue.patch | 53 +++++++++++++++++++ systemtap.spec | 9 +++- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 0001-Add-init-type-cast-to-resolve-gcc-issue.patch diff --git a/0001-Add-init-type-cast-to-resolve-gcc-issue.patch b/0001-Add-init-type-cast-to-resolve-gcc-issue.patch new file mode 100644 index 0000000..62c58bc --- /dev/null +++ b/0001-Add-init-type-cast-to-resolve-gcc-issue.patch @@ -0,0 +1,53 @@ +From: Qiang Wei +Subject: [PATCH] Add int type cast to resolve gcc issue for option + Wformat=2. + +In ncruses 6.3 version, there is type complain for function wprintw + when gcc has option -Wformat=2. + +Signed-off-by: Qiang Wei +--- a/staprun/monitor.c 2022-03-09 06:45:30.534000000 +0000 ++++ b/staprun/monitor.c 2022-03-09 06:48:49.804000000 +0000 +@@ -448,12 +448,12 @@ + if (active_window == 0) + wattron(status, A_BOLD); + wprintw(status, "\n%*s\t%*s\t%*s\t%*s\t%*s\t%*s\t%s\n", +- width[p_index], HIGHLIGHT("index", p_index, comp_fn_index), +- width[p_state], HIGHLIGHT("state", p_state, comp_fn_index), +- width[p_hits], HIGHLIGHT("hits", p_hits, comp_fn_index), +- width[p_min], HIGHLIGHT("min", p_min, comp_fn_index), +- width[p_avg], HIGHLIGHT("avg", p_avg, comp_fn_index), +- width[p_max], HIGHLIGHT("max", p_max, comp_fn_index), ++ (int)width[p_index], HIGHLIGHT("index", p_index, comp_fn_index), ++ (int)width[p_state], HIGHLIGHT("state", p_state, comp_fn_index), ++ (int)width[p_hits], HIGHLIGHT("hits", p_hits, comp_fn_index), ++ (int)width[p_min], HIGHLIGHT("min", p_min, comp_fn_index), ++ (int)width[p_avg], HIGHLIGHT("avg", p_avg, comp_fn_index), ++ (int)width[p_max], HIGHLIGHT("max", p_max, comp_fn_index), + HIGHLIGHT("name", p_name, comp_fn_index)); + if (active_window == 0) + wattroff(status, A_BOLD); +@@ -466,17 +466,17 @@ + json_object *probe, *field; + probe = json_object_array_get_idx(jso_probe_list, i); + json_object_object_get_ex(probe, "index", &field); +- wprintw(status, "%*s\t", width[p_index], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_index], json_object_get_string(field)); + json_object_object_get_ex(probe, "state", &field); +- wprintw(status, "%*s\t", width[p_state], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_state], json_object_get_string(field)); + json_object_object_get_ex(probe, "hits", &field); +- wprintw(status, "%*s\t", width[p_hits], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_hits], json_object_get_string(field)); + json_object_object_get_ex(probe, "min", &field); +- wprintw(status, "%*s\t", width[p_min], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_min], json_object_get_string(field)); + json_object_object_get_ex(probe, "avg", &field); +- wprintw(status, "%*s\t", width[p_avg], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_avg], json_object_get_string(field)); + json_object_object_get_ex(probe, "max", &field); +- wprintw(status, "%*s\t", width[p_max], json_object_get_string(field)); ++ wprintw(status, "%*s\t", (int)width[p_max], json_object_get_string(field)); + getyx(status, discard, cur_x); + json_object_object_get_ex(probe, "name", &field); + wprintw(status, "%.*s", max_cols-cur_x-1, json_object_get_string(field)); diff --git a/systemtap.spec b/systemtap.spec index c09132a..80781d3 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -22,12 +22,14 @@ Name: systemtap Version: 4.5 -Release: 2 +Release: 3 Summary: Linux trace and probe tool License: GPLv2+ and Public Domain URL: http://sourceware.org/systemtap Source: https://sourceware.org/systemtap/ftp/releases/%{name}-%{version}.tar.gz +Patch1: 0001-Add-init-type-cast-to-resolve-gcc-issue.patch + BuildRequires: gcc-c++ emacs systemd python3-setuptools BuildRequires: gettext-devel rpm-devel readline-devel BuildRequires: pkgconfig(nss) pkgconfig(avahi-client) @@ -168,7 +170,7 @@ URL: http://sourceware.org/systemtap This package include systemtap manual %prep -%setup -q %{?setup_elfutils} +%autosetup -p1 %build %configure \ @@ -451,6 +453,9 @@ exit 0 %{_mandir}/man[1378]/* %changelog +* Fri Apr 8 2022 zhouwenpei - 4.5-3 +- Add int type cast to resolve gcc issue for option Wformat=2 + * Tue Feb 15 2022 zhouwenpei - 4.5-2 - Remove requires on gcc and systemtap-devel