From: Jakub Jelinek Date: Thu, 16 Apr 2026 17:13:48 +0000 (+0200) Subject: c++: Temporarily ignore -Wformat* warnings in dump_data_member_spec X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;ds=inline;p=thirdparty%2Fgcc.git c++: Temporarily ignore -Wformat* warnings in dump_data_member_spec The body of this function has been moved from eval_display_string_of, which ignored some warnings already. The new function doesn't ignore those, we we get ../../gcc/cp/reflect.cc: In function ‘void dump_data_member_spec(pretty_printer*, tree)’: ../../gcc/cp/reflect.cc:3692:18: warning: ‘T’ conversion used unquoted [-Wformat=] 3692 | pp_printf (pp, "(%T, %E, %E, %E, %s, {", TREE_VEC_ELT (r, 0), | ^~~~~~~~~~~~~~~~~~~~~~~~ ../../gcc/cp/reflect.cc:3692:18: warning: spurious trailing punctuation sequence ‘{’ in format [-Wformat-diag] ../../gcc/cp/reflect.cc:3692:18: warning: unbalanced punctuation character ‘{’ in format [-Wformat-diag] ../../gcc/cp/reflect.cc:3699:18: warning: unbalanced punctuation character ‘}’ in format [-Wformat-diag] 3699 | pp_printf (pp, "})"); | ^~~~ ../../gcc/cp/reflect.cc:3699:18: warning: unbalanced punctuation character ‘)’ in format [-Wformat-diag] extra warnings which can break bootstrap when promoted into errors. 2026-04-16 Jakub Jelinek * reflect.cc (dump_data_member_spec): Temporarily ignore -Wformat and -Wformat-diag warnings. --- diff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc index 2b7e7033953..59a862bf152 100644 --- a/gcc/cp/reflect.cc +++ b/gcc/cp/reflect.cc @@ -3684,6 +3684,11 @@ eval_identifier_of (location_t loc, const constexpr_ctx *ctx, tree r, void dump_data_member_spec (pretty_printer *pp, tree r) { +#if __GNUC__ >= 10 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat" +#pragma GCC diagnostic ignored "-Wformat-diag" +#endif pp_printf (pp, "(%T, %E, %E, %E, %s, {", TREE_VEC_ELT (r, 0), TREE_VEC_ELT (r, 1), TREE_VEC_ELT (r, 2), TREE_VEC_ELT (r, 3), TREE_VEC_ELT (r, 4) == boolean_true_node @@ -3692,6 +3697,9 @@ dump_data_member_spec (pretty_printer *pp, tree r) pp_printf (pp, "%s%E", i == 5 ? "" : ", ", REFLECT_EXPR_HANDLE (TREE_VEC_ELT (r, i))); pp_printf (pp, "})"); +#if __GNUC__ >= 10 +#pragma GCC diagnostic pop +#endif } /* Process std::meta::{,u8}display_string_of.