of the following properties must be provided:
``file_name_regexp``, ``file_name_not_regexp``, ``soname_regexp``,
- ``soname_not_regexp``, ``name``, ``name_regexp``, ``type_kind``,
- ``source_location_not_in``, ``source_location_not_regexp``.
+ ``soname_not_regexp``, ``name``, ``name_regexp``,
+ ``name_not_regexp``, ``type_kind``, ``source_location_not_in``,
+ ``source_location_not_regexp``.
If none of the following properties are provided, then the
``[suppress_type]`` directive is simply ignored.
Suppresses change reports involving types whose name matches the
regular expression specified as value of this property.
+
+* ``name_not_regexp``
+
+ Usage:
+
+ ``name_not_regexp`` ``=`` <:ref:`regular-expression <suppr_regexp_label>`>
+
+ Suppresses change reports involving types whose name does *NOT* match
+ the regular expression specified as value of this property. Said
+ otherwise, this property specifies which types to keep, rather than
+ types to suppress from reports.
+
* ``name``
Usage:
get_type_name_regex_str() const;
void
+ set_type_name_not_regex_str(const string& name_regex_str);
+
+ const string&
+ get_type_name_not_regex_str() const;
+
+ void
set_type_name(const string& name);
const string&
string type_name_regex_str_;
mutable sptr_utils::regex_t_sptr type_name_regex_;
string type_name_;
+ string type_name_not_regex_str_;
+ mutable sptr_utils::regex_t_sptr type_name_not_regex_;
bool consider_type_kind_;
type_suppression::type_kind type_kind_;
bool consider_reach_kind_;
set_type_name_regex(sptr_utils::regex_t_sptr r)
{type_name_regex_ = r;}
+ /// Get the regular expression object associated to the
+ /// 'type_name_not_regex' property of @ref type_suppression.
+ ///
+ /// If the regular expression object is not created, this method
+ /// creates it and returns it.
+ ///
+ /// If the 'type_name_not_regex' property of @ref type_suppression is
+ /// empty then this method returns nil.
+ const sptr_utils::regex_t_sptr
+ get_type_name_not_regex() const
+ {
+ if (!type_name_not_regex_)
+ {
+ if (!type_name_not_regex_str_.empty())
+ {
+ sptr_utils::regex_t_sptr r = sptr_utils::build_sptr<regex_t>();
+ if (regcomp(r.get(),
+ type_name_not_regex_str_.c_str(),
+ REG_EXTENDED) == 0)
+ type_name_not_regex_ = r;
+ }
+ }
+ return type_name_not_regex_;
+ }
+
+ /// Setter for the type_name_not_regex object.
+ ///
+ /// @param r the new type_name_not_regex object.
+ void
+ set_type_name_not_regex(sptr_utils::regex_t_sptr r)
+ {type_name_not_regex_ = r;}
+
+ /// Getter for the string that denotes the 'type_name_not_regex'
+ /// property.
+ ///
+ /// @return the value of the string value of the
+ /// 'type_name_not_regex' property.
+ const string&
+ get_type_name_not_regex_str() const
+ {return type_name_not_regex_str_;}
+
+ /// Setter for the string that denotes the 'type_name_not_regex'
+ /// property.
+ ///
+ /// @return the value of the string value of the
+ /// 'type_name_not_regex' property.
+ void
+ set_type_name_not_regex_str(const string regex_str)
+ {type_name_not_regex_str_ = regex_str;}
+
/// Getter for the source_location_to_keep_regex object.
///
/// This function builds the regex if it's not yet built.
/// Getter for the "type_name_regex" property of the type suppression
/// specification.
///
-/// This returns a regular expression that specifies the family of
-/// types about which diff reports should be suppressed.
+/// This returns a regular expression string that specifies the family
+/// of types about which diff reports should be suppressed.
///
-/// @return the regular expression.
+/// @return the regular expression string.
const string&
type_suppression::get_type_name_regex_str() const
{return priv_->type_name_regex_str_;}
+/// Setter for the "type_name_not_regex_str" property of the type
+/// suppression specification.
+///
+/// This returns a regular expression string that specifies the family
+/// of types that should be kept after suppression.
+///
+/// @param r the new regexp string.
+void
+type_suppression::set_type_name_not_regex_str(const string& r)
+{priv_->set_type_name_not_regex_str(r);}
+
+/// Getter for the "type_name_not_regex_str" property of the type
+/// suppression specification.
+///
+/// This returns a regular expression string that specifies the family
+/// of types that should be kept after suppression.
+///
+/// @return the new regexp string.
+const string&
+type_suppression::get_type_name_not_regex_str() const
+{return priv_->get_type_name_not_regex_str();}
+
/// Setter for the name of the type about which diff reports should be
/// suppressed.
///
suppression_matches_type_name(const type_suppression& s,
const string& type_name)
{
- if (!s.get_type_name().empty() || s.priv_->get_type_name_regex())
+ if (!s.get_type_name().empty()
+ || s.priv_->get_type_name_regex()
+ || s.priv_->get_type_name_not_regex())
{
// Check if there is an exact type name match.
if (!s.get_type_name().empty())
// If the qualified name of the considered type doesn't match
// the regular expression of the type name, then this
// suppression doesn't apply.
- const sptr_utils::regex_t_sptr& type_name_regex =
- s.priv_->get_type_name_regex();
- if (type_name_regex && (regexec(type_name_regex.get(),
- type_name.c_str(),
- 0, NULL, 0) != 0))
- return false;
+ if (const sptr_utils::regex_t_sptr& type_name_regex =
+ s.priv_->get_type_name_regex())
+ {
+ if (regexec(type_name_regex.get(),
+ type_name.c_str(),
+ 0, NULL, 0) != 0)
+ return false;
+ }
+
+ if (const sptr_utils::regex_t_sptr type_name_not_regex =
+ s.priv_->get_type_name_not_regex())
+ {
+ if (regexec(type_name_not_regex.get(),
+ type_name.c_str(),
+ 0, NULL, 0) == 0)
+ return false;
+ }
}
}
? name_regex_prop->get_value()->as_string()
: "";
+ ini::simple_property_sptr name_not_regex_prop =
+ is_simple_property(section.find_property("name_not_regexp"));
+ string name_not_regex_str = name_not_regex_prop
+ ? name_not_regex_prop->get_value()->as_string()
+ : "";
+
ini::simple_property_sptr name_prop =
is_simple_property(section.find_property("name"));
string name_str = name_prop
&& soname_regex_str.empty()
&& soname_not_regex_str.empty()
&& (!name_regex_prop || name_regex_prop->get_value()->as_string().empty())
+ && (!name_not_regex_prop
+ || name_not_regex_prop->get_value()->as_string().empty())
&& (!name_prop || name_prop->get_value()->as_string().empty())
&& !consider_type_kind
&& srcloc_not_regexp_str.empty()
if (consider_data_member_insertion)
suppr->set_data_member_insertion_ranges(insert_ranges);
+ if (!name_not_regex_str.empty())
+ suppr->set_type_name_not_regex_str(name_not_regex_str);
+
if (!file_name_regex_str.empty())
suppr->set_file_name_regex_str(file_name_regex_str);
test-diff-suppr/test41-enumerator-changes-report-0.txt \
test-diff-suppr/test41-enumerator-changes-v0.cc \
test-diff-suppr/test41-enumerator-changes-v1.cc \
+test-diff-suppr/test42-negative-suppr-type-report-0.txt \
+test-diff-suppr/test42-negative-suppr-type-report-1.txt \
+test-diff-suppr/test42-negative-suppr-type-suppr-1.txt \
+test-diff-suppr/test42-negative-suppr-type-suppr-2.txt \
+test-diff-suppr/test42-negative-suppr-type-v0.cc \
+test-diff-suppr/test42-negative-suppr-type-v0.o \
+test-diff-suppr/test42-negative-suppr-type-v1.cc \
+test-diff-suppr/test42-negative-suppr-type-v1.o \
test-diff-suppr/test43-suppr-direct-fn-subtype-suppr-1.txt \
test-diff-suppr/test43-suppr-direct-fn-subtype-v0.cc \
test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o \
--- /dev/null
+Functions changes summary: 0 Removed, 1 Changed (1 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 func0(type_to_keep)' at test42-negative-suppr-type-v1.cc:15:1 has some indirect sub-type changes:
+ parameter 1 of type 'struct type_to_keep' has sub-type changes:
+ type size changed from 32 to 64 (in bits)
+ 1 data member insertion:
+ 'char type_to_keep::m1', at offset 32 (in bits) at test42-negative-suppr-type-v1.cc:4:1
+
+
--- /dev/null
+Functions changes summary: 0 Removed, 1 Changed (1 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 func0(type_to_keep)' at test42-negative-suppr-type-v1.cc:15:1 has some indirect sub-type changes:
+ parameter 1 of type 'struct type_to_keep' has sub-type changes:
+ type size changed from 32 to 64 (in bits)
+ 1 data member insertion:
+ 'char type_to_keep::m1', at offset 32 (in bits) at test42-negative-suppr-type-v1.cc:4:1
+
+
--- /dev/null
+[suppress_type]
+ name_not_regexp = type_to_keep
+
--- /dev/null
+[suppress_type]
+ name_regexp = type_to_suppress
--- /dev/null
+struct type_to_keep
+{
+ int m0;
+};
+
+struct type_to_suppress
+{
+ int m0;
+};
+
+
+void
+func0(struct type_to_keep)
+{
+}
+
+void
+func1(struct type_to_suppress)
+{
+}
--- /dev/null
+struct type_to_keep
+{
+ int m0;
+ char m1;
+};
+
+struct type_to_suppress
+{
+ int m0;
+ char m1;
+};
+
+
+void
+func0(struct type_to_keep)
+{
+}
+
+void
+func1(struct type_to_suppress)
+{
+}
"output/test-diff-suppr/test41-enumerator-changes-report-0.txt"
},
{
+ "data/test-diff-suppr/test42-negative-suppr-type-v0.o",
+ "data/test-diff-suppr/test42-negative-suppr-type-v1.o",
+ "",
+ "",
+ "data/test-diff-suppr/test42-negative-suppr-type-suppr-1.txt",
+ "--no-default-suppression",
+ "data/test-diff-suppr/test42-negative-suppr-type-report-0.txt",
+ "output/test-diff-suppr/test42-negative-suppr-type-report-0.txt"
+ },
+ {
+ "data/test-diff-suppr/test42-negative-suppr-type-v0.o",
+ "data/test-diff-suppr/test42-negative-suppr-type-v1.o",
+ "",
+ "",
+ "data/test-diff-suppr/test42-negative-suppr-type-suppr-2.txt",
+ "--no-default-suppression",
+ "data/test-diff-suppr/test42-negative-suppr-type-report-1.txt",
+ "output/test-diff-suppr/test42-negative-suppr-type-report-1.txt"
+ },
+ {
"data/test-diff-suppr/test43-suppr-direct-fn-subtype-v0.o",
"data/test-diff-suppr/test43-suppr-direct-fn-subtype-v1.o",
"",