public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/c++-contracts] libstdc++: reorder contract_violation
@ 2022-11-02 18:44 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2022-11-02 18:44 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:4f428e8b3f0a8a2ee282a952e1f70a8146478cdd
commit 4f428e8b3f0a8a2ee282a952e1f70a8146478cdd
Author: Jason Merrill <jason@redhat.com>
Date: Tue Nov 1 10:38:02 2022 -0400
libstdc++: reorder contract_violation
Moving the int after the pointers makes the object one word smaller.
Diff:
---
gcc/cp/contracts.cc | 8 ++++----
libstdc++-v3/src/experimental/contract.cc | 1 +
libstdc++-v3/include/experimental/contract | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index 6732b761183..3a0377089a0 100644
--- a/gcc/cp/contracts.cc
+++ b/gcc/cp/contracts.cc
@@ -1599,21 +1599,21 @@ get_pseudo_contract_violation_type ()
{
/* Must match <contract>:
class contract_violation {
- uint_least32_t _M_line;
const char* _M_file;
const char* _M_function;
const char* _M_comment;
const char* _M_level;
const char* _M_role;
+ uint_least32_t _M_line;
signed char _M_continue;
If this changes, also update the initializer in
build_contract_violation. */
- const tree types[] = { uint_least32_type_node,
- const_string_type_node,
+ const tree types[] = { const_string_type_node,
const_string_type_node,
const_string_type_node,
const_string_type_node,
const_string_type_node,
+ uint_least32_type_node,
signed_char_type_node };
tree fields = NULL_TREE;
for (tree type : types)
@@ -1663,12 +1663,12 @@ build_contract_violation (tree contract, contract_continuation cmode)
/* Must match the type layout in get_pseudo_contract_violation_type. */
tree ctor = build_constructor_va
(init_list_type_node, 7,
- NULL_TREE, build_int_cst (uint_least32_type_node, loc.line),
NULL_TREE, build_string_literal (loc.file),
NULL_TREE, build_string_literal (function),
NULL_TREE, CONTRACT_COMMENT (contract),
NULL_TREE, build_string_literal (level),
NULL_TREE, build_string_literal (role),
+ NULL_TREE, build_int_cst (uint_least32_type_node, loc.line),
NULL_TREE, build_int_cst (signed_char_type_node, cmode));
ctor = finish_compound_literal (get_pseudo_contract_violation_type (),
diff --git a/libstdc++-v3/src/experimental/contract.cc b/libstdc++-v3/src/experimental/contract.cc
index f1b6eb3a58a..b9b72cd7df0 100644
--- a/libstdc++-v3/src/experimental/contract.cc
+++ b/libstdc++-v3/src/experimental/contract.cc
@@ -38,3 +38,4 @@ handle_contract_violation (const std::experimental::contract_violation &violatio
<< " " << (int)violation.continuation_mode()
<< std::endl;
}
+
diff --git a/libstdc++-v3/include/experimental/contract b/libstdc++-v3/include/experimental/contract
index fb03f116847..16f3fd5fd5a 100644
--- a/libstdc++-v3/include/experimental/contract
+++ b/libstdc++-v3/include/experimental/contract
@@ -52,12 +52,12 @@ namespace experimental
};
class contract_violation {
- uint_least32_t _M_line;
const char* _M_file;
const char* _M_function;
const char* _M_comment;
const char* _M_level;
const char* _M_role;
+ uint_least32_t _M_line;
signed char _M_continue;
public:
// From N4820
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-11-02 18:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-02 18:44 [gcc/devel/c++-contracts] libstdc++: reorder contract_violation Jason Merrill
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).