class.c (check_bases): Propagate non-literality.
[official-gcc.git] / libstdc++-v3 / testsuite / util / testsuite_abi_check.cc
blobd4fea3ae6c318cf466c830e5e5025cbbb5464cff
1 // -*- C++ -*-
3 // Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 3, or (at
8 // your option) any later version.
10 // This library is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this library; see the file COPYING3. If not see
17 // <http://www.gnu.org/licenses/>.
20 // Benjamin Kosnik <bkoz@redhat.com>
21 // Blame subsequent hacks on Loren J. Rittle <ljrittle@acm.org>, Phil
22 // Edwards <pme@gcc.gnu.org>, and a cast of dozens at libstdc++@gcc.gnu.org.
24 #include "testsuite_abi.h"
25 #include <iostream>
26 #include <cstdlib>
27 #include <unistd.h> // for access(2)
29 int
30 main(int argc, char** argv)
32 using namespace std;
34 // Get arguments. (Heading towards getopt_long, I can feel it.)
35 string argv1 = argc > 1 ? argv[1] : "";
36 if (argv1 == "--help" || argc < 4)
38 cerr << "usage: abi_check --check current baseline\n"
39 " --check-verbose current baseline\n"
40 " --examine symbol current\n"
41 " --help\n"
42 "\n"
43 "All arguments are string literals.\n"
44 "CURRENT is a file generated byextract_symvers.\n"
45 "BASELINE is a file from config/abi.\n"
46 "SYMBOL is a mangled name.\n"
47 << endl;
48 exit(1);
51 if (argv1.find("--check") != string::npos)
53 bool verbose = false;
54 if (argv1 == "--check-verbose")
55 verbose = true;
57 // Quick sanity/setup check for arguments.
58 const char* test_file = argv[2];
59 const char* baseline_file = argv[3];
60 if (access(test_file, R_OK) != 0)
62 cerr << "Cannot read symbols file " << test_file
63 << ", did you forget to build first?" << endl;
64 exit(1);
66 if (access(baseline_file, R_OK) != 0)
68 cerr << "Cannot read baseline file " << baseline_file << endl;
69 exit(1);
71 if (!compare_symbols(baseline_file, test_file, verbose))
72 exit (1);
75 if (argv1 == "--examine")
77 const char* file = argv[3];
78 if (access(file, R_OK) != 0)
80 cerr << "Cannot read symbol file " << file << endl;
81 exit(1);
83 examine_symbol(argv[2], file);
85 return 0;