From patchwork Fri Oct 20 10:04:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 78219 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A302E3858D39 for ; Fri, 20 Oct 2023 10:04:39 +0000 (GMT) X-Original-To: libabigail@sourceware.org Delivered-To: libabigail@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 10BE53858D20 for ; Fri, 20 Oct 2023 10:04:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10BE53858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 10BE53858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697796276; cv=none; b=xI/1k68vutbMhstF9l3qHegpvn63qAzJsXVmaM11l5QDFUjRu2anuCGosZ8XhInoIfqSmMFuqB7rMGdrd5qN77ln6AEN947HMv/ZbgSm7F+ysu/6dBtuC7GIuut89Eln9SV6ZTPipWgtzORP5zn7Sq5r5deLu6bSH+/IOv19Lis= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697796276; c=relaxed/simple; bh=sDjjaIqs1XIPnQdQfNVtpGJGg7VKJVmW8/ubEw3g5F4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=ZMFC0KsEKpLVQYPiTV0K0P7EKq4jZidSgYFbmeWjnS39DkmtCMvYDIQZuNi8M1C9Vb7C67sm8LB1gsqe4JUy6oKOnlwak6geFNdPeiXNalp9O8A15odaZjnPRphvNUmTQQLoaYhyi2f0OHsFG4d62UIFJYsEQp7p7m1ILh5Y7ww= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697796274; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=d7aERRWvu/M8RvZD4r7bQL8QLxlI5x9fTO0yqcK/ziQ=; b=c01RY/o/G3vTEM587NxnsebzthLh7Rkz8d9HbEBPMtFV/RQrQNWMRsJTAErUfcrfrPiEa6 5fQjaKvj+ryziTQoorADprG0Johiy3iafkTqYcFS6jAN+YKGmmcwqhx1WcCz8YvU1LIoff HLnRjCsNrs9YFUYq4x0u1VutY9AXYBY= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-539-ZF45ycV0MWK4s3v8BOSvQg-1; Fri, 20 Oct 2023 06:04:33 -0400 X-MC-Unique: ZF45ycV0MWK4s3v8BOSvQg-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-41cd638a4beso6263871cf.3 for ; Fri, 20 Oct 2023 03:04:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697796273; x=1698401073; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=d7aERRWvu/M8RvZD4r7bQL8QLxlI5x9fTO0yqcK/ziQ=; b=iI/MCLgwP3Lo3PyzjURSUqZgyMFavt7TLhCgLJho5mmntqenEsY0eAgaNkoAwv7dqy kRnPfRKCLGXvrtLwfBeXJ593Nrys/n2xj1FgkB9KYCGtONeb+2Vr1JUQ6OcM+8jslLHe h9Fj0yMrYNcU7fIOQ5hxHCf4pPfu2kowD5qC9tnWG8VgdC0PdHXh0dsWbPVXnrKe12kw yrliS2JOtemRO2IE514I4t3T6psHC4Eaj4GPehA7VDmHfA5VyzFEWXpY3xTasz7uJ+/P O1NF2hugQqVRfFXrPWfWJjkZMi47JbVy4lNm4M/Dd5p/4GenFr9DtWPlNzfMXN8SNIEJ LUtQ== X-Gm-Message-State: AOJu0YwoBHk8holdzBuGc7QJOXWG+Af+yu02vIIJXZIXCOF7Yid8BO0g cVcne00vSzdzNg7X8tbqXNCKn5Lw3/wcPIrcfUG3YZnZKr1lpfakwy1MZ4j3diAlvhr5Z8LwlZ5 lwoArn2M0RsIEn6oJE1zr X-Received: by 2002:a05:622a:44f:b0:41c:c149:731e with SMTP id o15-20020a05622a044f00b0041cc149731emr1140507qtx.28.1697796272795; Fri, 20 Oct 2023 03:04:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFuXt3zrtPFOWjB5JoDUa4ThxLJLBRpJTOAptkmwTZ6E3h9WrA68Go+tKuv+8lOw4hU0gKt4A== X-Received: by 2002:a05:622a:44f:b0:41c:c149:731e with SMTP id o15-20020a05622a044f00b0041cc149731emr1140492qtx.28.1697796272512; Fri, 20 Oct 2023 03:04:32 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id dn26-20020a05622a471a00b0040331a24f16sm479937qtb.3.2023.10.20.03.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 03:04:32 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 9623E5077C49; Fri, 20 Oct 2023 12:04:30 +0200 (CEST) From: Dodji Seketeli To: Dodji Seketeli Cc: John Moon , Trilok Soni , Satya Durga Srinivasu Prabhala , libabigail@sourceware.org Subject: [PATCH 7/7, applied] suppression: Make the "end" data member offset selector be named boundary Organization: Red Hat / France References: <87cyx97h4j.fsf@redhat.com> X-Operating-System: AlmaLinux 9.2 X-URL: http://www.redhat.com Date: Fri, 20 Oct 2023 12:04:30 +0200 In-Reply-To: <87cyx97h4j.fsf@redhat.com> (Dodji Seketeli's message of "Fri, 20 Oct 2023 11:55:24 +0200") Message-ID: <87il71624x.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org 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 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::max(). (read_type_suppression): Parse the "end" token as a named boundary. Signed-off-by: Dodji Seketeli 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; +} + // // 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::max(), recognized by + // type_suppression::insertion_range::boundary_value_is_end. + value = std::numeric_limits::max(); + return true; + } } return false; } @@ -2100,8 +2116,8 @@ read_type_suppression(const ini::config::section& section) // has_data_member_inserted_at = 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]))