[7/7,applied] suppression: Make the "end" data member offset selector be named boundary
Commit Message
Hello,
Now that we have what is called a "named boundary", introduced by
commit [1], this patch re-writes the handling of the "end" data member
offset selector (used in expressions like: offset_of(end) in
suppression specifications) in terms of the new "named boundary"
infrastructure. In other words, the "end" keyword is now a named
boundary constant, just like the
"offset_of_flexible_array_data_member" is a named boundary constant.
[1]: The patch that introduced the concept of "named boundary" is this
one:
commit b12ba51e62de7c61526bd0a0cac6cc9bcf28fdee
Author: Dodji Seketeli <dodji@redhat.com>
Date: Thu Oct 5 13:32:21 2023 +0200
Support suppressing data member insertion before a flexible array member
* src/abg-suppression.cc (END_STRING): Define new static string
constant accessor.
(type_suppression::insertion_range::eval_boundary): Eval the "end"
named boundary as having a numerical value of
std::numeric_limits<uint64_t>::max().
(read_type_suppression): Parse the "end" token as a named
boundary.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
src/abg-suppression.cc | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
@@ -51,6 +51,14 @@ OFFSET_OF_FLEXIBLE_ARRAY_DATA_MEMBER_STRING()
return s;
}
+/// @return the string constant "end";
+static const string&
+END_STRING()
+{
+ static string s = "end";
+ return s;
+}
+
// <parsing stuff>
// section parsing
@@ -1602,6 +1610,14 @@ type_suppression::insertion_range::eval_boundary(const boundary_sptr boundary,
return true;
}
}
+ else if (b->get_name() == END_STRING())
+ {
+ // The 'end' of a struct is represented by the value
+ // std::numeric_limits<uint64_t>::max(), recognized by
+ // type_suppression::insertion_range::boundary_value_is_end.
+ value = std::numeric_limits<uint64_t>::max();
+ return true;
+ }
}
return false;
}
@@ -2100,8 +2116,8 @@ read_type_suppression(const ini::config::section& section)
// has_data_member_inserted_at = <one-string-property-value>
string ins_point = prop->get_value()->as_string();
type_suppression::insertion_range::boundary_sptr begin, end;
- if (ins_point == "end")
- begin = type_suppression::insertion_range::create_integer_boundary(-1);
+ if (ins_point == END_STRING())
+ begin = type_suppression::insertion_range::create_named_boundary(ins_point);
else if (ins_point == OFFSET_OF_FLEXIBLE_ARRAY_DATA_MEMBER_STRING())
begin = type_suppression::insertion_range::create_named_boundary(ins_point);
else if (isdigit(ins_point[0]))