From: Jakub Jelinek Date: Mon, 29 Dec 2025 13:00:02 +0000 (+0100) Subject: auto-profile.cc: Fix build with C++14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=49c38ba6abc8fdd706c1d3fc4a01c386ed6e66c7;p=thirdparty%2Fgcc.git auto-profile.cc: Fix build with C++14 On Tue, Dec 23, 2025 at 11:01:36AM +0530, Dhruv Chawla wrote: > Committed as: > - r16-6347-g84058c3cc805f7 This broke building gcc with C++14 system compilers. ../../gcc/auto-profile.cc: In member function ‘std::pair autofdo::string_table::get_original_name(const char*) const’: ../../gcc/auto-profile.cc:1129:7: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 1129 | if (symtab_node *n | ^~~~~~~~~~~ This is valid only in C++17 and later. Fixed thusly. 2025-12-29 Jakub Jelinek * auto-profile.cc (string_table::get_original_name): Avoid using init-statement in selection statement. --- diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index ad5b0651743..ead774eeb71 100644 --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -1126,9 +1126,9 @@ string_table::get_original_name (const char *name) const /* Try to find a function from the current TU. */ gcc_checking_assert (clash->second.length () >= 1); - if (symtab_node *n - = cgraph_node::get_for_asmname (get_identifier (stripped->second)); - n && is_a (n)) + symtab_node *n + = cgraph_node::get_for_asmname (get_identifier (stripped->second)); + if (n && is_a (n)) for (cgraph_node *cn = dyn_cast (n); cn;) { /* Check if there is a symbol in the current TU that has the same name