This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] check_abi additions


This removes the following defects in the current 'make check-abi' runs:

1) new symbols added in the old version name
2) explictly marks missing symbols as incompatible.

-benjamin

tested x86/linux

Something like this will go into gcc-3_3-branch

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.

Index: testsuite/abi_check.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/abi_check.cc,v
retrieving revision 1.14
diff -c -p -r1.14 abi_check.cc
*** testsuite/abi_check.cc	4 Mar 2003 05:23:56 -0000	1.14
--- testsuite/abi_check.cc	1 May 2003 22:08:06 -0000
***************
*** 44,50 ****
  struct symbol_info
  {
    enum category { none, function, object, error };
!   category 	type;
    std::string 	name;
    std::string 	demangled_name;
    int 		size;
--- 44,50 ----
  struct symbol_info
  {
    enum category { none, function, object, error };
!   category 	type;  
    std::string 	name;
    std::string 	demangled_name;
    int 		size;
*************** typedef __gnu_cxx::hash_map<std::string,
*** 77,110 ****
  
  
  bool
! check_version(const symbol_info& test)
  {
-   bool ret = true;
- 
    typedef std::vector<std::string> compat_list;
!   static compat_list known;
!   if (known.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");
      }
! 
!   compat_list::iterator end = known.end();
  
    // Check version names for compatibility...
!   compat_list::iterator it1 = find(known.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;
  
!   return ret;
  }
  
  bool 
--- 77,115 ----
  
  
  bool
! check_version(const symbol_info& test, bool added = false)
  {
    typedef std::vector<std::string> compat_list;
!   static compat_list known_versions;
!   if (known_versions.empty())
      {
!       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.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 begin = known_versions.begin();
!   compat_list::iterator end = known_versions.end();
  
    // Check version names for compatibility...
!   compat_list::iterator it1 = find(begin, end, test.version_name);
    
    // Check for weak label.
!   compat_list::iterator it2 = find(begin, end, test.name);
  
!   // 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 
*************** main(int argc, char** argv)
*** 377,388 ****
  	  added_names.erase(it);
  	}
        else
! 	missing_names.push_back(what);
      }
  
!   // Check shared names for compatibility.
    typedef pair<symbol_info, symbol_info> symbol_pair;
    vector<symbol_pair> incompatible;
    for (size_t i = 0; i < shared_names.size(); ++i)
      {
        symbol_info base = baseline_symbols[shared_names[i]];
--- 382,400 ----
  	  added_names.erase(it);
  	}
        else
! 	  missing_names.push_back(what);
      }
  
!   // 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]];
*************** main(int argc, char** argv)
*** 395,405 ****
    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;
! 	}
      }
  
    // Report results.
--- 407,414 ----
    for (size_t i = 0; i < added_names.size(); ++i)
      {
        symbol_info test = test_symbols[added_names[i]];
!       if (!check_version(test, true))
! 	incompatible.push_back(symbol_pair(test, test));
      }
  
    // Report results.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]