public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: Dodji Seketeli <dodji@redhat.com>
Cc: John Moon <quic_johmoo@quicinc.com>,
	 Trilok Soni <quic_tsoni@quicinc.com>,
	 Satya Durga Srinivasu Prabhala <quic_satyap@quicinc.com>,
	 libabigail@sourceware.org
Subject: [PATCH 7/7, applied] suppression: Make the "end" data member offset selector be named boundary
Date: Fri, 20 Oct 2023 12:04:30 +0200	[thread overview]
Message-ID: <87il71624x.fsf@redhat.com> (raw)
In-Reply-To: <87cyx97h4j.fsf@redhat.com> (Dodji Seketeli's message of "Fri, 20 Oct 2023 11:55:24 +0200")

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(-)

diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc
index d84857ba..326d003e 100644
--- a/src/abg-suppression.cc
+++ b/src/abg-suppression.cc
@@ -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]))
-- 
2.39.3



-- 
		Dodji


      parent reply	other threads:[~2023-10-20 10:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20  9:55 [PATCH 0/7, applied to mainline] Support the Linux Kernel UAPI checker project Dodji Seketeli
2023-10-20  9:57 ` [PATCH 1/7, applied] suppression: Add "changed_enumerators_regexp" property Dodji Seketeli
2023-10-20  9:58 ` [PATCH 2/7, applied] default-reporter,reporter-priv: Do not report names of anonymous enums Dodji Seketeli
2023-10-20  9:59 ` [PATCH 3/7, applied] ir,comparison,corpus: Better support anonymous enums comparison Dodji Seketeli
2023-10-20 10:00 ` [PATCH 4/7, applied] ir,comparison: Represent changed anonymous enums Dodji Seketeli
2023-10-20 10:01 ` [PATCH 5/7, applied] comparison: Represent changed unreachable anonymous unions, structs & enums Dodji Seketeli
2023-10-20 10:03 ` [PATCH 6/7, applied] Support suppressing data member insertion before a flexible array member Dodji Seketeli
2023-10-20 10:04 ` Dodji Seketeli [this message]

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=87il71624x.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=libabigail@sourceware.org \
    --cc=quic_johmoo@quicinc.com \
    --cc=quic_satyap@quicinc.com \
    --cc=quic_tsoni@quicinc.com \
    /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: link
Be 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).