]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/testsuite/util/testsuite_abi.h
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / util / testsuite_abi.h
CommitLineData
e2585cd8 1// -*- C++ -*-
2
fbd26352 3// Copyright (C) 2004-2019 Free Software Foundation, Inc.
e2585cd8 4
5// This library is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License as
6bc9506f 7// published by the Free Software Foundation; either version 3, or (at
e2585cd8 8// your option) any later version.
9
10// This library is distributed in the hope that it will be useful, but
11// WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13// General Public License for more details.
14
15// You should have received a copy of the GNU General Public License
6bc9506f 16// along with this library; see the file COPYING3. If not see
17// <http://www.gnu.org/licenses/>.
18
e2585cd8 19// Benjamin Kosnik <bkoz@redhat.com>
20
21#include <string>
22#include <stdexcept>
7fa1b395 23#include <vector>
022ea294 24#include <locale>
4d76c7df 25#include <tr1/unordered_map>
e2585cd8 26#include <cxxabi.h>
27
28// Encapsulates symbol characteristics.
29struct symbol
30{
78f5b9c4 31 enum category { function, object, tls, uncategorized };
e4371cce 32 enum designation { existing, added, subtracted, undesignated };
33 enum version { none, compatible, incompatible, unversioned };
33b7ef52 34 enum compatibility
35 {
36 compat_type = 1,
37 compat_name = 2,
38 compat_size = 4,
39 compat_version = 8
e2585cd8 40 };
41
42 category type;
43 std::string name;
e4371cce 44 std::string raw_name; // Name with versioning info still attached.
e2585cd8 45 std::string demangled_name;
46 int size;
47 std::string version_name;
e4371cce 48 version version_status;
e2585cd8 49 designation status;
50
33b7ef52 51 symbol()
52 : type(uncategorized), size(0), version_status(unversioned),
e4371cce 53 status(undesignated) { }
e2585cd8 54
33b7ef52 55 symbol(const symbol& other)
56 : type(other.type), name(other.name), demangled_name(other.demangled_name),
57 size(other.size), version_name(other.version_name),
e4371cce 58 version_status(other.version_status), status(other.status) { }
e2585cd8 59
60 void
61 print() const;
62
63 void
64 init(std::string& data);
65};
66
7fa1b395 67// Map type between symbol names and full symbol info.
68typedef std::tr1::unordered_map<std::string, symbol> symbols;
e2585cd8 69
70
71// Check.
72bool
e4371cce 73check_version(symbol& test, bool added = false);
e2585cd8 74
33b7ef52 75bool
e4371cce 76check_compatible(symbol& lhs, symbol& rhs, bool verbose = false);
e2585cd8 77
78
79// Examine.
80bool
81has_symbol(const std::string& mangled, const symbols& list) throw();
82
7fa1b395 83const symbol&
e2585cd8 84get_symbol(const std::string& mangled, const symbols& list);
85
86extern "C" void
87examine_symbol(const char* name, const char* file);
88
c6dc6159 89extern "C" int
e2585cd8 90compare_symbols(const char* baseline_file, const char* test_file, bool verb);
91
92
93// Util.
94symbols
95create_symbols(const char* file);
96
2b7cce40 97std::string
e2585cd8 98demangle(const std::string& mangled);