From 9ba7d0e6026ef4c3d095b0a57f9b88a87df403ea Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Sat, 15 Oct 2022 12:15:58 +0200 Subject: [PATCH] libstdc++: Address '-Wunused-function' for 'print_raw' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per recent commit r13-3303-gcf0b7e9787c3686c47219a725f2cbcaa19faaaca "libstdc++: Simplify print_raw function for debug assertions": > Replace two uses of print_raw where it's clearer to just use fprintf > directly. Then the only remaining use of print_raw is as the print_func > argument of pretty_print. But that one is only compiled '#if _GLIBCXX_HAVE_STACKTRACE'. In a '--enable-werror' build I've thus run into: [...]/source-gcc/libstdc++-v3/src/c++11/debug.cc:613:3: error: ‘void {anonymous}::print_raw(PrintContext&, const char*, ptrdiff_t)’ defined but not used [-Werror=unused-function] 613 | print_raw(PrintContext& ctx, const char* str, ptrdiff_t nbc) | ^~~~~~~~~ cc1plus: all warnings being treated as errors libstdc++-v3/ * src/c++11/debug.cc (print_raw): Only '#if _GLIBCXX_HAVE_STACKTRACE'. --- libstdc++-v3/src/c++11/debug.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc index f2b25fbefce0..f62a1f755cf1 100644 --- a/libstdc++-v3/src/c++11/debug.cc +++ b/libstdc++-v3/src/c++11/debug.cc @@ -609,6 +609,7 @@ namespace print_literal(PrintContext& ctx, const char(&word)[Length]) { print_word(ctx, word, Length - 1); } +#if _GLIBCXX_HAVE_STACKTRACE void print_raw(PrintContext& ctx, const char* str, ptrdiff_t nbc) { @@ -616,6 +617,7 @@ namespace nbc = INT_MAX; ctx._M_column += fprintf(stderr, "%.*s", (int)nbc, str); } +#endif void print_word(PrintContext& ctx, const char* word, ptrdiff_t nbc = -1) -- 2.35.1