https://gcc.gnu.org/g:49c38ba6abc8fdd706c1d3fc4a01c386ed6e66c7

commit r16-6429-g49c38ba6abc8fdd706c1d3fc4a01c386ed6e66c7
Author: Jakub Jelinek <[email protected]>
Date:   Mon Dec 29 14:00:02 2025 +0100

    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<const char*, int> 
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  <[email protected]>
    
            * auto-profile.cc (string_table::get_original_name): Avoid using
            init-statement in selection statement.

Diff:
---
 gcc/auto-profile.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index ad5b0651743c..ead774eeb716 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<cgraph_node *> (n))
+  symtab_node *n
+    = cgraph_node::get_for_asmname (get_identifier (stripped->second));
+  if (n && is_a<cgraph_node *> (n))
     for (cgraph_node *cn = dyn_cast<cgraph_node *> (n); cn;)
       {
        /* Check if there is a symbol in the current TU that has the same name

Reply via email to