#include <string>
#include <stdexcept>
#include <deque>
#include <ext/hash_map>
#include <cxxabi.h>
struct symbol
{
enum category { none, function, object, error };
enum designation { unknown, added, subtracted, compatible, incompatible };
enum compatibility
{
compat_type = 1,
compat_name = 2,
compat_size = 4,
compat_version = 8
};
category type;
std::string name;
std::string demangled_name;
int size;
std::string version_name;
designation status;
symbol() : type(none), size(0), status(unknown) { }
symbol(const symbol& other)
: type(other.type), name(other.name), demangled_name(other.demangled_name),
size(other.size), version_name(other.version_name),
status(other.status) { }
void
print() const;
void
init(std::string& data);
};
typedef __gnu_cxx::hash_map<std::string, symbol> symbol_objects;
typedef std::deque<std::string> symbol_names;
typedef std::pair<symbol_names, symbol_objects> symbols;
bool
check_version(const symbol& test, bool added = false);
bool
check_compatible(const symbol& lhs, const symbol& rhs, bool verbose = false);
bool
has_symbol(const std::string& mangled, const symbols& list) throw();
symbol&
get_symbol(const std::string& mangled, const symbols& list);
extern "C" void
examine_symbol(const char* name, const char* file);
extern "C" void
compare_symbols(const char* baseline_file, const char* test_file, bool verb);
symbols
create_symbols(const char* file);
const char*
demangle(const std::string& mangled);
namespace __gnu_cxx
{
using namespace std;
template<>
struct hash<string>
{
size_t operator()(const string& s) const
{
const collate<char>& c = use_facet<collate<char> >(locale::classic());
return c.hash(s.c_str(), s.c_str() + s.size());
}
};
}