From patchwork Mon Oct 2 21:45:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dodji Seketeli X-Patchwork-Id: 76995 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 197833858C31 for ; Mon, 2 Oct 2023 21:46:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 197833858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1696283172; bh=r75FlWh1ODWie9k2vwfLx1YIvmVU1jtz73pLCoqsDMY=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Help: List-Subscribe:From:Reply-To:Cc:From; b=j4EUOwB9QIBb4Ule1YG0A6M+UDRVEE/qpoFdu4jH4I/7C3wZ8MkJOKq3LXfNaXrYV t441W2W++W4rqH588LrTJn6kVtA8u2u0+4RHkTz3kBgKOVYtzjqgf3osQvGqJ1ipmC q76rISiyP6cdsK4JjkZgoS9W0FO1A85Am9Yt+zww= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 5B9483858D33 for ; Mon, 2 Oct 2023 21:46:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5B9483858D33 Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-ztPFK8wcMEKHTlO0cdbUzg-1; Mon, 02 Oct 2023 17:46:00 -0400 X-MC-Unique: ztPFK8wcMEKHTlO0cdbUzg-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-418225fb5d6so3497701cf.3 for ; Mon, 02 Oct 2023 14:46:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696283160; x=1696887960; h=mime-version:user-agent:message-id:date:organization:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=r75FlWh1ODWie9k2vwfLx1YIvmVU1jtz73pLCoqsDMY=; b=bbg4BoIch6J5AtlwuufLARU4Maweb/ERU0NPTRRq3U6Tq/B4zJ0VZEpApMjpbstqRW YHx1EJLORuJqDF7oEJvXFOXNpFXmUv8j8HzKBXrz9fC9UaSYnP+1iA+tRwmeQFEgEUPv vvH93buTQzIGND2Lb1SLJZMnFTvxm5YZv53dZrabG3GKF1pu++Uj3n1Uo/MouyqOd6zl DrNTDFofS61W/HWjoSCJdNV9mDxBcmYO7346BFVA5nuSIT8x8ZN8TPdDV15QKmeQhNI9 fHQIZ7RZylZRAOvu/Qijyt8jIAofc2BWrNPwRf17xZZniX2DZMaJs2pfoE0+lCq56u4i ZxeA== X-Gm-Message-State: AOJu0Yx1Yv27Xqeu2tkYM14Qt7W1CEDpauSvOwxrDNXnpTU3rIp5vg3/ 2VD4NILLzMJVqXCP1/zslMmEutqLF2myDtxoGmfExJUoeJaO0bY7u1YBJa8lr9dnXSWZ3SG2gYR MAFcP+xtb1ouUhEoJB+UK/eCYjH42 X-Received: by 2002:a05:622a:120c:b0:418:1bd0:fa0 with SMTP id y12-20020a05622a120c00b004181bd00fa0mr13192727qtx.51.1696283159285; Mon, 02 Oct 2023 14:45:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGGMW2wOnWQhmvmHcJv3ql4/nYo3hgJgfYr9DZhjhjqoKj0ojwqN8YtYgCh8oLx3c/2ZJgfCQ== X-Received: by 2002:a05:622a:120c:b0:418:1bd0:fa0 with SMTP id y12-20020a05622a120c00b004181bd00fa0mr13192716qtx.51.1696283158831; Mon, 02 Oct 2023 14:45:58 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id g28-20020ac84b7c000000b00417fa0cd77esm8092383qts.80.2023.10.02.14.45.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 14:45:58 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id B7B75B6E87; Mon, 2 Oct 2023 23:45:56 +0200 (CEST) To: libabigail@sourceware.org Subject: [PATCH, applied to check-uapi-support] suppression: Add "changed_enumerators_regexp" property Organization: Red Hat / France X-Operating-System: CentOS Stream release 9 X-URL: http://www.redhat.com Date: Mon, 02 Oct 2023 23:45:56 +0200 Message-ID: <87msx0hf57.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_H3, 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-Help: List-Subscribe: , X-Patchwork-Original-From: Dodji Seketeli via Libabigail From: Dodji Seketeli Reply-To: Dodji Seketeli Cc: Trilok Soni , Satya Durga Srinivasu Prabhala Errors-To: libabigail-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libabigail" 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 the WIP branch https://sourceware.org/git/?p=libabigail.git;a=shortlog;h=refs/heads/users/dodji/check-uapi-support --- 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 11be9b9a..46f29242 100644 diff --git a/doc/manuals/libabigail-concepts.rst b/doc/manuals/libabigail-concepts.rst index f8b5f105..f850252b 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 9449d06d..d6283eb8 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 4ed42e82..22adfa8c 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. /// @@ -996,9 +1018,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(); @@ -1006,13 +1031,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; @@ -2154,6 +2186,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") @@ -2217,6 +2277,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 b3434da5..1632e2ab 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -1755,6 +1755,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 zcmc&$&2Jl35TEthaf%b?t3XUj<4{o2s$PGP21rTbD3~T9Ng*^65+Cl`UVl(~ZQ1K6 z1OYu26*#mKhaNa0AtVGvAWod%!e0Q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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",