]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
abi_check.cc: Pull shell fragments out into...
authorPhil Edwards <pme@gcc.gnu.org>
Sat, 21 Sep 2002 19:17:56 +0000 (19:17 +0000)
committerPhil Edwards <pme@gcc.gnu.org>
Sat, 21 Sep 2002 19:17:56 +0000 (19:17 +0000)
2002-09-21  Phil Edwards  <pme@gcc.gnu.org>

* testsuite/abi_check.cc:  Pull shell fragments out into...
* config/abi/extract_symvers:  ...here.  New file.
* Makefile.am (check_abi):  Change to match.
(new-abi-baseline):  New target.
* Makefile.in:  Regenerated.

From-SVN: r57396

libstdc++-v3/ChangeLog
libstdc++-v3/Makefile.am
libstdc++-v3/Makefile.in
libstdc++-v3/testsuite/abi_check.cc

index a6c91b43584214887741569b777c9ba9a4a7574e..19f01f2ebf97ea7eb25d8db6ba3effcf10f35937 100644 (file)
@@ -1,3 +1,11 @@
+2002-09-21  Phil Edwards  <pme@gcc.gnu.org>
+
+       * testsuite/abi_check.cc:  Pull shell fragments out into...
+       * config/abi/extract_symvers:  ...here.  New file.
+       * Makefile.am (check_abi):  Change to match.
+       (new-abi-baseline):  New target.
+       * Makefile.in:  Regenerated.
+
 2002-09-16  Loren J. Rittle  <ljrittle@acm.org>
 
        libstdc++/7922
index 98fe0989d30fb721590378b1c8b1443fe6d8eb07..09e48f5b60195ae33a8e02c18464ee5a531767f7 100644 (file)
@@ -44,10 +44,25 @@ check-script-install: $(top_builddir)/mkcheck
          cd testsuite; \
          @glibcpp_builddir@/mkcheck 1)
 
+# Use 'new-abi-baseline' to create an initial symbol file.  Then run
+# 'check-abi' to test for changes against that file.
 baseline_file = @baseline_file@
 check-abi: $(top_builddir)/testsuite/abi_check
        -(cd testsuite; \
-         ./abi_check ${baseline_file})
+         ${top_srcdir}/config/abi/extract_symvers \
+            ../src/.libs/libstdc++.so \
+            ./current_symbols.txt; \
+         ./abi_check --check ./current_symbols.txt ${baseline_file})
+
+new-abi-baseline:
+       -@(output=${baseline_file}; \
+         if test -f $${output}; then \
+           output=$${output}.new; \
+           t=`echo $${output} | sed 's=.*config/abi/=='`; \
+           echo "Baseline file already exists, writing to $${t} instead."; \
+         fi; \
+         ${top_srcdir}/config/abi/extract_symvers \
+            src/.libs/libstdc++.so $${output})
 
 # These rules are messy, but are hella worth it.
 doxygen:
index 88aadbc0f3d0c91d61eb6f338ff6a69187439cdb..0db404989e777ee3b10b21f897cb09f842a52585 100644 (file)
@@ -1,4 +1,4 @@
-# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p6 from Makefile.am
 
 # Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
@@ -139,6 +139,8 @@ SUBDIRS = include libio libmath libsupc++ src po testsuite
 
 mkinstalldirs = $(SHELL) $(toplevel_srcdir)/mkinstalldirs
 
+# Use 'new-abi-baseline' to create an initial symbol file.  Then run
+# 'check-abi' to test for changes against that file.
 baseline_file = @baseline_file@
 
 # Multilib support.
@@ -155,44 +157,7 @@ MULTICLEAN = true
 # Work around what appears to be a GNU make bug handling MAKEFLAGS
 # values defined in terms of make variables, as is the case for CC and
 # friends when we are called from the top level Makefile.
