]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
auto-profile.cc: Fix build with C++14
authorJakub Jelinek <jakub@redhat.com>
Mon, 29 Dec 2025 13:00:02 +0000 (14:00 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 29 Dec 2025 13:01:36 +0000 (14:01 +0100)
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  <jakub@redhat.com>

* auto-profile.cc (string_table::get_original_name): Avoid using
init-statement in selection statement.

gcc/auto-profile.cc

index ad5b0651743c8833c540194a3e932fa131db2bab..ead774eeb716a0359857344f5cde3da79efd20e4 100644 (file)
@@ -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