Merge -r 127928:132243 from trunk
[official-gcc.git] / libstdc++-v3 / testsuite / util / testsuite_abi.h
bloba659ef4a7429675468e7c46fe52b0fd7c565eb3e
1 // -*- C++ -*-
3 // Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
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
7 // published by the Free Software Foundation; either version 2, or (at
8 // your option) any later version.
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.
15 // You should have received a copy of the GNU General Public License
16 // along with this library; see the file COPYING. If not, write to
17 // the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
18 // MA 02110-1301, USA.
20 // As a special exception, you may use this file as part of a free
21 // software library without restriction. Specifically, if other files
22 // instantiate templates or use macros or inline functions from this
23 // file, or you compile this file and link it with other files to
24 // produce an executable, this file does not by itself cause the
25 // resulting executable to be covered by the GNU General Public
26 // License. This exception does not however invalidate any other
27 // reasons why the executable file might be covered by the GNU General
28 // Public License.
30 // Benjamin Kosnik <bkoz@redhat.com>
32 #include <string>
33 #include <stdexcept>
34 #include <deque>
35 #include <locale>
36 #include <tr1/unordered_map>
37 #include <cxxabi.h>
39 // Encapsulates symbol characteristics.
40 struct symbol
42 enum category { function, object, uncategorized };
43 enum designation { existing, added, subtracted, undesignated };
44 enum version { none, compatible, incompatible, unversioned };
45 enum compatibility
47 compat_type = 1,
48 compat_name = 2,
49 compat_size = 4,
50 compat_version = 8
53 category type;
54 std::string name;
55 std::string raw_name; // Name with versioning info still attached.
56 std::string demangled_name;
57 int size;
58 std::string version_name;
59 version version_status;
60 designation status;
62 symbol()
63 : type(uncategorized), size(0), version_status(unversioned),
64 status(undesignated) { }
66 symbol(const symbol& other)
67 : type(other.type), name(other.name), demangled_name(other.demangled_name),
68 size(other.size), version_name(other.version_name),
69 version_status(other.version_status), status(other.status) { }
71 void
72 print() const;
74 void
75 init(std::string& data);
78 typedef std::tr1::unordered_map<std::string, symbol> symbol_objects;
80 typedef std::deque<std::string> symbol_names;
82 typedef std::pair<symbol_names, symbol_objects> symbols;
85 // Check.
86 bool
87 check_version(symbol& test, bool added = false);
89 bool
90 check_compatible(symbol& lhs, symbol& rhs, bool verbose = false);
93 // Examine.
94 bool
95 has_symbol(const std::string& mangled, const symbols& list) throw();
97 symbol&
98 get_symbol(const std::string& mangled, const symbols& list);
100 extern "C" void
101 examine_symbol(const char* name, const char* file);
103 extern "C" int
104 compare_symbols(const char* baseline_file, const char* test_file, bool verb);
107 // Util.
108 symbols
109 create_symbols(const char* file);
111 const char*
112 demangle(const std::string& mangled);