* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
@ 2022-11-21 6:21 ` unlvsur at live dot com
2022-11-21 6:24 ` unlvsur at live dot com
` (9 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 6:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #1 from cqwrteur <unlvsur at live dot com> ---
__attribute__ ((weak)) void
handle_contract_violation (const std::experimental::contract_violation &)
{
__builtin_trap();
}
some thing like that. I cannot afford stdio and iostream
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
2022-11-21 6:21 ` [Bug libstdc++/107778] " unlvsur at live dot com
@ 2022-11-21 6:24 ` unlvsur at live dot com
2022-11-21 6:28 ` unlvsur at live dot com
` (8 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 6:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #2 from cqwrteur <unlvsur at live dot com> ---
BTW. Why does the default contract does not crash program when it violates?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
2022-11-21 6:21 ` [Bug libstdc++/107778] " unlvsur at live dot com
2022-11-21 6:24 ` unlvsur at live dot com
@ 2022-11-21 6:28 ` unlvsur at live dot com
2022-11-21 9:58 ` redi at gcc dot gnu.org
` (7 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 6:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #3 from cqwrteur <unlvsur at live dot com> ---
(In reply to cqwrteur from comment #2)
> BTW. Why does the default contract does not crash program when it violates?
Also why the function is not noexcept?
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (2 preceding siblings ...)
2022-11-21 6:28 ` unlvsur at live dot com
@ 2022-11-21 9:58 ` redi at gcc dot gnu.org
2022-11-21 10:01 ` unlvsur at live dot com
` (6 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-21 9:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to cqwrteur from comment #3)
> Also why the function is not noexcept?
Writing to streams can throw.
If you don't like the default handler you can provide your own.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (3 preceding siblings ...)
2022-11-21 9:58 ` redi at gcc dot gnu.org
@ 2022-11-21 10:01 ` unlvsur at live dot com
2022-11-21 10:01 ` unlvsur at live dot com
` (5 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #5 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to cqwrteur from comment #3)
> > Also why the function is not noexcept?
>
> Writing to streams can throw.
>
> If you don't like the default handler you can provide your own.
then do not use stream
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (4 preceding siblings ...)
2022-11-21 10:01 ` unlvsur at live dot com
@ 2022-11-21 10:01 ` unlvsur at live dot com
2022-11-21 10:01 ` unlvsur at live dot com
` (4 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #6 from cqwrteur <unlvsur at live dot com> ---
(In reply to Jonathan Wakely from comment #4)
> (In reply to cqwrteur from comment #3)
> > Also why the function is not noexcept?
>
> Writing to streams can throw.
>
> If you don't like the default handler you can provide your own.
The problem is that the function is still not marked as noexcept and it will
cause serious issues with noexcept functions (like using contracts in
operator[] for example)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (5 preceding siblings ...)
2022-11-21 10:01 ` unlvsur at live dot com
@ 2022-11-21 10:01 ` unlvsur at live dot com
2022-11-21 10:17 ` unlvsur at live dot com
` (3 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 10:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #7 from cqwrteur <unlvsur at live dot com> ---
(In reply to cqwrteur from comment #5)
> (In reply to Jonathan Wakely from comment #4)
> > (In reply to cqwrteur from comment #3)
> > > Also why the function is not noexcept?
> >
> > Writing to streams can throw.
> >
> > If you don't like the default handler you can provide your own.
>
> then do not use stream
use stdio instead
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (6 preceding siblings ...)
2022-11-21 10:01 ` unlvsur at live dot com
@ 2022-11-21 10:17 ` unlvsur at live dot com
2022-12-23 0:51 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
10 siblings, 0 replies; 12+ messages in thread
From: unlvsur at live dot com @ 2022-11-21 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #8 from cqwrteur <unlvsur at live dot com> ---
(In reply to cqwrteur from comment #6)
> (In reply to Jonathan Wakely from comment #4)
> > (In reply to cqwrteur from comment #3)
> > > Also why the function is not noexcept?
> >
> > Writing to streams can throw.
> >
> > If you don't like the default handler you can provide your own.
>
> The problem is that the function is still not marked as noexcept and it will
> cause serious issues with noexcept functions (like using contracts in
> operator[] for example)
btw I do not know whether there is a toggle to just add a contract check with
__builtin_trap() or std::terminate for example. The current implementation of
the contract ts in GCC is ridiculously expensive tbh due to too many parameters
that need to be passed into the handler function.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (7 preceding siblings ...)
2022-11-21 10:17 ` unlvsur at live dot com
@ 2022-12-23 0:51 ` cvs-commit at gcc dot gnu.org
2022-12-23 0:54 ` webrown.cpp at gmail dot com
2023-02-28 1:25 ` redi at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-12-23 0:51 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
https://gcc.gnu.org/g:8ec5fcb6fc79e5bcca23c3fecbaf09d4566cb1d5
commit r13-4861-g8ec5fcb6fc79e5bcca23c3fecbaf09d4566cb1d5
Author: Arsen ArsenoviÄ <arsen@aarsen.me>
Date: Thu Dec 22 12:03:06 2022 +0100
libstdc++: Improve output of default contract violation handler [PR107792]
Make the output more readable. Don't output anything unless verbose
termination is enabled at configure-time.
The testsuite change was almost entirely mechanical. Save for two files
which had very short matches, these changes were produced by two seds and a
Perl script, for the more involved cases. The latter will be added in a
subsequent commit. The former are as follows:
sed -E -i "/dg-output/s/default std::handle_contract_violation called:
\
(\S+) (\S+) (\S+(<[A-Za-z0-9, ]*)?>?)\
/contract violation in function \3 at \1:\2: /" *.C
sed -i '/dg-output/s/ */ /g'
Whichever files remained failing after the above changes were checked-out,
re-ran, with output extracted, and ran through dg-out-generator.pl.
Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
PR libstdc++/107792
PR libstdc++/107778
* src/experimental/contract.cc (handle_contract_violation): Make
output more readable.
gcc/testsuite/ChangeLog:
* g++.dg/contracts/contracts-access1.C: Convert to new default
violation handler.
* g++.dg/contracts/contracts-assume2.C: Ditto.
* g++.dg/contracts/contracts-config1.C: Ditto.
* g++.dg/contracts/contracts-constexpr1.C: Ditto.
* g++.dg/contracts/contracts-ctor-dtor1.C: Ditto.
* g++.dg/contracts/contracts-deduced2.C: Ditto.
* g++.dg/contracts/contracts-friend1.C: Ditto.
* g++.dg/contracts/contracts-multiline1.C: Ditto.
* g++.dg/contracts/contracts-post3.C: Ditto.
* g++.dg/contracts/contracts-pre10.C: Ditto.
* g++.dg/contracts/contracts-pre2.C: Ditto.
* g++.dg/contracts/contracts-pre2a2.C: Ditto.
* g++.dg/contracts/contracts-pre3.C: Ditto.
* g++.dg/contracts/contracts-pre4.C: Ditto.
* g++.dg/contracts/contracts-pre5.C: Ditto.
* g++.dg/contracts/contracts-pre7.C: Ditto.
* g++.dg/contracts/contracts-pre9.C: Ditto.
* g++.dg/contracts/contracts-redecl3.C: Ditto.
* g++.dg/contracts/contracts-redecl4.C: Ditto.
* g++.dg/contracts/contracts-redecl6.C: Ditto.
* g++.dg/contracts/contracts-redecl7.C: Ditto.
* g++.dg/contracts/contracts-tmpl-spec1.C: Ditto.
* g++.dg/contracts/contracts-tmpl-spec2.C: Ditto.
* g++.dg/contracts/contracts-tmpl-spec3.C: Ditto.
* g++.dg/contracts/contracts10.C: Ditto.
* g++.dg/contracts/contracts14.C: Ditto.
* g++.dg/contracts/contracts15.C: Ditto.
* g++.dg/contracts/contracts16.C: Ditto.
* g++.dg/contracts/contracts17.C: Ditto.
* g++.dg/contracts/contracts19.C: Ditto.
* g++.dg/contracts/contracts25.C: Ditto.
* g++.dg/contracts/contracts3.C: Ditto.
* g++.dg/contracts/contracts35.C: Ditto.
* g++.dg/contracts/contracts5.C: Ditto.
* g++.dg/contracts/contracts7.C: Ditto.
* g++.dg/contracts/contracts9.C: Ditto.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (8 preceding siblings ...)
2022-12-23 0:51 ` cvs-commit at gcc dot gnu.org
@ 2022-12-23 0:54 ` webrown.cpp at gmail dot com
2023-02-28 1:25 ` redi at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: webrown.cpp at gmail dot com @ 2022-12-23 0:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
--- Comment #10 from W E Brown <webrown.cpp at gmail dot com> ---
> On Dec 22, 2022, at 6:51 PM, cvs-commit at gcc dot gnu.org <gcc-bugzilla@gcc.gnu.org> wrote:
>
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
>
> --- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
> The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:
>
> https://gcc.gnu.org/g:8ec5fcb6fc79e5bcca23c3fecbaf09d4566cb1d5
>
> commit r13-4861-g8ec5fcb6fc79e5bcca23c3fecbaf09d4566cb1d5
> Author: Arsen ArsenoviÄ <arsen@aarsen.me>
> Date: Thu Dec 22 12:03:06 2022 +0100
>
> libstdc++: Improve output of default contract violation handler [PR107792]
>
> Make the output more readable. Don't output anything unless verbose
> termination is enabled at configure-time.
>
> The testsuite change was almost entirely mechanical. Save for two files
> which had very short matches, these changes were produced by two seds and a
> Perl script, for the more involved cases. The latter will be added in a
> subsequent commit. The former are as follows:
>
> sed -E -i "/dg-output/s/default std::handle_contract_violation called:
> \
> (\S+) (\S+) (\S+(<[A-Za-z0-9, ]*)?>?)\
> /contract violation in function \3 at \1:\2: /" *.C
> sed -i '/dg-output/s/ */ /g'
>
> Whichever files remained failing after the above changes were checked-out,
> re-ran, with output extracted, and ran through dg-out-generator.pl.
>
> Co-Authored-By: Jonathan Wakely <jwakely@redhat.com>
>
> libstdc++-v3/ChangeLog:
>
> PR libstdc++/107792
> PR libstdc++/107778
> * src/experimental/contract.cc (handle_contract_violation): Make
> output more readable.
>
> gcc/testsuite/ChangeLog:
>
> * g++.dg/contracts/contracts-access1.C: Convert to new default
> violation handler.
> * g++.dg/contracts/contracts-assume2.C: Ditto.
> * g++.dg/contracts/contracts-config1.C: Ditto.
> * g++.dg/contracts/contracts-constexpr1.C: Ditto.
> * g++.dg/contracts/contracts-ctor-dtor1.C: Ditto.
> * g++.dg/contracts/contracts-deduced2.C: Ditto.
> * g++.dg/contracts/contracts-friend1.C: Ditto.
> * g++.dg/contracts/contracts-multiline1.C: Ditto.
> * g++.dg/contracts/contracts-post3.C: Ditto.
> * g++.dg/contracts/contracts-pre10.C: Ditto.
> * g++.dg/contracts/contracts-pre2.C: Ditto.
> * g++.dg/contracts/contracts-pre2a2.C: Ditto.
> * g++.dg/contracts/contracts-pre3.C: Ditto.
> * g++.dg/contracts/contracts-pre4.C: Ditto.
> * g++.dg/contracts/contracts-pre5.C: Ditto.
> * g++.dg/contracts/contracts-pre7.C: Ditto.
> * g++.dg/contracts/contracts-pre9.C: Ditto.
> * g++.dg/contracts/contracts-redecl3.C: Ditto.
> * g++.dg/contracts/contracts-redecl4.C: Ditto.
> * g++.dg/contracts/contracts-redecl6.C: Ditto.
> * g++.dg/contracts/contracts-redecl7.C: Ditto.
> * g++.dg/contracts/contracts-tmpl-spec1.C: Ditto.
> * g++.dg/contracts/contracts-tmpl-spec2.C: Ditto.
> * g++.dg/contracts/contracts-tmpl-spec3.C: Ditto.
> * g++.dg/contracts/contracts10.C: Ditto.
> * g++.dg/contracts/contracts14.C: Ditto.
> * g++.dg/contracts/contracts15.C: Ditto.
> * g++.dg/contracts/contracts16.C: Ditto.
> * g++.dg/contracts/contracts17.C: Ditto.
> * g++.dg/contracts/contracts19.C: Ditto.
> * g++.dg/contracts/contracts25.C: Ditto.
> * g++.dg/contracts/contracts3.C: Ditto.
> * g++.dg/contracts/contracts35.C: Ditto.
> * g++.dg/contracts/contracts5.C: Ditto.
> * g++.dg/contracts/contracts7.C: Ditto.
> * g++.dg/contracts/contracts9.C: Ditto.
>
> --
> You are receiving this mail because:
> You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [Bug libstdc++/107778] handle_contract_violation should reflect _GLIBCXX_VERBOSE
2022-11-21 6:21 [Bug libstdc++/107778] New: handle_contract_violation should reflect _GLIBCXX_VERBOSE unlvsur at live dot com
` (9 preceding siblings ...)
2022-12-23 0:54 ` webrown.cpp at gmail dot com
@ 2023-02-28 1:25 ` redi at gcc dot gnu.org
10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2023-02-28 1:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107778
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |13.0
Resolution|--- |FIXED
Status|UNCONFIRMED |RESOLVED
--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
.
^ permalink raw reply [flat|nested] 12+ messages in thread