From af65af8267ce7a3e67ebf5fd4ab23d62bbe95d6a Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Thu, 7 Dec 2023 12:52:37 -0800 Subject: [PATCH] intel/tools: fix compilation of intel_hang_viewer on 32 bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because gcc was complaining: ../../src/intel/tools/intel_hang_viewer.cpp: In function ‘void display_hang_stats()’: ../../src/intel/tools/intel_hang_viewer.cpp:365:31: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘std::vector::size_type’ {aka ‘unsigned int’} [-Werror=format=] 365 | ImGui::Text("BOs: %lu", context.bos.size()); | ~~^ ~~~~~~~~~~~~~~~~~~ | | | | long unsigned int std::vector::size_type {aka unsigned int} | %u ../../src/intel/tools/intel_hang_viewer.cpp:366:31: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘std::vector::size_type’ {aka ‘unsigned int’} [-Werror=format=] 366 | ImGui::Text("Execs %lu", context.execs.size()); | ~~^ ~~~~~~~~~~~~~~~~~~~~ | | | | long unsigned int std::vector::size_type {aka unsigned int} | %u ../../src/intel/tools/intel_hang_viewer.cpp:367:31: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 2 has type ‘std::vector::size_type’ {aka ‘unsigned int’} [-Werror=format=] 367 | ImGui::Text("Maps: %lu", context.maps.size()); | ~~^ ~~~~~~~~~~~~~~~~~~~ | | | | long unsigned int std::vector::size_type {aka unsigned int} | %u cc1plus: some warnings being treated as errors I'm not sure if STL's size_type is defined by the spec to be anything specific, but for the platforms we care about it seems to be size_t, so change it to %z. Fixes: 33fd93f3b182 ("intel/tools: hang viewer/editor") Reviewed-by: Lionel Landwerlin Signed-off-by: Paulo Zanoni Part-of: --- src/intel/tools/intel_hang_viewer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/intel/tools/intel_hang_viewer.cpp b/src/intel/tools/intel_hang_viewer.cpp index 18217b9e233..680e771b122 100644 --- a/src/intel/tools/intel_hang_viewer.cpp +++ b/src/intel/tools/intel_hang_viewer.cpp @@ -362,9 +362,9 @@ display_hang_stats() if (ImGui::Button("Help") || has_ctrl_key('h')) { ImGui::OpenPopup("Help"); } - ImGui::Text("BOs: %lu", context.bos.size()); - ImGui::Text("Execs %lu", context.execs.size()); - ImGui::Text("Maps: %lu", context.maps.size()); + ImGui::Text("BOs: %zu", context.bos.size()); + ImGui::Text("Execs %zu", context.execs.size()); + ImGui::Text("Maps: %zu", context.maps.size()); ImGui::Text("PCI ID: 0x%x", context.devinfo.pci_device_id); ImGui::SetNextWindowContentWidth(500);