Bug 27528 - compile fail (binutils/gdb/ada-lang.c)
Summary: compile fail (binutils/gdb/ada-lang.c)
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 11.1
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-05 21:48 UTC by Chernov Sergey aka Klen
Modified: 2021-03-06 16:43 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
patch (283 bytes, patch)
2021-03-05 21:48 UTC, Chernov Sergey aka Klen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chernov Sergey aka Klen 2021-03-05 21:48:16 UTC
Created attachment 13292 [details]
patch

build binutils with fail compile of binutils/gdb/ada-lang.c
sources: HEAD

configure args: src/binutils/configure -v --prefix=/klen/tools/arm-kgp-eabi_@_x86_64-kgp-linux-gnu_westmere --target=arm-kgp-eabi --host=x86_64-kgp-linux-gnu --build=x86_64-kgp-linux-gnu --disable-werror --enable-multilib --with-pic --enable-nls --enable-lto --enable-plugins --enable-static --disable-shared --with-expat --disable-sim --enable-gold --enable--threads --disable-source-highlight

compiler output error:  
 CXX    ada-lang.o
../../../src/bu-gdb/gdb/ada-lang.c: В функции «const char* ada_fold_name(gdb::string_view)»:
../../../src/bu-gdb/gdb/ada-lang.c:947:64: ошибка: нет соответствующей функции для вызова «to_string(std::basic_string_view<char>)»
  947 |     fold_storage = to_string (name.substr (1, name.size () - 2));
      |                                                                ^
In file included from /klen/tools/x86_64-kgp-linux-gnu-znver2-avx2/lib/gcc/x86_64-kgp-linux-gnu/11.0.1/include/c++/string:55,
                 from ../../../src/bu-gdb/gdb/../gdbsupport/common-utils.h:23,
                 from ../../../src/bu-gdb/gdb/../gdbsupport/common-defs.h:125,
                 from ../../../src/bu-gdb/gdb/defs.h:28,
                 from ../../../src/bu-gdb/gdb/ada-lang.c:21:

patch:
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index bb50222f81..8f27f3ccdf 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -944,10 +944,10 @@ ada_fold_name (gdb::string_view name)
   static std::string fold_storage;
 
   if (!name.empty () && name[0] == '\'')
-    fold_storage = to_string (name.substr (1, name.size () - 2));
+    fold_storage = gdb::to_string (name.substr (1, name.size () - 2));
   else
     {
-      fold_storage = to_string (name);
+      fold_storage = gdb::to_string (name);
       for (int i = 0; i < name.size (); i += 1)
        fold_storage[i] = tolower (fold_storage[i]);
     }
Comment 1 Chernov Sergey aka Klen 2021-03-05 21:52:26 UTC
Helow from caxara.ru
Comment 2 cvs-commit@gcc.gnu.org 2021-03-06 16:43:04 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=01573d7360cdd9660fdc6bf48b0b7f2180f5c40c

commit 01573d7360cdd9660fdc6bf48b0b7f2180f5c40c
Author: Tom Tromey <tom@tromey.com>
Date:   Sat Mar 6 09:38:26 2021 -0700

    Fix build bug in ada-lang.c
    
    An earlier patch of mine introduced a build failure in ada-lang.c.  A
    couple of "to_string" calls were not namespace-qualified.  In the
    failing setup, the std string_view is being used, and so (apparently)
    ADL doesn't find gdb::to_string.
    
    This patch, from the bug, fixes the problem.
    
    gdb/ChangeLog
    2021-03-06  Chernov Sergey  <klen_s@mail.ru>
    
            PR gdb/27528:
            * ada-lang.c (ada_fold_name): Use gdb::to_string.
Comment 3 Tom Tromey 2021-03-06 16:43:56 UTC
Thanks for the patch.
I checked it in.