mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-20 12:41:17 +08:00
testsuite_abi.h: Remove symbol_objects, symbol_names typedefs.
2008-03-26 Benjamin Kosnik <bkoz@redhat.com> * testsuite/util/testsuite_abi.h: Remove symbol_objects, symbol_names typedefs. * testsuite/util/testsuite_abi.cc (compare_symbols): Correct check for long double compatiblity symbols, simplify data structures used. From-SVN: r133621
This commit is contained in:
parent
b8ab1f4ade
commit
0c312c2dbb
@ -1,3 +1,10 @@
|
||||
2008-03-26 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* testsuite/util/testsuite_abi.h: Remove symbol_objects,
|
||||
symbol_names typedefs.
|
||||
* testsuite/util/testsuite_abi.cc (compare_symbols): Correct check
|
||||
for long double compatiblity symbols, simplify data structures used.
|
||||
|
||||
2008-03-25 Benjamin Kosnik <bkoz@redhat.com>
|
||||
|
||||
* scripts/run_doxygen: Remove html_output_dir. Downgrade to
|
||||
|
@ -218,6 +218,15 @@ check_version(symbol& test, bool added)
|
||||
if (added && test.version_name == known_versions[0])
|
||||
test.version_status = symbol::incompatible;
|
||||
|
||||
// Check that long double compatibility symbols demangled as
|
||||
// __float128 are put into some _LDBL_ version name.
|
||||
if (added && test.demangled_name.find("__float128") != std::string::npos)
|
||||
{
|
||||
// Has to be in _LDBL_ version name.
|
||||
if (test.version_name.find("_LDBL_") == std::string::npos)
|
||||
test.version_status = symbol::incompatible;
|
||||
}
|
||||
|
||||
// Check for weak label.
|
||||
if (it1 == end && it2 == end)
|
||||
test.version_status = symbol::incompatible;
|
||||
@ -294,28 +303,22 @@ check_compatible(symbol& lhs, symbol& rhs, bool verbose)
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
has_symbol(const string& mangled, const symbols& s) throw()
|
||||
{
|
||||
const symbol_names& names = s.first;
|
||||
symbol_names::const_iterator i = find(names.begin(), names.end(), mangled);
|
||||
return i != names.end();
|
||||
}
|
||||
inline bool
|
||||
has_symbol(const string& name, const symbols& s) throw()
|
||||
{ return s.find(name) != s.end(); }
|
||||
|
||||
symbol&
|
||||
get_symbol(const string& mangled, const symbols& s)
|
||||
const symbol&
|
||||
get_symbol(const string& name, const symbols& s)
|
||||
{
|
||||
const symbol_names& names = s.first;
|
||||
symbol_names::const_iterator i = find(names.begin(), names.end(), mangled);
|
||||
if (i != names.end())
|
||||
symbols::const_iterator i = s.find(name);
|
||||
if (i != s.end())
|
||||
{
|
||||
symbol_objects objects = s.second;
|
||||
return objects[mangled];
|
||||
return i->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
ostringstream os;
|
||||
os << "get_symbol failed for symbol " << mangled;
|
||||
os << "get_symbol failed for symbol " << name;
|
||||
__throw_logic_error(os.str().c_str());
|
||||
}
|
||||
}
|
||||
@ -326,7 +329,7 @@ examine_symbol(const char* name, const char* file)
|
||||
try
|
||||
{
|
||||
symbols s = create_symbols(file);
|
||||
symbol& sym = get_symbol(name, s);
|
||||
const symbol& sym = get_symbol(name, s);
|
||||
sym.print();
|
||||
}
|
||||
catch(...)
|
||||
@ -340,15 +343,9 @@ compare_symbols(const char* baseline_file, const char* test_file,
|
||||
// Input both lists of symbols into container.
|
||||
symbols baseline = create_symbols(baseline_file);
|
||||
symbols test = create_symbols(test_file);
|
||||
symbol_names& baseline_names = baseline.first;
|
||||
symbol_objects& baseline_objects = baseline.second;
|
||||
symbol_names& test_names = test.first;
|
||||
symbol_objects& test_objects = test.second;
|
||||
|
||||
// Sanity check results.
|
||||
const symbol_names::size_type baseline_size = baseline_names.size();
|
||||
const symbol_names::size_type test_size = test_names.size();
|
||||
if (!baseline_size || !test_size)
|
||||
if (!baseline.size() || !test.size())
|
||||
{
|
||||
cerr << "Problems parsing the list of exported symbols." << endl;
|
||||
exit(2);
|
||||
@ -356,81 +353,85 @@ compare_symbols(const char* baseline_file, const char* test_file,
|
||||
|
||||
// Check to see if any long double compatibility symbols are produced.
|
||||
bool ld_version_found(false);
|
||||
symbol_objects::iterator li(test_objects.begin());
|
||||
while (!ld_version_found && li != test_objects.end())
|
||||
symbols::iterator li(test.begin());
|
||||
while (!ld_version_found && li != test.end())
|
||||
{
|
||||
if (li->second.version_name.find("GLIBCXX_LDBL_") != std::string::npos)
|
||||
if (li->second.version_name.find("_LDBL_") != std::string::npos)
|
||||
ld_version_found = true;
|
||||
++li;
|
||||
}
|
||||
|
||||
// Sort out names.
|
||||
// Assuming baseline_names, test_names are both unique w/ no duplicates.
|
||||
// Assuming all baseline names and test names are both unique w/ no
|
||||
// duplicates.
|
||||
//
|
||||
// The names added to missing_names are baseline_names not found in
|
||||
// test_names
|
||||
// The names added to missing_names are baseline names not found in
|
||||
// test names
|
||||
// -> symbols that have been deleted.
|
||||
//
|
||||
// The names added to added_names are test_names not in
|
||||
// baseline_names
|
||||
// The names added to added_names are test names not in
|
||||
// baseline names
|
||||
// -> symbols that have been added.
|
||||
typedef std::vector<std::string> symbol_names;
|
||||
symbol_names shared_names;
|
||||
symbol_names missing_names;
|
||||
symbol_names added_names = test_names;
|
||||
for (size_t i = 0; i < baseline_size; ++i)
|
||||
symbol_names added_names;
|
||||
for (li = test.begin(); li != test.end(); ++li)
|
||||
added_names.push_back(li->first);
|
||||
|
||||
for (symbols::iterator i = baseline.begin(); i != baseline.end(); ++i)
|
||||
{
|
||||
string what(baseline_names[i]);
|
||||
string name(i->first);
|
||||
symbol_names::iterator end = added_names.end();
|
||||
symbol_names::iterator it = find(added_names.begin(), end, what);
|
||||
symbol_names::iterator it = find(added_names.begin(), end, name);
|
||||
if (it != end)
|
||||
{
|
||||
// Found.
|
||||
shared_names.push_back(what);
|
||||
shared_names.push_back(name);
|
||||
added_names.erase(it);
|
||||
}
|
||||
else
|
||||
missing_names.push_back(what);
|
||||
else
|
||||
{
|
||||
// Iff no test long double compatibility symbols at all and the symbol
|
||||
// missing is a baseline long double compatibility symbol, skip.
|
||||
string version_name(i->second.version_name);
|
||||
bool base_ld(version_name.find("_LDBL_") != std::string::npos);
|
||||
if (!base_ld || base_ld && ld_version_found)
|
||||
missing_names.push_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
// Check missing names for compatibility.
|
||||
// Fill out list of incompatible symbols.
|
||||
typedef pair<symbol, symbol> symbol_pair;
|
||||
vector<symbol_pair> incompatible;
|
||||
const symbol_names::size_type missing_size = missing_names.size();
|
||||
for (size_t j = 0; j < missing_size; ++j)
|
||||
|
||||
// Check missing names for compatibility.
|
||||
for (size_t j = 0; j < missing_names.size(); ++j)
|
||||
{
|
||||
symbol& base = baseline_objects[missing_names[j]];
|
||||
|
||||
// Iff no test long double symbols at all and the symbol missing
|
||||
// is a baseline long double symbol, skip.
|
||||
if (!ld_version_found
|
||||
&& base.version_name.find("GLIBCXX_LDBL_") != std::string::npos)
|
||||
continue;
|
||||
else
|
||||
{
|
||||
base.status = symbol::subtracted;
|
||||
incompatible.push_back(symbol_pair(base, base));
|
||||
}
|
||||
symbol& sbase = baseline[missing_names[j]];
|
||||
sbase.status = symbol::subtracted;
|
||||
incompatible.push_back(symbol_pair(sbase, sbase));
|
||||
}
|
||||
|
||||
// Check shared names for compatibility.
|
||||
const symbol_names::size_type shared_size = shared_names.size();
|
||||
for (size_t k = 0; k < shared_size; ++k)
|
||||
{
|
||||
symbol& base = baseline_objects[shared_names[k]];
|
||||
symbol& test = test_objects[shared_names[k]];
|
||||
test.status = symbol::existing;
|
||||
if (!check_compatible(base, test))
|
||||
incompatible.push_back(symbol_pair(base, test));
|
||||
symbol& sbase = baseline[shared_names[k]];
|
||||
symbol& stest = test[shared_names[k]];
|
||||
stest.status = symbol::existing;
|
||||
if (!check_compatible(sbase, stest))
|
||||
incompatible.push_back(symbol_pair(sbase, stest));
|
||||
}
|
||||
|
||||
// Check added names for compatibility.
|
||||
const symbol_names::size_type added_size = added_names.size();
|
||||
for (size_t l = 0; l < added_size; ++l)
|
||||
{
|
||||
symbol& test = test_objects[added_names[l]];
|
||||
test.status = symbol::added;
|
||||
if (!check_version(test, true))
|
||||
incompatible.push_back(symbol_pair(test, test));
|
||||
symbol& stest = test[added_names[l]];
|
||||
stest.status = symbol::added;
|
||||
if (!check_version(stest, true))
|
||||
incompatible.push_back(symbol_pair(stest, stest));
|
||||
}
|
||||
|
||||
// Report results.
|
||||
@ -440,7 +441,7 @@ compare_symbols(const char* baseline_file, const char* test_file,
|
||||
for (size_t j = 0; j < added_names.size() ; ++j)
|
||||
{
|
||||
cout << j << endl;
|
||||
test_objects[added_names[j]].print();
|
||||
test[added_names[j]].print();
|
||||
}
|
||||
}
|
||||
|
||||
@ -450,7 +451,7 @@ compare_symbols(const char* baseline_file, const char* test_file,
|
||||
for (size_t j = 0; j < missing_names.size() ; ++j)
|
||||
{
|
||||
cout << j << endl;
|
||||
baseline_objects[missing_names[j]].print();
|
||||
baseline[missing_names[j]].print();
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,12 +464,12 @@ compare_symbols(const char* baseline_file, const char* test_file,
|
||||
cout << j << endl;
|
||||
|
||||
// Second, report name.
|
||||
symbol& base = incompatible[j].first;
|
||||
symbol& test = incompatible[j].second;
|
||||
test.print();
|
||||
symbol& sbase = incompatible[j].first;
|
||||
symbol& stest = incompatible[j].second;
|
||||
stest.print();
|
||||
|
||||
// Second, report reason or reasons incompatible.
|
||||
check_compatible(base, test, true);
|
||||
check_compatible(sbase, stest, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -491,18 +492,16 @@ create_symbols(const char* file)
|
||||
ifstream ifs(file);
|
||||
if (ifs.is_open())
|
||||
{
|
||||
// Organize file data into container of symbol objects, and a
|
||||
// container of mangled names without versioning information.
|
||||
symbol_names& names = s.first;
|
||||
symbol_objects& objects = s.second;
|
||||
// Organize file data into an associated container (symbols) of symbol
|
||||
// objects mapped to mangled names without versioning
|
||||
// information.
|
||||
const string empty;
|
||||
string line = empty;
|
||||
while (getline(ifs, line).good())
|
||||
{
|
||||
symbol tmp;
|
||||
tmp.init(line);
|
||||
objects[tmp.name] = tmp;
|
||||
names.push_back(tmp.name);
|
||||
s[tmp.name] = tmp;
|
||||
line = empty;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
// Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
||||
// Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <stdexcept>
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
#include <locale>
|
||||
#include <tr1/unordered_map>
|
||||
#include <cxxabi.h>
|
||||
@ -75,11 +75,8 @@ struct symbol
|
||||
init(std::string& data);
|
||||
};
|
||||
|
||||
typedef std::tr1::unordered_map<std::string, symbol> symbol_objects;
|
||||
|
||||
typedef std::deque<std::string> symbol_names;
|
||||
|
||||
typedef std::pair<symbol_names, symbol_objects> symbols;
|
||||
// Map type between symbol names and full symbol info.
|
||||
typedef std::tr1::unordered_map<std::string, symbol> symbols;
|
||||
|
||||
|
||||
// Check.
|
||||
@ -94,7 +91,7 @@ check_compatible(symbol& lhs, symbol& rhs, bool verbose = false);
|
||||
bool
|
||||
has_symbol(const std::string& mangled, const symbols& list) throw();
|
||||
|
||||
symbol&
|
||||
const symbol&
|
||||
get_symbol(const std::string& mangled, const symbols& list);
|
||||
|
||||
extern "C" void
|
||||
|
Loading…
x
Reference in New Issue
Block a user