mirror of
git://sourceware.org/git/libabigail.git
synced 2024-12-17 07:24:34 +00:00
feea5df3fe
* include/abg-comparison.h (diff_category::SUPPRESSED_CATEGORY): New enumerator. (diff_category::{SIZE_OR_OFFSET_CHANGE_CATEGORY, VIRTUAL_MEMBER_CHANGE_CATEGORY): Update the enumerator values for these. (diff::EVERYTHING_CATEGORY): Adjust. (suppression_base, type_suppression): Declare new types. (suppression_ptr, suppressions_type, type_suppression_sptr) (type_suppressions_type): New typedefs. (read_type_suppressions, read_suppressions): Declare new functions. (diff_context::{suppressions, add_suppression, add_suppressions}): Declare new methods. (diff::is_suppressed): Declare new member function. (apply_suppressions): Declare new function & overloads. * src/abg-comparison.cc (is_type_diff): Define new static function. ({suppression_base, type_suppression}::priv): Define new types. ({suppression_base, type_suppression}::*): Define the methods of the new suppression_base, type_suppressions types. (read_type_suppression, read_type_suppressions, read_suppressions) (read_type_suppressions): Define new static functions. (diff_context::priv::supprssions_): New data member. (diff_context::{suppressions, add_suppression, add_suppressions}): New methods. (diff::is_filtered_out): Consider that a diff node that is in the SUPPRESSED_CATEGORY is filtered out. (diff::is_suppressed): Define new member function. (operator<<(ostream& o, diff_category c)): Support the SUPPRESSED_CATEGORY category. (corpus_diff::report): Apply suppressions before reporting anything. (category_propagation_visitor::visit_end): Do not propagate SUPPRESSED_CATEGORY. This is just like what we do for REDUNDANT_CATEGORY. (struct suppression_categorization_visitor): New visitor. (apply_suppressions): Define function & overloads. * include/abg-ini.h (config::section::find_property): New method. (config::section): Fix end of class comment. * src/abg-ini.cc (config::section::find_property): Define new method. * tests/data/test-diff-suppr/test0-type-suppr-{0,1,2}.suppr: New test input files. * tests/data/test-diff-suppr/test0-type-suppr-report-{0,1,2,3}.txt: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.o: Likewise. * tests/data/test-diff-suppr/test0-type-suppr-v{0,1}.cc: Source code for new test input. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.o: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr.h: Source code for new test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-v{0,1}.c: Likewise * tests/data/test-diff-suppr/test1-typedef-suppr-{0,1}.suppr: New test input files. * tests/data/test-diff-suppr/test1-typedef-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test1-typedef-suppr-report-2.txt: Likewise. * tests/test-diff-suppr.cc: New test harness to run type suppression tests using the input files above. * tests/data/test-diff-suppr/test3-struct-suppr-0.suppr: New test input. * tests/data/test-diff-suppr/test3-struct-suppr-1.suppr: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-0.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-1.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-report-2.txt: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v0.o: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.cc: Likewise. * tests/data/test-diff-suppr/test3-struct-suppr-v1.o: Likewise. * tests/Makefile.am: Build the new runtestdiffsuppr test harness from the test-diff-filter.cc file. Add the new test files to the build system and source distribution. * tools/bidiff.cc (options::suppressions): New data member. (display_usage): Add a help string for the new --suppressions command line switch. (parse_command_line): Parse the --suppressions command line switch. (set_diff_context_from_opts): Read the suppressions provided by the --suppression command line switch and stuff them into the diff context.
180 lines
4.1 KiB
C++
180 lines
4.1 KiB
C++
// -*- Mode: C++ -*-
|
|
//
|
|
// Copyright (C) 2013-2014 Red Hat, Inc.
|
|
//
|
|
// This file is part of the GNU Application Binary Interface Generic
|
|
// Analysis and Instrumentation Library (libabigail). This library is
|
|
// free software; you can redistribute it and/or modify it under the
|
|
// terms of the GNU Lesser General Public License as published by the
|
|
// Free Software Foundation; either version 3, or (at your option) any
|
|
// later version.
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
// General Lesser Public License for more details.
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
// License along with this program; see the file COPYING-LGPLV3. If
|
|
// not, see <http://www.gnu.org/licenses/>.
|
|
//
|
|
// Author: Dodji Seketeli
|
|
|
|
/// @file
|
|
///
|
|
/// This file contains the declarations for the ini file reader used in
|
|
/// the libabigail library.
|
|
|
|
#ifndef __ABG_INI_H__
|
|
#define __ABG_INI_H__
|
|
|
|
#include <tr1/memory>
|
|
#include <string>
|
|
#include <vector>
|
|
#include <istream>
|
|
#include <ostream>
|
|
|
|
namespace abigail
|
|
{
|
|
/// Namespace for handling ini-style files
|
|
namespace ini
|
|
{
|
|
// Inject some standard types in this namespace.
|
|
using std::tr1::shared_ptr;
|
|
using std::string;
|
|
using std::vector;
|
|
using std:: pair;
|
|
|
|
class config;
|
|
|
|
/// A convenience typedef for a shared pointer to @ref config
|
|
typedef shared_ptr<config> config_sptr;
|
|
|
|
/// The abstraction of the structured content of an .ini file. This
|
|
/// roughly follows what is explained at
|
|
/// http://en.wikipedia.org/wiki/INI_file.
|
|
class config
|
|
{
|
|
class priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
public:
|
|
class section;
|
|
/// A convenience typedef for a shared pointer to a config::section.
|
|
typedef shared_ptr<section> section_sptr;
|
|
|
|
/// A convenience typedef for a vector of config::section_sptr.
|
|
typedef vector<section_sptr> sections_type;
|
|
|
|
/// A convenience typedef for a pair of strings representing a
|
|
/// property that lies inside a section. The first element of the
|
|
/// pair is the property name, and the second is the property value.
|
|
typedef std::pair<string, string> property;
|
|
|
|
/// A convenience typedef for a shared pointer to a @ref property.
|
|
typedef shared_ptr<property> property_sptr;
|
|
|
|
/// A convenience typedef for a vector of @ref property_sptr
|
|
typedef vector<property_sptr> property_vector;
|
|
|
|
private:
|
|
priv_sptr priv_;
|
|
|
|
public:
|
|
|
|
config();
|
|
|
|
config(const string& path,
|
|
sections_type& sections);
|
|
|
|
virtual ~config();
|
|
|
|
const string&
|
|
get_path() const;
|
|
|
|
void
|
|
set_path(const string& path);
|
|
|
|
const sections_type&
|
|
get_sections() const;
|
|
|
|
void
|
|
set_sections(const sections_type& sections);
|
|
}; // end class config
|
|
|
|
/// The abstraction of one section of the .ini config.
|
|
class config::section
|
|
{
|
|
struct priv;
|
|
typedef shared_ptr<priv> priv_sptr;
|
|
|
|
priv_sptr priv_;
|
|
|
|
// Forbid this
|
|
section();
|
|
|
|
public:
|
|
section(const string& name);
|
|
|
|
section(const string& name, const property_vector& properties);
|
|
|
|
const string&
|
|
get_name() const;
|
|
|
|
const property_vector&
|
|
get_properties() const;
|
|
|
|
void
|
|
set_properties(const property_vector& properties);
|
|
|
|
void
|
|
add_property(const property_sptr prop);
|
|
|
|
property_sptr
|
|
find_property(const string& prop_name) const;
|
|
|
|
virtual ~section();
|
|
}; //end class config::section
|
|
|
|
bool
|
|
read_sections(std::istream& input,
|
|
config::sections_type& sections);
|
|
|
|
bool
|
|
read_sections(const string& path,
|
|
config::sections_type& sections);
|
|
|
|
bool
|
|
read_config(std::istream& input,
|
|
config& conf);
|
|
|
|
config_sptr
|
|
read_config(std::istream& input);
|
|
|
|
bool
|
|
read_config(const string& path,
|
|
config& conf);
|
|
|
|
config_sptr
|
|
read_config(const string& path);
|
|
|
|
bool
|
|
write_sections(const config::sections_type& sections,
|
|
std::ostream& output);
|
|
|
|
bool
|
|
write_sections(const config::sections_type& sections,
|
|
const string& path);
|
|
|
|
bool
|
|
write_config(const config& conf,
|
|
std::ostream& output);
|
|
|
|
bool
|
|
write_config(const config& conf,
|
|
const string& path);
|
|
|
|
}// end namespace ini
|
|
}// end namespace abigail
|
|
#endif // __ABG_INI_H__
|