public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jason Merrill <jason@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc/devel/c++-contracts] libstdc++: contracts uint_least32_t lineno Date: Fri, 21 Oct 2022 01:23:46 +0000 (GMT) [thread overview] Message-ID: <20221021012346.8331B3858D37@sourceware.org> (raw) https://gcc.gnu.org/g:fcce3a45f0c6625dcc45dc7d83fdb1b836016bbe commit fcce3a45f0c6625dcc45dc7d83fdb1b836016bbe Author: Jason Merrill <jason@redhat.com> Date: Tue Oct 18 13:04:09 2022 -0400 libstdc++: contracts uint_least32_t lineno As specified in N4820. libstdc++-v3/ChangeLog: * include/experimental/contract: line_number() returns uint_least32_t. gcc/testsuite/ChangeLog: * g++.dg/contracts/contracts14.C: Cast line_number to int. * g++.dg/contracts/contracts15.C * g++.dg/contracts/contracts16.C: Likewise. Diff: --- gcc/testsuite/g++.dg/contracts/contracts14.C | 2 +- gcc/testsuite/g++.dg/contracts/contracts15.C | 2 +- gcc/testsuite/g++.dg/contracts/contracts16.C | 2 +- libstdc++-v3/include/experimental/contract | 5 +++-- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/gcc/testsuite/g++.dg/contracts/contracts14.C b/gcc/testsuite/g++.dg/contracts/contracts14.C index bda392a1f9d..cca1e79964f 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts14.C +++ b/gcc/testsuite/g++.dg/contracts/contracts14.C @@ -20,7 +20,7 @@ void handle_contract_violation(const std::contract_violation &violation) { << " " << violation.line_number() << " " << violation.file_name() << std::endl; - throw -violation.line_number(); + throw -(int)violation.line_number(); } int fun() { diff --git a/gcc/testsuite/g++.dg/contracts/contracts15.C b/gcc/testsuite/g++.dg/contracts/contracts15.C index 8110876286c..fefafdfa66e 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts15.C +++ b/gcc/testsuite/g++.dg/contracts/contracts15.C @@ -20,7 +20,7 @@ void handle_contract_violation(const std::contract_violation &violation) { << " " << violation.line_number() << " " << violation.file_name() << std::endl; - throw -violation.line_number(); + throw -(int)violation.line_number(); } int fun() noexcept { diff --git a/gcc/testsuite/g++.dg/contracts/contracts16.C b/gcc/testsuite/g++.dg/contracts/contracts16.C index 26172281767..d80cda46501 100644 --- a/gcc/testsuite/g++.dg/contracts/contracts16.C +++ b/gcc/testsuite/g++.dg/contracts/contracts16.C @@ -10,7 +10,7 @@ void handle_contract_violation(const std::contract_violation &violation) { << " " << violation.line_number() << " " << violation.file_name() << std::endl; - throw -violation.line_number(); + throw -(int)violation.line_number(); } int fun() { diff --git a/libstdc++-v3/include/experimental/contract b/libstdc++-v3/include/experimental/contract index 611d9c6db82..8d49bf751da 100644 --- a/libstdc++-v3/include/experimental/contract +++ b/libstdc++-v3/include/experimental/contract @@ -39,6 +39,7 @@ #include <bits/c++config.h> #include <string_view> +#include <cstdint> namespace std _GLIBCXX_VISIBILITY(default) { @@ -49,7 +50,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; class contract_violation { - int _M_line; // FIXME uint_least32_t + uint_least32_t _M_line; const char* _M_file; const char* _M_function; const char* _M_comment; @@ -62,7 +63,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION contract_violation_continuation_mode __m) : _M_line(__l), _M_file(__f), _M_function(__fn), _M_comment(__c), _M_level(__lv), _M_role(__r), _M_continue(__m) { } - int line_number() const noexcept { return _M_line; } + uint_least32_t line_number() const noexcept { return _M_line; } string_view file_name() const noexcept { return _M_file; } string_view function_name() const noexcept { return _M_function; } string_view comment() const noexcept { return _M_comment; }
reply other threads:[~2022-10-21 1:23 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221021012346.8331B3858D37@sourceware.org \ --to=jason@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).