-AM_MAKEFLAGS = \
-       "AR_FLAGS=$(AR_FLAGS)" \
-       "CC_FOR_BUILD=$(CC_FOR_BUILD)" \
-       "CC_FOR_TARGET=$(CC_FOR_TARGET)" \
-       "CFLAGS=$(CFLAGS)" \
-       "CXXFLAGS=$(CXXFLAGS)" \
-       "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
-       "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
-       "INSTALL=$(INSTALL)" \
-       "INSTALL_DATA=$(INSTALL_DATA)" \
-       "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
-       "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
-       "LDFLAGS=$(LDFLAGS)" \
-       "LIBCFLAGS=$(LIBCFLAGS)" \
-       "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
-       "MAKE=$(MAKE)" \
-       "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
-       "PICFLAG=$(PICFLAG)" \
-       "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
-       "SHELL=$(SHELL)" \
-       "RUNTESTFLAGS=$(RUNTESTFLAGS)" \
-       "exec_prefix=$(exec_prefix)" \
-       "infodir=$(infodir)" \
-       "libdir=$(libdir)" \
-       "includedir=$(includedir)" \
-       "prefix=$(prefix)" \
-       "tooldir=$(tooldir)" \
-       "AR=$(AR)" \
-       "AS=$(AS)" \
-       "LD=$(LD)" \
-       "LIBCFLAGS=$(LIBCFLAGS)" \
-       "PICFLAG=$(PICFLAG)" \
-       "RANLIB=$(RANLIB)" \
-       "NM=$(NM)" \
-       "NM_FOR_BUILD=$(NM_FOR_BUILD)" \
-       "NM_FOR_TARGET=$(NM_FOR_TARGET)" \
-       "DESTDIR=$(DESTDIR)" \
-       "WERROR=$(WERROR)" 
+AM_MAKEFLAGS =         "AR_FLAGS=$(AR_FLAGS)"  "CC_FOR_BUILD=$(CC_FOR_BUILD)"  "CC_FOR_TARGET=$(CC_FOR_TARGET)"        "CFLAGS=$(CFLAGS)"      "CXXFLAGS=$(CXXFLAGS)"  "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)"  "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)"        "INSTALL=$(INSTALL)"    "INSTALL_DATA=$(INSTALL_DATA)"  "INSTALL_PROGRAM=$(INSTALL_PROGRAM)"    "INSTALL_SCRIPT=$(INSTALL_SCRIPT)"      "LDFLAGS=$(LDFLAGS)"    "LIBCFLAGS=$(LIBCFLAGS)"        "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)"  "MAKE=$(MAKE)"  "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)"         "PICFLAG=$(PICFLAG)"    "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)"      "SHELL=$(SHELL)"        "RUNTESTFLAGS=$(RUNTESTFLAGS)"  "exec_prefix=$(exec_prefix)"    "infodir=$(infodir)"    "libdir=$(libdir)"      "includedir=$(includedir)"      "prefix=$(prefix)"      "tooldir=$(tooldir)"    "AR=$(AR)"      "AS=$(AS)"      "LD=$(LD)"      "LIBCFLAGS=$(LIBCFLAGS)"        "PICFLAG=$(PICFLAG)"    "RANLIB=$(RANLIB)"      "NM=$(NM)"      "NM_FOR_BUILD=$(NM_FOR_BUILD)"  "NM_FOR_TARGET=$(NM_FOR_TARGET)"        "DESTDIR=$(DESTDIR)"    "WERROR=$(WERROR)" 
 
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 CONFIG_HEADER = config.h
@@ -204,7 +169,7 @@ mkcheck.in testsuite_flags.in
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
 
-TAR = gtar
+TAR = tar
 GZIP_ENV = --best
 all: all-redirect
 .SUFFIXES:
@@ -481,7 +446,20 @@ check-script-install: $(top_builddir)/mkcheck
          @glibcpp_builddir@/mkcheck 1)
 check-abi: $(top_builddir)/testsuite/abi_check
        -(cd testsuite; \
-         ./abi_check ${baseline_file})
+         ${top_srcdir}/config/abi/extract_symvers \
+            ../src/.libs/libstdc++.so \
+            ./current_symbols.txt; \
+         ./abi_check --check ./current_symbols.txt ${baseline_file})
+
+new-abi-baseline:
+       -@(output=${baseline_file}; \
+         if test -f $${output}; then \
+           output=$${output}.new; \
+           t=`echo $${output} | sed 's=.*config/abi/=='`; \
+           echo "Baseline file already exists, writing to $${t} instead."; \
+         fi; \
+         ${top_srcdir}/config/abi/extract_symvers \
+            src/.libs/libstdc++.so $${output})
 
 # These rules are messy, but are hella worth it.
 doxygen:
