abi_check.cc (check_version): Update known versions.
authorBenjamin Kosnik <bkoz@redhat.com>
Thu, 1 May 2003 22:17:23 +0000 (22:17 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Thu, 1 May 2003 22:17:23 +0000 (22:17 +0000)
2003-05-01  Benjamin Kosnik  <bkoz@redhat.com>

* testsuite/abi_check.cc (check_version): Update known versions.
Check added symbols for version_name != base version. Add missing
symbols to incompatible list.

From-SVN: r66352

libstdc++-v3/ChangeLog
libstdc++-v3/testsuite/abi_check.cc

index cd0c01a0a020f4c83931a5cdd2ee1a4f26d148c4..331d5e59e012c8f6b6905e360c72e92e678c0c2d 100644 (file)
@@ -1,3 +1,9 @@
+2003-05-01  Benjamin Kosnik  <bkoz@redhat.com>
+
+       * testsuite/abi_check.cc (check_version): Update known versions.
+       Check added symbols for version_name != base version. Add missing
+       symbols to incompatible list.
+       
 2003-05-01  Benjamin Kosnik  <bkoz@redhat.com>
 
        * acinclude.m4 (GLIBCPP_EXPORT_FLAGS): Remove -Winline.
index 5d712119135b7b3221d35ee6d7d23dd6c2287c7f..51c384f9d55cfaaac02e251793d0ba690f30259c 100644 (file)
@@ -44,7 +44,7 @@
 struct symbol_info
 {
   enum category { none, function, object, error };
-  category     type;
+  category     type;  
   std::string  name;
   std::string  demangled_name;
   int          size;
@@ -77,34 +77,39 @@ typedef __gnu_cxx::hash_map<std::string, symbol_info>       symbol_infos;
 
 
 bool
-check_version(const symbol_info& test)
+check_version(const symbol_info& test, bool added = false)
 {
-  bool ret = true;
-
   typedef std::vector<std::string> compat_list;
-  static compat_list known;
-  if (known.empty())
+  static compat_list known_versions;
+  if (known_versions.empty())
     {
-      known.push_back("GLIBCPP_3.2");
-      known.push_back("GLIBCPP_3.2.1");
-      known.push_back("GLIBCPP_3.2.2");
-      known.push_back("GLIBCPP_3.4");
-      known.push_back("CXXABI_1.2");
-      known.push_back("CXXABI_1.2.1");
-      known.push_back("CXXABI_1.3");
+      known_versions.push_back("GLIBCPP_3.2"); // base version
+      known_versions.push_back("GLIBCPP_3.2.1");
+      known_versions.push_back("GLIBCPP_3.2.2");
+      known_versions.push_back("GLIBCPP_3.2.3"); // gcc-3.3.0
+      known_versions.push_back("GLIBCPP_3.4");
+      known_versions.push_back("CXXABI_1.2");
+      known_versions.push_back("CXXABI_1.2.1");
+      known_versions.push_back("CXXABI_1.3");
     }
-
-  compat_list::iterator end = known.end();
+  compat_list::iterator begin = known_versions.begin();
+  compat_list::iterator end = known_versions.end();
 
   // Check version names for compatibility...
-  compat_list::iterator it1 = find(known.begin(), end, test.version_name);
+  compat_list::iterator it1 = find(begin, end, test.version_name);
   
   // Check for weak label.
-  compat_list::iterator it2 = find(known.begin(), end, test.name);
-  if (it1 != end || it2 != end)
-    ret = true;
+  compat_list::iterator it2 = find(begin, end, test.name);
 
-  return ret;
+  // Check that added symbols aren't added in the base version.
+  bool compat = true;
+  if (added && test.version_name == known_versions[0])
+    compat = false;
+
+  if (it1 == end && it2 == end)
+    compat = false;
+
+  return compat;
 }
 
 bool 
@@ -377,12 +382,19 @@ main(int argc, char** argv)
          added_names.erase(it);
        }
       else
-       missing_names.push_back(what);
+         missing_names.push_back(what);
     }
 
-  // Check shared names for compatibility.
+  // Check missing names for compatibility.
   typedef pair<symbol_info, symbol_info> symbol_pair;
   vector<symbol_pair> incompatible;
+  for (size_t i = 0; i < missing_names.size(); ++i)
+    {
+      symbol_info base = baseline_symbols[missing_names[i]];
+      incompatible.push_back(symbol_pair(base, base));
+    }
+
+  // Check shared names for compatibility.
   for (size_t i = 0; i < shared_names.size(); ++i)
     {
       symbol_info base = baseline_symbols[shared_names[i]];
@@ -395,11 +407,8 @@ main(int argc, char** argv)
   for (size_t i = 0; i < added_names.size(); ++i)
     {
       symbol_info test = test_symbols[added_names[i]];
-      if (!check_version(test))
-       {
-         incompatible.push_back(symbol_pair(test, test));
-         cout << test.version_name << endl;
-       }
+      if (!check_version(test, true))
+       incompatible.push_back(symbol_pair(test, test));
     }
 
   // Report results.