public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/26187] New: Can't build gdb with current GCC master
@ 2020-06-30 11:27 vries at gcc dot gnu.org
  2020-06-30 12:14 ` [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations] vries at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-06-30 11:27 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=26187

            Bug ID: 26187
           Summary: Can't build gdb with current GCC master
           Product: gdb
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
          Assignee: unassigned at sourceware dot org
          Reporter: mliska at suse dot cz
                CC: vries at gcc dot gnu.org
  Target Milestone: ---
                CC: vries at gcc dot gnu.org

Current GCC master switched default to -std=c++17 and so that I see:

$ g++ -x c++  -g -O2   -I. -I../../gdb -I../../gdb/config
-DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H
-I../../gdb/../include/opcode -I../../gdb/../readline/readline/..
-I../../gdb/../zlib -I../bfd -I../../gdb/../bfd -I../../gdb/../include
-I../libdecnumber -I../../gdb/../libdecnumber  -I../../gdb/../gnulib/import
-I../gnulib/import -I../../gdb/.. -I..  -DTUI=1    -I/usr/include/python2.7
-I/usr/include/python2.7  -I../../gdb/.. -pthread -Wall -Wpointer-arith
-Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch
-Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter
-Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized
-Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3
-Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor
-Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat
-Wformat-nonliteral -Werror -c -o ada-lang.o -MT ada-lang.o -MMD -MP -MF
./.deps/ada-lang.Tpo ../../gdb/ada-lang.c
In file included from ../../gdb/ada-lang.c:32:
../../gdb/inferior.h: In member function ‘void
infcall_suspend_state_deleter::operator()(infcall_suspend_state*) const’:
../../gdb/inferior.h:83:12: error: ‘bool std::uncaught_exception()’ is
deprecated [-Werror=deprecated-declarations]
   83 |  if (!std::uncaught_exception ())
      |            ^~~~~~~~~~~~~~~~~~
In file included from /home/marxin/bin/gcc/include/c++/11.0.0/new:41,
                 from
/home/marxin/bin/gcc/include/c++/11.0.0/ext/new_allocator.h:33,
                 from
/home/marxin/bin/gcc/include/c++/11.0.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from
/home/marxin/bin/gcc/include/c++/11.0.0/bits/allocator.h:46,
                 from /home/marxin/bin/gcc/include/c++/11.0.0/string:41,
                 from ../../gdb/../gdbsupport/common-utils.h:23,
                 from ../../gdb/../gdbsupport/common-defs.h:125,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/ada-lang.c:21:
/home/marxin/bin/gcc/include/c++/11.0.0/exception:106:8: note: declared here
  106 |   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__
((__pure__));
      |        ^~~~~~~~~~~~~~~~~~
In file included from ../../gdb/ada-lang.c:32:
../../gdb/inferior.h:83:32: error: ‘bool std::uncaught_exception()’ is
deprecated [-Werror=deprecated-declarations]
   83 |  if (!std::uncaught_exception ())
      |                                ^
In file included from /home/marxin/bin/gcc/include/c++/11.0.0/new:41,
                 from
/home/marxin/bin/gcc/include/c++/11.0.0/ext/new_allocator.h:33,
                 from
/home/marxin/bin/gcc/include/c++/11.0.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33,
                 from
/home/marxin/bin/gcc/include/c++/11.0.0/bits/allocator.h:46,
                 from /home/marxin/bin/gcc/include/c++/11.0.0/string:41,
                 from ../../gdb/../gdbsupport/common-utils.h:23,
                 from ../../gdb/../gdbsupport/common-defs.h:125,
                 from ../../gdb/defs.h:28,
                 from ../../gdb/ada-lang.c:21:
/home/marxin/bin/gcc/include/c++/11.0.0/exception:106:8: note: declared here
  106 |   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__
((__pure__));
      |        ^~~~~~~~~~~~~~~~~~

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Martin Liska from comment #0)
> Current GCC master switched default to -std=c++17

Right, to -std=gnu++17 (with -std=c++17 you first run into another gdb build
error, due to usage of typeof).

> and so that I see:
> 
> $ g++ -x c++  -g -O2   -I. -I../../gdb -I../../gdb/config
> -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H
> -I../../gdb/../include/opcode -I../../gdb/../readline/readline/..
> -I../../gdb/../zlib -I../bfd -I../../gdb/../bfd -I../../gdb/../include
> -I../libdecnumber -I../../gdb/../libdecnumber  -I../../gdb/../gnulib/import
> -I../gnulib/import -I../../gdb/.. -I..  -DTUI=1    -I/usr/include/python2.7
> -I/usr/include/python2.7  -I../../gdb/.. -pthread -Wall -Wpointer-arith
> -Wno-unused -Wunused-value -Wunused-variable -Wunused-function -Wno-switch
> -Wno-char-subscripts -Wempty-body -Wunused-but-set-parameter
> -Wunused-but-set-variable -Wno-sign-compare -Wno-error=maybe-uninitialized
> -Wno-mismatched-tags -Wsuggest-override -Wimplicit-fallthrough=3
> -Wduplicated-cond -Wshadow=local -Wdeprecated-copy -Wdeprecated-copy-dtor
> -Wredundant-move -Wmissing-declarations -Wstrict-null-sentinel -Wformat
> -Wformat-nonliteral -Werror -c -o ada-lang.o -MT ada-lang.o -MMD -MP -MF
> ./.deps/ada-lang.Tpo ../../gdb/ada-lang.c
> In file included from ../../gdb/ada-lang.c:32:
> ../../gdb/inferior.h: In member function ‘void
> infcall_suspend_state_deleter::operator()(infcall_suspend_state*) const’:
> ../../gdb/inferior.h:83:12: error: ‘bool std::uncaught_exception()’ is
> deprecated [-Werror=deprecated-declarations]
>    83 |  if (!std::uncaught_exception ())
>       |            ^~~~~~~~~~~~~~~~~~
> In file included from /home/marxin/bin/gcc/include/c++/11.0.0/new:41,
>                  from
> /home/marxin/bin/gcc/include/c++/11.0.0/ext/new_allocator.h:33,
>                  from
> /home/marxin/bin/gcc/include/c++/11.0.0/x86_64-pc-linux-gnu/bits/
> c++allocator.h:33,
>                  from
> /home/marxin/bin/gcc/include/c++/11.0.0/bits/allocator.h:46,
>                  from /home/marxin/bin/gcc/include/c++/11.0.0/string:41,
>                  from ../../gdb/../gdbsupport/common-utils.h:23,
>                  from ../../gdb/../gdbsupport/common-defs.h:125,
>                  from ../../gdb/defs.h:28,
>                  from ../../gdb/ada-lang.c:21:
> /home/marxin/bin/gcc/include/c++/11.0.0/exception:106:8: note: declared here
>   106 |   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__
> ((__pure__));
>       |        ^~~~~~~~~~~~~~~~~~
> In file included from ../../gdb/ada-lang.c:32:
> ../../gdb/inferior.h:83:32: error: ‘bool std::uncaught_exception()’ is
> deprecated [-Werror=deprecated-declarations]
>    83 |  if (!std::uncaught_exception ())
>       |                                ^
> In file included from /home/marxin/bin/gcc/include/c++/11.0.0/new:41,
>                  from
> /home/marxin/bin/gcc/include/c++/11.0.0/ext/new_allocator.h:33,
>                  from
> /home/marxin/bin/gcc/include/c++/11.0.0/x86_64-pc-linux-gnu/bits/
> c++allocator.h:33,
>                  from
> /home/marxin/bin/gcc/include/c++/11.0.0/bits/allocator.h:46,
>                  from /home/marxin/bin/gcc/include/c++/11.0.0/string:41,
>                  from ../../gdb/../gdbsupport/common-utils.h:23,
>                  from ../../gdb/../gdbsupport/common-defs.h:125,
>                  from ../../gdb/defs.h:28,
>                  from ../../gdb/ada-lang.c:21:
> /home/marxin/bin/gcc/include/c++/11.0.0/exception:106:8: note: declared here
>   106 |   bool uncaught_exception() _GLIBCXX_USE_NOEXCEPT __attribute__
> ((__pure__));
>       |        ^~~~~~~~~~~~~~~~~~

I also ran into this a bit ago (
https://sourceware.org/pipermail/gdb/2020-March/048447.html ), but it dropped
of my radar, so thanks for filing this.

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Earlier I wrote a test-case that exercises the scenario for which the code was
added, submitted RFC for this:
https://sourceware.org/pipermail/gdb-patches/2020-June/169970.html .

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
Tentative patch:
...
diff --git a/gdb/inferior.h b/gdb/inferior.h
index 572c5f3ae7..8914afc8d6 100644
--- a/gdb/inferior.h
+++ b/gdb/inferior.h
@@ -21,6 +21,8 @@
 #if !defined (INFERIOR_H)
 #define INFERIOR_H 1

+#include <exception>
+
 struct target_waitstatus;
 struct frame_info;
 struct ui_file;
@@ -80,7 +82,13 @@ struct infcall_suspend_state_deleter
        /* If we are restoring the inferior state due to an exception,
           some error message will be printed.  So, only warn the user
           when we cannot restore during normal execution.  */
-       if (!std::uncaught_exception ())
+       bool unwinding;
+#ifdef __cpp_lib_uncaught_exceptions
+       unwinding = std::uncaught_exceptions () > 0;
+#else
+       unwinding = std::uncaught_exception ();
+#endif
+       if (!unwinding)
          warning (_("Failed to restore inferior state: %s"), e.what ());
       }
   }
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-05 21:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 11:27 [Bug ada/26187] New: Can't build gdb with current GCC master vries at gcc dot gnu.org
2020-06-30 12:14 ` [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations] vries at gcc dot gnu.org
2020-07-04 17:23 ` tromey at sourceware dot org
2020-07-05 10:02 ` vries at gcc dot gnu.org
2020-07-05 21:47 ` cvs-commit at gcc dot gnu.org
2020-07-05 21:48 ` vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).