aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2022-11-01 10:38:02 -0400
committerJason Merrill <jason@redhat.com>2022-11-02 11:04:00 -0400
commit4f428e8b3f0a8a2ee282a952e1f70a8146478cdd (patch)
treef929be5a3e73716896726bb5cab08c1c0bce13da
parentbfcb6e7373095d776eeb505f6d1a7d04ada21a3c (diff)
downloadgcc-4f428e8b3f0a8a2ee282a952e1f70a8146478cdd.zip
gcc-4f428e8b3f0a8a2ee282a952e1f70a8146478cdd.tar.gz
gcc-4f428e8b3f0a8a2ee282a952e1f70a8146478cdd.tar.bz2
libstdc++: reorder contract_violation
Moving the int after the pointers makes the object one word smaller.
-rw-r--r--gcc/cp/contracts.cc8
-rw-r--r--libstdc++-v3/include/experimental/contract2
-rw-r--r--libstdc++-v3/src/experimental/contract.cc1
3 files changed, 6 insertions, 5 deletions
diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc
index 6732b76..3a03770 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/include/experimental/contract b/libstdc++-v3/include/experimental/contract
index fb03f11..16f3fd5 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
diff --git a/libstdc++-v3/src/experimental/contract.cc b/libstdc++-v3/src/experimental/contract.cc
index f1b6eb3..b9b72cd 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;
}
+