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;
}
-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());
}
}
try
{
symbols s = create_symbols(file);
- symbol& sym = get_symbol(name, s);
+ const symbol& sym = get_symbol(name, s);
sym.print();
}
catch(...)
// 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);
// 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.
for (size_t j = 0; j < added_names.size() ; ++j)
{
cout << j << endl;
- test_objects[added_names[j]].print();
+ test[added_names[j]].print();
}
}
for (size_t j = 0; j < missing_names.size() ; ++j)
{
cout << j << endl;
- baseline_objects[missing_names[j]].print();
+ baseline[missing_names[j]].print();
}
}
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);
}
}
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;
}
}