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

* [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations]
  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 ` vries at gcc dot gnu.org
  2020-07-04 17:23 ` tromey at sourceware dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-06-30 12:14 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|ada                         |build
            Summary|Can't build gdb with        |[-std=gnu++17]
                   |current GCC master          |gdb/inferior.h: error:
                   |                            |‘bool
                   |                            |std::uncaught_exception()’
                   |                            |is deprecated
                   |                            |[-Werror=deprecated-declara
                   |                            |tions]

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

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

* [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations]
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: tromey at sourceware dot org @ 2020-07-04 17:23 UTC (permalink / raw)
  To: gdb-prs

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

Tom Tromey <tromey at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #4 from Tom Tromey <tromey at sourceware dot org> ---
Should this check the macro value against 201411?
See https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros
Otherwise it seems fine to me.

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

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

* [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations]
  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
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 10:02 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom Tromey from comment #4)
> Should this check the macro value against 201411?
> See https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros

Ah, I didn't realize that the macro had a meaningful value.

But at
https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations
, I read:
...
The value specified for a feature-test macro is based on the year and month in
which the feature is voted into the working draft. In a case where a feature is
subsequently changed in a significant way, but arguably remains the same
feature, the value of the macro is changed to indicate the “revision level” of
the specification of the feature. However, in most cases it is expected that
the presence of a feature can be determined by the presence of any non-zero
macro value
...

They use:
...
 #if __cpp_lib_is_final
...
instead of #ifdef though in the example, so I suppose I'll do the same.

> Otherwise it seems fine to me.

Ack, I'll commit then.

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

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

* [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations]
  2020-06-30 11:27 [Bug ada/26187] New: Can't build gdb with current GCC master vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-05 21:47 UTC (permalink / raw)
  To: gdb-prs

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

--- Comment #6 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Tom de Vries <vries@sourceware.org>:

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

commit 1e7c1b224272b7415ed053c29880b7b0329073b2
Author: Tom de Vries <tdevries@suse.de>
Date:   Sun Jul 5 23:47:20 2020 +0200

    [gdb/build,c++17] Fix use of deprecated std::uncaught_exception

    When compiling gdb with -std=gnu++17, we run into:
    ...
    ../../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 ())
    ...

    Fix this by rewriting using std::uncaught_exceptions.

    Tested on x86_64-linux with gcc 9.3.1 and -std=gnu17/gnu++17.

    Tested with test-case from RFC patch
    https://sourceware.org/pipermail/gdb-patches/2020-June/169970.html.

    gdb/ChangeLog:

    2020-07-05  Tom de Vries  <tdevries@suse.de>

            PR build/26187
            * inferior.h (struct infcall_suspend_state_deleter): If available,
use
            std::uncaught_exceptions instead of deprecated
            std::uncaught_exception.

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

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

* [Bug build/26187] [-std=gnu++17] gdb/inferior.h: error: ‘bool std::uncaught_exception()’ is deprecated [-Werror=deprecated-declarations]
  2020-06-30 11:27 [Bug ada/26187] New: Can't build gdb with current GCC master vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-07-05 21:47 ` cvs-commit at gcc dot gnu.org
@ 2020-07-05 21:48 ` vries at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: vries at gcc dot gnu.org @ 2020-07-05 21:48 UTC (permalink / raw)
  To: gdb-prs

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Patch fixing build committed, marking resolved-fixed.

-- 
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).