From patchwork Fri Oct 20 09:57:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 78212 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 DEC633858C50 for ; Fri, 20 Oct 2023 09:57:28 +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 835D63858D20 for ; Fri, 20 Oct 2023 09:57:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 835D63858D20 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 835D63858D20 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=1697795845; cv=none; b=INrm3LK5a0zEQcckGpH6Eyx7uX+9wAqKt57gCrHdAZZxr7zymrhfHcH5YH+9lUNtv5dbcb6SZ0V09c3x9QOn+Ar839D6xb7mQsMCdRY2pnVyPUbff9tCEE4oDBAGO6hqeylEwMng0IcE+97W54BFWsjithT+7qNsd2cK2ODZgNM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697795845; c=relaxed/simple; bh=f/jRKtVN2i1TkRI4rQHMd7rkdoh1xKZsoWfZ4ltDWoo=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=AaghGKR23nYaNmwOAwC5JkDWts3iEQNnTCcHL6TdxC2vksQoVckGEVx9+r1tfXxDCTKu8CnLeSP9owUCCy/bOPelCblj4VqY8QqxGorlhdo9euLDieSaa5fTgy9pwfmf2WNAHAiBv5WfQOe/+86ORCCV7RSQV6YmC6nh6haM7xY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697795841; 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=mKLruix1ZAnoRXv7F/gQZkmQMpOAloHtJ1IVCkgk2hc=; b=OQv3L3RMxyId0CUn6D45k5mji1unuyjXzdvkEQDBQk+HMnQ5wvhfnCW6DyS9vKgnWuvqLd M2SEectkAGs/TVs+kLbEnwat42jdJNdCJ/758yGNqSUL9Zm328+I7KSTA2yyJbtsAMQxPK uRPnrbAEwJdeUDuTtbNPL4LHvwfD9TE= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-665-P8iah98SNYqBmQ2kQKiqoQ-1; Fri, 20 Oct 2023 05:57:19 -0400 X-MC-Unique: P8iah98SNYqBmQ2kQKiqoQ-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-65afd7515aaso8549636d6.0 for ; Fri, 20 Oct 2023 02:57:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697795839; x=1698400639; 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=mKLruix1ZAnoRXv7F/gQZkmQMpOAloHtJ1IVCkgk2hc=; b=FO1zsMlCYQbo33b6zt/j6j52gCqxUFYaDOnuo30OnZWWP/wvFBVJXCoLxQ7mF1Fh37 vkwEuJGIO9+ktXpsZ3PeoCpVwaTuSL5g7VtERnddQR+hnd4zd1Oe5yW2mpg5D0lMYwqU esx9XsEPoMbIpZr2cLs3dnth015UPlBbusKBPRXqhY1h1Wna3WJ3Ec5WmFZZBnN1c2rT /tvzyGJ+gIaFG29u5ZgnYU7AD/3cATHLl6gnRpJHlpxr29PvRGHPY+d8zEm35KbsJAqT PTWkNWOhBFsc6+P/RlUmn9fZbHGbKd3an9dfxEqQntkynvjR0ykiE9a3oCOyy6QQgavC jHNA== X-Gm-Message-State: AOJu0YxZlEPNlttVisbZWaIJnELE2X40BoBq3G+ZY+KAMbB0ablMaMpU oPyKnB50GQVniMAhavhm2nici1eeGZc2GSU+OYF1tc3nu1Yn3fIyrB82P4h2lmBelegz442edXv CRyyufFdLUS8CE07YXJjl X-Received: by 2002:a05:6214:da2:b0:66d:5b9:927a with SMTP id h2-20020a0562140da200b0066d05b9927amr1970530qvh.54.1697795838748; Fri, 20 Oct 2023 02:57:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHjDh9AsSKE+jJVHyOvJW78emEXdFNlrhT7Yod2lPLj5vBqKOhmJ8L2gOkD4UXpwE6SMWgmw== X-Received: by 2002:a05:6214:da2:b0:66d:5b9:927a with SMTP id h2-20020a0562140da200b0066d05b9927amr1970509qvh.54.1697795838300; Fri, 20 Oct 2023 02:57:18 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id i9-20020ac85c09000000b0041cb787ff41sm468279qti.67.2023.10.20.02.57.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Oct 2023 02:57:17 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id 5023F5077C49; Fri, 20 Oct 2023 11:57:15 +0200 (CEST) From: Dodji Seketeli To: John Moon Cc: Trilok Soni , Satya Durga Srinivasu Prabhala , libabigail@sourceware.org, dodji@redhat.com Subject: [PATCH 1/7, applied] suppression: Add "changed_enumerators_regexp" property 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 11:57:15 +0200 In-Reply-To: <87cyx97h4j.fsf@redhat.com> (Dodji Seketeli's message of "Fri, 20 Oct 2023 11:55:24 +0200") Message-ID: <878r7x7h1g.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, Currently, users are able to suppress changes to enumerator variants matching names specified in "changed_enumerators", but can't specify regular expressions. A common pattern when using enums is to have the final enum variant labeled as "*_MAX" or "*_LAST" so that users of the enum can have a way to determine how many variants there are. In these cases, when expanding an enum, the last variant will change, but that's an expected result that users may not want to flag as an ABI-breaking change. For example, if you have a change like this: enum foo { FOO, BAR, FOOBAR_MAX, }; ... enum foo { FOO, BAR, BAZ, FOOBAR_MAX, }; abidiff reports: 1 changed type unreachable from any public interface: [C] 'enum foo' changed: type size hasn't changed 1 enumerator insertion: 'foo::BAZ' value '2' 1 enumerator change: 'foo::FOOBAR_MAX' from value '2' to '3' at test_2.c:1:1 With a new changed_enumerators_regexp property, users can specify a suppression which stops abidiff from emitting this diff for any members which match the regular expressions in the list: [suppress_type] type_kind = enum changed_enumerators_regexp = .*_MAX$, .*_LAST$, .*_NUM$, .*_NBITS$ * include/abg-suppression.h (type_suppression::{g,s}et_changed_enumerators_regexp): Declare new accessor functions. * src/abg-suppression-priv.h (type_suppression::priv::changed_enumerators_regexp_): Define new data member. * src/abg-suppression.cc (type_suppression::{g,s}et_changed_enumerators_regexp): Define new accessor function. (type_suppression::suppresses_diff): For a type suppression to match an enum_diff, the names of all changed enumerators must match either the names returned by type_suppression::get_changed_enumerator_names or one of the regexps returned by the new member function type_suppression::get_changed_enumerators_regexp. (read_type_suppression): Parse the new 'changed_enumerators_regexp' property to set the type_suppression::get_changed_enumerators_regexp property. * doc/manuals/libabigail-concepts.rst: Add an entry for the new 'changed_enumerators_regexp' property. * tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-[1-5].suppr: Add new test suppression files. * tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-[0-5].txt: Add new test reference output files. * tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v{0,1}.c: Add source code for new binary test input files. * tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v{0,1}.o: Add new binary test input files. * tests/data/Makefile.am: Add the new test files to the source distribution. * tests/test-diff-suppr.cc (in_out_specs): Add the new test input files to this test harness. Signed-off-by: John Moon Signed-off-by: Dodji Seketeli Applied to master. --- doc/manuals/libabigail-concepts.rst | 25 ++++++ include/abg-suppression.h | 6 ++ src/abg-suppression-priv.h | 1 + src/abg-suppression.cc | 84 +++++++++++++++--- tests/data/Makefile.am | 15 ++++ ...merator-changes-enumerator-changes-1.suppr | 3 + ...merator-changes-enumerator-changes-2.suppr | 3 + ...merator-changes-enumerator-changes-3.suppr | 3 + ...merator-changes-enumerator-changes-4.suppr | 3 + ...merator-changes-enumerator-changes-5.suppr | 3 + ...or-changes-enumerator-changes-report-0.txt | 29 ++++++ ...or-changes-enumerator-changes-report-1.txt | 21 +++++ ...or-changes-enumerator-changes-report-2.txt | 21 +++++ ...or-changes-enumerator-changes-report-3.txt | 13 +++ ...or-changes-enumerator-changes-report-4.txt | 21 +++++ ...or-changes-enumerator-changes-report-5.txt | 3 + ...enumerator-changes-enumerator-changes-v0.c | 37 ++++++++ ...enumerator-changes-enumerator-changes-v0.o | Bin 0 -> 3944 bytes ...enumerator-changes-enumerator-changes-v1.c | 40 +++++++++ ...enumerator-changes-enumerator-changes-v1.o | Bin 0 -> 4064 bytes tests/test-diff-suppr.cc | 60 +++++++++++++ 21 files changed, 381 insertions(+), 10 deletions(-) create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-1.suppr create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-2.suppr create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-3.suppr create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-4.suppr create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-5.suppr create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.c create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.c create mode 100644 tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o new file mode 100644 index 00000000..e7f1bcc7 index 1a06e043..8c9ad070 100644 diff --git a/doc/manuals/libabigail-concepts.rst b/doc/manuals/libabigail-concepts.rst index f64f5229..324c5162 100644 --- a/doc/manuals/libabigail-concepts.rst +++ b/doc/manuals/libabigail-concepts.rst @@ -353,6 +353,31 @@ The potential properties of this sections are listed below: changed_enumerators = LAST_ENUMERATORS0, LAST_ENUMERATOR1 +.. _suppr_changed_enumerators_regexp_label: + +* ``changed_enumerators_regexp`` + + Usage: + + ``changed_enumerators_regexp`` ``=`` + + Suppresses change reports involving changes in the value of + enumerators of a given enum type. This property is applied if the + ``type_kind`` property is set to the value ``enum``, at least. The + value of the ``changed_enumerators_regexp`` property is a + comma-separated list of regular expressions that should match the + names of the enumerators that the user expects to change. For + instance: :: + + changed_enumerators_regexp = .*_MAX$, .*_LAST$, .*_NUM$, .*_NBITS$ + + In the example above, change reports to any enumerator which name + ends with _MAX, _LAST, _NUM or _NBITS will be suppressed. + + Note that for this property to be applied to changes to an enum + type, the size of the enum type must *NOT* have changed. + + * ``drop`` Usage: diff --git a/include/abg-suppression.h b/include/abg-suppression.h index 6b62f64d..cbb16207 100644 --- a/include/abg-suppression.h +++ b/include/abg-suppression.h @@ -330,6 +330,12 @@ public: void set_changed_enumerator_names(const vector&); + const vector& + get_changed_enumerators_regexp() const; + + void + set_changed_enumerators_regexp(const vector&); + virtual bool suppresses_diff(const diff* diff) const; diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h index cf66a9f1..351c5965 100644 --- a/src/abg-suppression-priv.h +++ b/src/abg-suppression-priv.h @@ -585,6 +585,7 @@ class type_suppression::priv string source_location_to_keep_regex_str_; mutable regex::regex_t_sptr source_location_to_keep_regex_; mutable vector changed_enumerator_names_; + mutable vector changed_enumerators_regexp_; priv(); diff --git a/src/abg-suppression.cc b/src/abg-suppression.cc index 7053e728..f8d065f6 100644 --- a/src/abg-suppression.cc +++ b/src/abg-suppression.cc @@ -770,6 +770,28 @@ void type_suppression::set_changed_enumerator_names(const vector& n) {priv_->changed_enumerator_names_ = n;} +/// Getter of the vector of the regular expression strings for changed +/// enumerators that are supposed to be suppressed. Note that this +/// will be "valid" only if the type suppression has the +/// 'type_kind = enum' property. +/// +/// @return the vector of the regular expression strings that are +/// supposed to match enumertor names to be suppressed. +const vector& +type_suppression::get_changed_enumerators_regexp() const +{return priv_->changed_enumerators_regexp_;} + +/// Setter of the vector of the regular expression strings for changed +/// enumerators that are supposed to be suppressed. Note that this +/// will be "valid" only if the type suppression has the +/// 'type_kind = enum' property. +/// +/// @param n the vector of the regular expression strings that are +/// supposed to match enumertor names to be suppressed. +void +type_suppression::set_changed_enumerators_regexp(const vector& n) +{priv_->changed_enumerators_regexp_ = n;} + /// Evaluate this suppression specification on a given diff node and /// say if the diff node should be suppressed or not. /// @@ -1002,9 +1024,12 @@ type_suppression::suppresses_diff(const diff* diff) const // ... and yet carries some changed enumerators! && !enum_dif->changed_enumerators().empty()) { - // Make sure that all changed enumerators are listed in the - // vector of enumerator names returned by the - // get_changed_enumerator_names() member function. + + // Make sure that all changed enumerators are either: + // 1. listed in the vector of enumerator names returned + // by the get_changed_enumerator_names() member function + // 2. match a regular expression returned by the + // get_changed_enumerators_regexp() member function bool matched = true; for (string_changed_enumerator_map::const_iterator i = enum_dif->changed_enumerators().begin(); @@ -1012,13 +1037,20 @@ type_suppression::suppresses_diff(const diff* diff) const ++i) { matched &= true; - if (std::find(get_changed_enumerator_names().begin(), - get_changed_enumerator_names().end(), - i->first) == get_changed_enumerator_names().end()) - { - matched &= false; - break; - } + if ((std::find(get_changed_enumerator_names().begin(), + get_changed_enumerator_names().end(), + i->first) == get_changed_enumerator_names().end()) + && + (std::find_if(get_changed_enumerators_regexp().begin(), + get_changed_enumerators_regexp().end(), + [&] (const regex_t_sptr& enum_regexp) + { + return regex::match(enum_regexp, i->first); + }) == get_changed_enumerators_regexp().end())) + { + matched &= false; + break; + } } if (!matched) return false; @@ -2162,6 +2194,34 @@ read_type_suppression(const ini::config::section& section) changed_enumerator_names.push_back(p->get_value()->as_string()); } + /// Support 'changed_enumerators_regexp = .*_foo, bar_[0-9]+, baz' + /// + /// If the current type is an enum and if it carries changed + /// enumerators that match regular expressions listed in the + /// changed_enumerators_regexp property value then it should be + /// suppressed. + + ini::property_sptr changed_enumerators_regexp_prop = + section.find_property("changed_enumerators_regexp"); + + vector changed_enumerators_regexp; + if (changed_enumerators_regexp_prop) + { + if (ini::list_property_sptr p = + is_list_property(changed_enumerators_regexp_prop)) + { + for (string e : p->get_value()->get_content()) + changed_enumerators_regexp.push_back(regex::compile(e)); + } + else if (ini::simple_property_sptr p = + is_simple_property(changed_enumerators_regexp_prop)) + { + changed_enumerators_regexp.push_back( + regex::compile(p->get_value()->as_string()) + ); + } + } + if (section.get_name() == "suppress_type") result.reset(new type_suppression(label_str, name_regex_str, name_str)); else if (section.get_name() == "allow_type") @@ -2225,6 +2285,10 @@ read_type_suppression(const ini::config::section& section) && !changed_enumerator_names.empty()) result->set_changed_enumerator_names(changed_enumerator_names); + if (result->get_type_kind() == type_suppression::ENUM_TYPE_KIND + && !changed_enumerators_regexp.empty()) + result->set_changed_enumerators_regexp(changed_enumerators_regexp); + return result; } diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index d1c767b3..1aa37b16 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -1760,6 +1760,21 @@ test-diff-suppr/test39-public-headers-dir/test39-header-v0.h \ test-diff-suppr/test39-public-headers-dir/test39-header-v1.h \ test-diff-suppr/libtest40-enumerator-changes-v0.so \ test-diff-suppr/libtest40-enumerator-changes-v1.so \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-1.suppr \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-2.suppr \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-3.suppr \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-4.suppr \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-5.suppr \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.c \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.c \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o \ +test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o \ test-diff-suppr/libtest41-enumerator-changes-v0.so \ test-diff-suppr/libtest41-enumerator-changes-v1.so \ test-diff-suppr/test40-enumerator-changes-0.suppr \ diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-1.suppr b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-1.suppr new file mode 100644 index 00000000..cbe76ab8 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-1.suppr @@ -0,0 +1,3 @@ +[suppress_type] + type_kind = enum + changed_enumerators_regexp = ^.*_LAST$ diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-2.suppr b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-2.suppr new file mode 100644 index 00000000..0ab63c10 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-2.suppr @@ -0,0 +1,3 @@ +[suppress_type] + type_kind = enum + changed_enumerators_regexp = ^.*_MAX$ diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-3.suppr b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-3.suppr new file mode 100644 index 00000000..e8bb9117 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-3.suppr @@ -0,0 +1,3 @@ +[suppress_type] + type_kind = enum + changed_enumerators_regexp = ^.*_LAST$, ^.*_MAX$ \ No newline at end of file diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-4.suppr b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-4.suppr new file mode 100644 index 00000000..492dd336 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-4.suppr @@ -0,0 +1,3 @@ +[suppress_type] + type_kind = enum + changed_enumerators_regexp = ^LAST_.*$ \ No newline at end of file diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-5.suppr b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-5.suppr new file mode 100644 index 00000000..3ee5d407 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-5.suppr @@ -0,0 +1,3 @@ +[suppress_type] + type_kind = enum + changed_enumerators_regexp = ^.*_LAST$, ^.*_MAX$, ^LAST_.*$ \ No newline at end of file diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt new file mode 100644 index 00000000..26435de3 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt @@ -0,0 +1,29 @@ +Functions changes summary: 0 Removed, 3 Changed, 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +3 functions with some indirect sub-type change: + + [C] 'function void fun0(Enum0)' at test40.1-enumerator-changes-enumerator-changes-v0.c:25:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum0' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum0::ENUM0_E1' value '1' + 1 enumerator change: + 'Enum0::ENOM0_LAST' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:6:1 + + [C] 'function void fun1(Enum1)' at test40.1-enumerator-changes-enumerator-changes-v0.c:30:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum1' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum1::ENUM1_E1' value '1' + 1 enumerator change: + 'Enum1::ENUM1_MAX' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:13:1 + + [C] 'function void fun2(Enum2)' at test40.1-enumerator-changes-enumerator-changes-v0.c:35:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum2' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum2::ENUM2_E1' value '1' + 1 enumerator change: + 'Enum2::LAST_ENUM1_ENUMERATOR' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:20:1 + diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt new file mode 100644 index 00000000..ff415ac5 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt @@ -0,0 +1,21 @@ +Functions changes summary: 0 Removed, 2 Changed (1 filtered out), 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +2 functions with some indirect sub-type change: + + [C] 'function void fun1(Enum1)' at test40.1-enumerator-changes-enumerator-changes-v0.c:30:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum1' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum1::ENUM1_E1' value '1' + 1 enumerator change: + 'Enum1::ENUM1_MAX' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:13:1 + + [C] 'function void fun2(Enum2)' at test40.1-enumerator-changes-enumerator-changes-v0.c:35:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum2' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum2::ENUM2_E1' value '1' + 1 enumerator change: + 'Enum2::LAST_ENUM1_ENUMERATOR' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:20:1 + diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt new file mode 100644 index 00000000..7e4093ca --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt @@ -0,0 +1,21 @@ +Functions changes summary: 0 Removed, 2 Changed (1 filtered out), 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +2 functions with some indirect sub-type change: + + [C] 'function void fun0(Enum0)' at test40.1-enumerator-changes-enumerator-changes-v0.c:25:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum0' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum0::ENUM0_E1' value '1' + 1 enumerator change: + 'Enum0::ENOM0_LAST' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:6:1 + + [C] 'function void fun2(Enum2)' at test40.1-enumerator-changes-enumerator-changes-v0.c:35:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum2' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum2::ENUM2_E1' value '1' + 1 enumerator change: + 'Enum2::LAST_ENUM1_ENUMERATOR' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:20:1 + diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt new file mode 100644 index 00000000..9f4bbcb2 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt @@ -0,0 +1,13 @@ +Functions changes summary: 0 Removed, 1 Changed (2 filtered out), 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +1 function with some indirect sub-type change: + + [C] 'function void fun2(Enum2)' at test40.1-enumerator-changes-enumerator-changes-v0.c:35:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum2' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum2::ENUM2_E1' value '1' + 1 enumerator change: + 'Enum2::LAST_ENUM1_ENUMERATOR' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:20:1 + diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt new file mode 100644 index 00000000..e09641c6 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt @@ -0,0 +1,21 @@ +Functions changes summary: 0 Removed, 2 Changed (1 filtered out), 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + +2 functions with some indirect sub-type change: + + [C] 'function void fun0(Enum0)' at test40.1-enumerator-changes-enumerator-changes-v0.c:25:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum0' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum0::ENUM0_E1' value '1' + 1 enumerator change: + 'Enum0::ENOM0_LAST' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:6:1 + + [C] 'function void fun1(Enum1)' at test40.1-enumerator-changes-enumerator-changes-v0.c:30:1 has some indirect sub-type changes: + parameter 1 of type 'enum Enum1' has sub-type changes: + type size hasn't changed + 1 enumerator insertion: + 'Enum1::ENUM1_E1' value '1' + 1 enumerator change: + 'Enum1::ENUM1_MAX' from value '1' to '2' at test40.1-enumerator-changes-enumerator-changes-v1.c:13:1 + diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt new file mode 100644 index 00000000..97239c74 --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt @@ -0,0 +1,3 @@ +Functions changes summary: 0 Removed, 0 Changed (3 filtered out), 0 Added functions +Variables changes summary: 0 Removed, 0 Changed, 0 Added variable + diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.c b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.c new file mode 100644 index 00000000..7b32ee8b --- /dev/null +++ b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.c @@ -0,0 +1,37 @@ +/** + * compile this with: + * gcc -g -c test40.1-enumerator-changes-enumerator-changes-v0.c + */ + +enum Enum0 +{ + ENUM0_E0, + ENOM0_LAST +}; + +enum Enum1 +{ + ENUM1_E0, + ENUM1_MAX +}; + +enum Enum2 +{ + ENUM2_E0, + LAST_ENUM1_ENUMERATOR +}; + +void +fun0(enum Enum0 p __attribute__((unused))) +{ +} + +void +fun1(enum Enum1 p __attribute__((unused))) +{ +} + +void +fun2(enum Enum2 p __attribute__((unused))) +{ +} diff --git a/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o b/tests/data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o new file mode 100644 index 0000000000000000000000000000000000000000..8234f05d0e157a66a88be438cbe4a1f17c2fa01f GIT binary patch literal 3944 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 literal 0 HcmV?d00001 diff --git a/tests/test-diff-suppr.cc b/tests/test-diff-suppr.cc --- a/tests/test-diff-suppr.cc +++ b/tests/test-diff-suppr.cc @@ -1836,6 +1836,66 @@ InOutSpec in_out_specs[] = "data/test-diff-suppr/test40-enumerator-changes-report-0.txt", "output/test-diff-suppr/test40-enumerator-changes-report-0.txt" }, + { + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o", + "", + "", + "", + "--no-default-suppression", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt", + "output/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-0.txt" + }, + { + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o", + "", + "", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-1.suppr", + "--no-default-suppression", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt", + "output/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-1.txt" + }, + { + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o", + "", + "", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-2.suppr", + "--no-default-suppression", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt", + "output/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-2.txt" + }, + { + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o", + "", + "", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-3.suppr", + "--no-default-suppression", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt", + "output/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-3.txt" + }, + { + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o", + "", + "", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-4.suppr", + "--no-default-suppression", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt", + "output/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-4.txt" + }, + { + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v0.o", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-v1.o", + "", + "", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-5.suppr", + "--no-default-suppression", + "data/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt", + "output/test-diff-suppr/test40.1-enumerator-changes-enumerator-changes-report-5.txt" + }, { "data/test-diff-suppr/libtest41-enumerator-changes-v0.so", "data/test-diff-suppr/libtest41-enumerator-changes-v1.so",