index fd030063d0c001ee2e82979f5b406c1b4221bb78..1e407811437a3cf479f2f2e40d0ba046d4b53e53 100644 (file)
@@ -28,6 +28,8 @@
 // the GNU General Public License.
 
 // Benjamin Kosnik  <bkoz@redhat.com>
+// Blame subsequent hacks on Loren J. Rittle <ljrittle@acm.org>, Phil
+// Edwards <pme@gcc.gnu.org>, and a cast of dozens at libstdc++@gcc.gnu.org.
 
 #include <string>
 #include <ext/hash_map>
@@ -259,63 +261,41 @@ report_symbol_info(const symbol_info& symbol, std::size_t n)
   cout << endl;
 }
 
-int main(int argc, char** argv)
+
+int
+main(int argc, char** argv)
 {
   using namespace std;
 
-  // Get arguments.
-  if (argc != 2)
+  // Get arguments.  (Heading towards getopt_long, I can feel it.)
+  string argv1;
+  if (argc < 4 || (string("--help") == (argv1 = argv[1])))
     {
-      cerr << "Usage:  abi_check baseline_file" << endl;
+      cerr << "Usage:  abi_check --check    cur baseline\n"
+              "                  --help\n\n"
+              "Where CUR is a file containing the current results from\n"
+              "extract_symvers, and BASELINE is one from config/abi.\n"
+          << endl;
       exit(1);
     }
-  const char* baseline_file = argv[1];
-  const char* test_file = "current_symbols.txt";
-  const char* test_lib = "../src/.libs/libstdc++.so";
+
+  const char* test_file = argv[2];
+  const char* baseline_file = argv[3];
 
   // Quick sanity/setup check
-  if (access(baseline_file, R_OK) != 0)
-    {
-      cerr << "Cannot read baseline file " << baseline_file << endl;
-      exit(1);
-    }
-  if (access(test_lib, R_OK) != 0)
+  if (access(test_file, R_OK) != 0)
     {
-      cerr << "Cannot read library " << test_lib
+      cerr << "Cannot read symbols file " << test_file
            << ", did you forget to build first?" << endl;
       exit(1);
     }
-
-  // Get list of symbols.
-  // Assume external symbol list computed "as if" by
-  /*
-   readelf -s -W libstdc++.so | sed '/\.dynsym/,/^$/p;d' | egrep -v
-   ' (LOCAL|UND) ' | awk '{ if ($4 == "FUNC" || $4 == "NOTYPE") printf
-   "%s:%s\n", $4, $8; else if ($4 == "OBJECT") printf "%s:%s:%s\n", $4,
-   $3, $8;}' | sort >& current_symbols.txt
-   */
-
-  // GNU binutils, somewhere after version 2.11.2, requires -W/--wide
-  // to avoid default line truncation.  -W is not supported and
-  // truncation did not occur by default before that point.
-  bool readelf_need_wide =
-    (system("readelf --help | grep -- --wide >/dev/null") == 0);
-
-  ostringstream cmd;
-  cmd << "readelf -s " << (readelf_need_wide ? "-W " : "") << test_lib
-      << " | sed '/\\.dynsym/,/^$/p;d' | egrep -v ' (LOCAL|UND) ' | "
-         "awk '{ if ($4 == \"FUNC\" || $4 == \"NOTYPE\") "
-                   "printf \"%s:%s\\n\", $4, $8; "
-                 "else if ($4 == \"OBJECT\") "
-                   "printf \"%s:%s:%s\\n\", $4, $3, $8;}' | sort > "
-      << test_file << " 2>&1";
-  if (system(cmd.str().c_str()) != 0)
+  if (access(baseline_file, R_OK) != 0)
     {
-      cerr << "Unable to generate the list of exported symbols." << endl;
-      exit(2);
+      cerr << "Cannot read baseline file " << baseline_file << endl;
+      exit(1);
     }
 
-  // Input both list of symbols into container.
+  // Input both lists of symbols into container.
   symbol_infos  baseline_symbols;
   symbol_names  baseline_names;
   symbol_infos  test_symbols;
@@ -323,7 +303,7 @@ int main(int argc, char** argv)
   create_symbol_data(baseline_file, baseline_symbols, baseline_names);
   create_symbol_data(test_file, test_symbols, test_names);
 
-  // Basic sanity check. (Was: error checking, what's that?)
+  // More sanity checking.
   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)