From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- libstdc++-v3/scripts/check_compile | 56 +++ libstdc++-v3/scripts/check_performance | 95 +++++ libstdc++-v3/scripts/create_testsuite_files | 54 +++ libstdc++-v3/scripts/extract_symvers.in | 67 ++++ libstdc++-v3/scripts/extract_symvers.pl | 127 ++++++ libstdc++-v3/scripts/gen_bind_includers.pl | 30 ++ libstdc++-v3/scripts/gen_includers.pl | 126 ++++++ libstdc++-v3/scripts/gen_includers2.pl | 31 ++ libstdc++-v3/scripts/make_exports.pl | 144 +++++++ libstdc++-v3/scripts/make_graph.py | 576 ++++++++++++++++++++++++++++ libstdc++-v3/scripts/make_graphs.py | 160 ++++++++ libstdc++-v3/scripts/run_doxygen | 402 +++++++++++++++++++ libstdc++-v3/scripts/testsuite_flags.in | 81 ++++ 13 files changed, 1949 insertions(+) create mode 100755 libstdc++-v3/scripts/check_compile create mode 100755 libstdc++-v3/scripts/check_performance create mode 100755 libstdc++-v3/scripts/create_testsuite_files create mode 100755 libstdc++-v3/scripts/extract_symvers.in create mode 100644 libstdc++-v3/scripts/extract_symvers.pl create mode 100644 libstdc++-v3/scripts/gen_bind_includers.pl create mode 100644 libstdc++-v3/scripts/gen_includers.pl create mode 100644 libstdc++-v3/scripts/gen_includers2.pl create mode 100644 libstdc++-v3/scripts/make_exports.pl create mode 100755 libstdc++-v3/scripts/make_graph.py create mode 100755 libstdc++-v3/scripts/make_graphs.py create mode 100644 libstdc++-v3/scripts/run_doxygen create mode 100755 libstdc++-v3/scripts/testsuite_flags.in (limited to 'libstdc++-v3/scripts') diff --git a/libstdc++-v3/scripts/check_compile b/libstdc++-v3/scripts/check_compile new file mode 100755 index 000000000..76762e675 --- /dev/null +++ b/libstdc++-v3/scripts/check_compile @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Script to do performance testing. + +# Invocation +# check_performance SRC_DIR BUILD_DIR + +# 1: variables +# +SRC_DIR=$1 +BUILD_DIR=$2 + +# Now that we've successfully translated the numerical option into +# a symbolic one, we can safely ignore it. +shift + +# This has been true all along. Found out about it the hard way... +case $BASH_VERSION in + 1*) + echo 'You need bash 2.x to run check_performance. Exiting.'; + exit 1 ;; + *) ;; +esac + +flags_script=$BUILD_DIR/scripts/testsuite_flags +INCLUDES=`$flags_script --build-includes` +PCH_FLAGS=`$flags_script --cxxpchflags` +FLAGS=`$flags_script --cxxflags` +TEST_FLAGS="-S" +COMPILER=`$flags_script --build-cxx` +CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS -Wfatal-errors $TEST_FLAGS" + +echo "compile line is:" +echo $CXX +echo "" + +TESTS_FILE="testsuite_files" + +#mkdir binaries +UNIQUE_ID=0 + +for NAME in `cat $TESTS_FILE` +do + if $RUN; then + echo $NAME + OUTPUT_NAME=$UNIQUE_ID + $CXX $SRC_DIR/testsuite/$NAME -o $OUTPUT_NAME + if [ -f $OUTPUT_NAME ]; then +# mv $OUTPUT_NAME binaries + rm $OUTPUT_NAME + fi + let UNIQUE_ID+=1 + fi +done + +exit 0 diff --git a/libstdc++-v3/scripts/check_performance b/libstdc++-v3/scripts/check_performance new file mode 100755 index 000000000..d196355bd --- /dev/null +++ b/libstdc++-v3/scripts/check_performance @@ -0,0 +1,95 @@ +#!/usr/bin/env bash + +# Script to do performance testing. + +# Invocation +# check_performance SRC_DIR BUILD_DIR + +# 1: variables +# +SRC_DIR=$1 +BUILD_DIR=$2 + +# Now that we've successfully translated the numerical option into +# a symbolic one, we can safely ignore it. +shift + +# This has been true all along. Found out about it the hard way... +case $BASH_VERSION in + 1*) + echo 'You need bash 2.x to run check_performance. Exiting.'; + exit 1 ;; + *) ;; +esac + +flags_script=$BUILD_DIR/scripts/testsuite_flags +INCLUDES=`$flags_script --build-includes` +PCH_FLAGS=`$flags_script --cxxpchflags` +FLAGS=`$flags_script --cxxflags` +THREAD_FLAG='-pthread' +COMPILER=`$flags_script --build-cxx` +SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \ + -Wl,--rpath -Wl,$BUILD_DIR/src/.libs" +ST_FLAG="-static" +LINK=$SH_FLAG +CXX="$COMPILER $INCLUDES $FLAGS -std=gnu++0x $CXXFLAGS $LINK" +LIBS="./libtestc++.a" +TESTS_FILE="testsuite_files_performance" + +echo CXX is $CXX + +for NAME in `cat $TESTS_FILE` +do + RUN=true + TESTNAME=$SRC_DIR/testsuite/$NAME + FILE_NAME="`basename $NAME`" + FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`" + + # TEST_S == single thread + # TEST_B == do both single and multi-thread + # TEST_T == multi-thread + for CYCLE in `sed -n 's,.*\(TEST_[SB][0-9]*\)$,\1,p' $TESTNAME` + do + RUN=false + echo $NAME $CYCLE + EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`" + $CXX -DNOTHREAD -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME + if [ -f $EXE_NAME ]; then + ./$EXE_NAME + else + echo "compile error:" + echo "$CXX -DNOTHREAD -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME" + fi + done + + for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $TESTNAME` + do + RUN=false + echo $NAME $CYCLE thread + EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`" + $CXX $THREAD_FLAG -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME + if [ -f $EXE_NAME ]; then + ./$EXE_NAME + else + echo "compile error:" + echo "$CXX $THREAD_FLAG -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME" + fi + done + + if $RUN; then + echo $NAME + EXE_NAME="`echo $FILE_NAME.exe`" + $CXX $TESTNAME $LIBS -o $EXE_NAME + if [ -f $EXE_NAME ]; then + ./$EXE_NAME >& tmp.$FILE_NAME + else + echo "compile error:" + echo "$CXX $TESTNAME $LIBS -o $EXE_NAME" + fi + if [ -s tmp.$FILE_NAME ]; then + mv tmp.$FILE_NAME $FILE_NAME.xml + fi + fi +done + +exit 0 diff --git a/libstdc++-v3/scripts/create_testsuite_files b/libstdc++-v3/scripts/create_testsuite_files new file mode 100755 index 000000000..f4a0bcd80 --- /dev/null +++ b/libstdc++-v3/scripts/create_testsuite_files @@ -0,0 +1,54 @@ +#!/bin/sh + +# Constructs lists of source files (full pathnames) to test. Two +# files are constructed: testsuite_files, which is used to test with +# the default dg-runtest command, and testsuite_files_interactive, +# which is used to test cases that require input to be entered. In +# addition, both lists are pruned of wchar_t tests if the toolchain +# under test does not support wchar_t functionality. +# +# We mimic the mkcheck script in that the first time this is run, all +# existing files are listed in "testsuite_files" in the output +# directory. Subsequent runs pull the list from that file, allowing +# users to trim the list down to problematic tests, or just run +# paticular directories or sub-directories of tests. +# +# Selecting individual tests can also be done with RUNTESTFLAGS, but +# that doesn't really do all that we are trying to accomplish here. + +LC_ALL=C +export LC_ALL + +# Both of these are in the appropriate testsuite subdirectories. +srcdir="$1" +outdir="$2" + +tmp="${TMPDIR:-/tmp}/ctt$$" +tests_file_normal="$outdir/testsuite_files" +tests_file_inter="$outdir/testsuite_files_interactive" +tests_file_perf="$outdir/testsuite_files_performance" + +cd $srcdir +# This is the ugly version of "everything but the current directory". It's +# what has to happen when find(1) doesn't support -mindepth, or -xtype. +dlist=`echo [0-9][0-9]*` +dlist="$dlist abi backward ext performance tr1 decimal" +find $dlist "(" -type f -o -type l ")" -name "*.cc" -print > $tmp.01 +find $dlist "(" -type f -o -type l ")" -name "*.c" -print > $tmp.02 +cat $tmp.01 $tmp.02 | sort > $tmp.1 +if test ! -s "$tmp.1"; then + exit 1 +fi + +# Now filter out classes of tests. These classes are run using special rules. +grep _xin $tmp.1 > $tests_file_inter +grep -v _xin $tmp.1 > $tmp.4 + +grep performance $tmp.4 > $tests_file_perf +grep -v performance $tmp.4 > $tmp.5 + +# ...more filters go here. +cp $tmp.5 $tests_file_normal + +rm $tmp* +exit 0 diff --git a/libstdc++-v3/scripts/extract_symvers.in b/libstdc++-v3/scripts/extract_symvers.in new file mode 100755 index 000000000..a2ff3c40a --- /dev/null +++ b/libstdc++-v3/scripts/extract_symvers.in @@ -0,0 +1,67 @@ +#!/bin/sh + +# Copyright (C) 2002, 2003, 2009, 2010 Free Software Foundation, Inc. +# +# This file is part of the GNU ISO C++ Library. This library is free +# software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this library; see the file COPYING3. If not see +# . + + +if test ${#} -lt 2 || test $1 = '--help'; then + echo "Usage: extract_symvers shared_lib output_file" 1>&2 + exit 1 +fi + +lib=$1 +output=$2 + +# This avoids weird sorting problems later. +LC_ALL=C +export LC_ALL +LANG=C +export LANG + +tmp=extract.$$ + +case `uname -s` in +SunOS) + # Ensure that output on Solaris 2 matches readelf below without requiring + # GNU binutils to be installed. This requires a combination of pvs and + # elfdump, which is easier handled in a perl script. + perl @glibcxx_srcdir@/scripts/extract_symvers.pl ${lib} > $tmp 2>&1 + ;; +*) + # 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. + readelf="readelf --symbols" + if readelf --help | grep -- --wide > /dev/null; then + readelf="$readelf --wide" + fi + ${readelf} ${lib} |\ + sed -e 's/ \[: [A-Fa-f0-9]*\] //' -e '/\.dynsym/,/^$/p;d' |\ + egrep -v ' (LOCAL|UND) ' |\ + awk '{ if ($4 == "FUNC" || $4 == "NOTYPE") + printf "%s:%s\n", $4, $8; + else if ($4 == "OBJECT" || $4 == "TLS") + printf "%s:%s:%s\n", $4, $3, $8; + }' | sort | uniq > $tmp 2>&1 +# else printf "Huh? What is %s?\n", $8; + ;; +esac + +# I think we'll be doing some more with this file, but for now, dump. +mv $tmp $output + +exit 0 diff --git a/libstdc++-v3/scripts/extract_symvers.pl b/libstdc++-v3/scripts/extract_symvers.pl new file mode 100644 index 000000000..2bac1cd56 --- /dev/null +++ b/libstdc++-v3/scripts/extract_symvers.pl @@ -0,0 +1,127 @@ +#!/usr/bin/perl -w + +# Copyright (C) 2010 Free Software Foundation, Inc. +# +# This file is part of the GNU ISO C++ Library. This library is free +# software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this library; see the file COPYING3. If not see +# . + +# Extract symbol version information on Solaris 2. +# +# Sun ld doesn't record symbol versions in .dynsym entries and they cannot +# easily be extracted from readelf --versions output, so use pvs instead. +# This way, we don't require GNU binutils in the native case. Also ensures +# that baseline_symbols.txt is identical between native (pvs, elfdump) and +# cross (readelf) cases. + +my $lib = shift; + +open PVS, "pvs -dsvo $lib |" or die $!; +while () { + chomp; + + # Remove trailing semicolon. + s/;$//; + + # shared object, dash, version, symbol, [size] + (undef, undef, $version, $symbol, $size) = split; + + # Remove colon separator from version field. + $version =~ s/:$//; + + # Record base version. The [BASE] field was only added in Solaris 11, + # so simply use the first record instead. + if ($. == 1) { + $basever = $version; + next; + } + + # Skip version declarations. + next unless defined ($symbol); + + # Ignore version dependencies. + next if ($symbol =~ /\{.*\}/); + + # Emit objects. + if (defined ($size)) { + # Strip parens from object size. + $size =~ s/\((\d+)\)/$1/; + + $type{$symbol} = "OBJECT"; + $version{$symbol} = $version; + $size{$symbol} = $size; + next; + } + + if ($version eq $symbol or $version eq $basever) { + # Emit versions or symbols bound to base versions as objects. + $type{$symbol} = "OBJECT"; + $version{$symbol} = $symbol; + $size{$symbol} = 0; + } else { + # Everything else without a size field is a function. + $type{$symbol} = "FUNC"; + $version{$symbol} = $version; + } +} +close PVS or die "pvs error"; + +# Only look at .dynsym table, like readelf in extract_symvers. +open ELFDUMP, "/usr/ccs/bin/elfdump -s -N .dynsym $lib |" or die $!; +while () { + chomp; + + # Ignore empty lines. + next if (/^$/); + + # Ignore object name header. + next if (/:$/); + + # Ignore table header lines. + next if (/^Symbol Table Section:/); + next if (/index.*value.*size/); + + # Split table. + (undef, undef, undef, $type, $bind, $oth, undef, $shndx, $name) = split; + + # Error out for unknown input. + die "unknown input line:\n$_" unless defined($bind); + + # Ignore local symbols. + next if ($bind eq "LOCL"); + # Ignore hidden symbols. + next if ($oth eq "H"); + # Ignore undefined symbols. + next if ($shndx eq "UNDEF"); + # Error out for unhandled cases. _GLOBAL_OFFSET_TABLE_ is P (protected). + die "unhandled symbol:\n$_" if ($bind !~ /^(GLOB|WEAK)/ or $oth !~ /[DP]/); + + # Adapt to readelf type naming convention. + $type = "OBJECT" if ($type eq "OBJT"); + + # Use correct symbol type. + $type{$name} = $type if ($type{$name} ne $type); +} +close ELFDUMP or die "elfdump error"; + +foreach $symbol (keys %type) { + if ($type{$symbol} eq "FUNC") { + push @lines, "$type{$symbol}:$symbol\@\@$version{$symbol}\n"; + } elsif ($type{$symbol} eq "OBJECT" and $size{$symbol} == 0) { + push @lines, "$type{$symbol}:$size{$symbol}:$version{$symbol}\n"; + } else { + push @lines, "$type{$symbol}:$size{$symbol}:$symbol\@\@$version{$symbol}\n"; + } +} +print sort @lines; diff --git a/libstdc++-v3/scripts/gen_bind_includers.pl b/libstdc++-v3/scripts/gen_bind_includers.pl new file mode 100644 index 000000000..52b11d283 --- /dev/null +++ b/libstdc++-v3/scripts/gen_bind_includers.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl -w +use English; + +$max = shift @ARGV; + +$template_params = "typename _U1"; +$template_args = "_U1"; +$params = "_U1& __u1"; +$args = "__u1"; + +for ($num_args = 2; $num_args <= $max; ++$num_args) { + $template_params .= ", typename _U$num_args"; + $template_args .= ", _U$num_args"; + $params .= ", _U$num_args& __u$num_args"; + $args .= ", __u$num_args"; + print "#define _GLIBCXX_BIND_NUM_ARGS $num_args\n"; + print "#define _GLIBCXX_BIND_COMMA ,\n"; + print "#define _GLIBCXX_BIND_TEMPLATE_PARAMS $template_params\n"; + print "#define _GLIBCXX_BIND_TEMPLATE_ARGS $template_args\n"; + print "#define _GLIBCXX_BIND_PARAMS $params\n"; + print "#define _GLIBCXX_BIND_ARGS $args\n"; + print "#include _GLIBCXX_BIND_REPEAT_HEADER\n"; + print "#undef _GLIBCXX_BIND_ARGS\n"; + print "#undef _GLIBCXX_BIND_PARAMS\n"; + print "#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n"; + print "#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n"; + print "#undef _GLIBCXX_BIND_COMMA\n"; + print "#undef _GLIBCXX_BIND_NUM_ARGS\n"; + print "\n"; +} diff --git a/libstdc++-v3/scripts/gen_includers.pl b/libstdc++-v3/scripts/gen_includers.pl new file mode 100644 index 000000000..477f02840 --- /dev/null +++ b/libstdc++-v3/scripts/gen_includers.pl @@ -0,0 +1,126 @@ +#!/usr/bin/perl -w +use English; + +$max = shift @ARGV; + +$template_params = "typename _T1"; +$template_params_unnamed = "typename"; +$template_args = "_T1"; +$params = "_T1 __a1"; +$ref_params = "_T1& __a1"; +$args = "__a1"; +$bind_members = "_T1 _M_arg1;"; +$bind_members_init = "_M_arg1(__a1)"; +$mu_get_tuple_args = "::std::tr1::get<0>(__tuple)"; +$bind_v_template_args = "typename result_of<_Mu<_T1> _CV(_T1, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type"; +$bind_v_args = "_Mu<_T1>()(_M_arg1, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))"; +$tuple_add_cref = "typename __add_c_ref<_T1>::type __a1"; +$tuple_copy_init = "_M_arg1(__in._M_arg1)"; +$tuple_assign = "_M_arg1 = __in._M_arg1;"; +$template_params_null_class = "typename _T1 = _NullClass"; +$template_args_stripped = "typename __strip_reference_wrapper<_T1>::__type"; +$template_params_u = "typename _U1"; +$template_args_u = "_U1"; +$ref_wrap_params = "ref(__a1)"; +$ref_template_args = "_T1&"; +for ($num_args = 2; $num_args <= $max; ++$num_args) { + $prev_args = $num_args - 1; + $next_args = $num_args + 1; + $template_params_shifted = $template_params; + $template_args_shifted = $template_args; + $params_shifted = $params; + $args_shifted = $args; + $template_params .= ", typename _T$num_args"; + $template_params_unnamed .= ", typename"; + $template_args .= ", _T$num_args"; + $params .= ", _T$num_args __a$num_args"; + $ref_params .=", _T$num_args& __a$num_args"; + $args .= ", __a$num_args"; + $bind_members .= " _T$num_args _M_arg$num_args;"; + $bind_members_init .= ", _M_arg$num_args(__a$num_args)"; + $mu_get_tuple_args .= ", ::std::tr1::get<$prev_args>(__tuple)"; + $bind_v_template_args .= ", typename result_of<_Mu<_T$num_args> _CV(_T$num_args, tuple<_GLIBCXX_BIND_TEMPLATE_ARGS>)>::type"; + $bind_v_args .= ", _Mu<_T$num_args>()(_M_arg$num_args, ::std::tr1::tie(_GLIBCXX_BIND_ARGS))"; + $tuple_add_cref .= ", typename __add_c_ref<_T$num_args>::type __a$num_args"; + $tuple_copy_init .= ", _M_arg$num_args(__in._M_arg$num_args)"; + $tuple_assign .= " _M_arg$num_args = __in._M_arg$num_args;"; + $template_params_null_class .= ", typename _T$num_args = _NullClass"; + $template_args_stripped .= ", typename __strip_reference_wrapper<_T$num_args>::__type"; + $template_params_u .= ", typename _U$num_args"; + $template_args_u .= ", _U$num_args"; + $ref_wrap_params .= ", ref(__a$num_args)"; + $ref_template_args .= ", _T$num_args&"; + + if ($num_args == $max) { + print "#define _GLIBCXX_LAST_INCLUDE\n" + } + print "#define _GLIBCXX_NUM_ARGS $num_args\n"; + print "#define _GLIBCXX_COMMA ,\n"; + print "#define _GLIBCXX_TEMPLATE_PARAMS $template_params\n"; + print "#define _GLIBCXX_TEMPLATE_ARGS $template_args\n"; + print "#define _GLIBCXX_PARAMS $params\n"; + print "#define _GLIBCXX_REF_PARAMS $ref_params\n"; + print "#define _GLIBCXX_ARGS $args\n"; + print "#define _GLIBCXX_COMMA_SHIFTED ,\n"; + print "#define _GLIBCXX_TEMPLATE_PARAMS_SHIFTED $template_params_shifted\n"; + print "#define _GLIBCXX_TEMPLATE_ARGS_SHIFTED $template_args_shifted\n"; + print "#define _GLIBCXX_PARAMS_SHIFTED $params_shifted\n"; + print "#define _GLIBCXX_ARGS_SHIFTED $args_shifted\n"; + print "#define _GLIBCXX_BIND_MEMBERS $bind_members\n"; + print "#define _GLIBCXX_BIND_MEMBERS_INIT $bind_members_init\n"; + print "#define _GLIBCXX_MU_GET_TUPLE_ARGS $mu_get_tuple_args\n"; + print "#define _GLIBCXX_BIND_V_TEMPLATE_ARGS(_CV) $bind_v_template_args\n"; + print "#define _GLIBCXX_BIND_V_ARGS $bind_v_args\n"; + print "#define _GLIBCXX_TUPLE_ADD_CREF $tuple_add_cref\n"; + print "#define _GLIBCXX_TUPLE_COPY_INIT $tuple_copy_init\n"; + print "#define _GLIBCXX_TUPLE_ASSIGN $tuple_assign\n"; + print "#define _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS $template_params_null_class\n"; + print "#define _GLIBCXX_TEMPLATE_ARGS_STRIPPED $template_args_stripped\n"; + print "#define _GLIBCXX_TEMPLATE_PARAMS_U $template_params_u\n"; + print "#define _GLIBCXX_TEMPLATE_ARGS_U $template_args_u\n"; + print "#define _GLIBCXX_REF_WRAP_PARAMS $ref_wrap_params\n"; + print "#define _GLIBCXX_REF_TEMPLATE_ARGS $ref_template_args\n"; + print "#define _GLIBCXX_NUM_ARGS_PLUS_1 $next_args\n"; + print "#define _GLIBCXX_T_NUM_ARGS_PLUS_1 _T$next_args\n"; + print "#include _GLIBCXX_REPEAT_HEADER\n"; + print "#undef _GLIBCXX_T_NUM_ARGS_PLUS_1\n"; + print "#undef _GLIBCXX_NUM_ARGS_PLUS_1\n"; + print "#undef _GLIBCXX_REF_TEMPLATE_ARGS\n"; + print "#undef _GLIBCXX_REF_WRAP_PARAMS\n"; + print "#undef _GLIBCXX_TEMPLATE_ARGS_U\n"; + print "#undef _GLIBCXX_TEMPLATE_PARAMS_U\n"; + print "#undef _GLIBCXX_TEMPLATE_ARGS_STRIPPED\n"; + print "#undef _GLIBCXX_TEMPLATE_PARAMS_NULL_CLASS\n"; + print "#undef _GLIBCXX_TUPLE_ASSIGN\n"; + print "#undef _GLIBCXX_TUPLE_COPY_INIT\n"; + print "#undef _GLIBCXX_TUPLE_ADD_CREF\n"; + print "#undef _GLIBCXX_BIND_V_ARGS\n"; + print "#undef _GLIBCXX_BIND_V_TEMPLATE_ARGS\n"; + print "#undef _GLIBCXX_MU_GET_TUPLE_ARGS\n"; + print "#undef _GLIBCXX_BIND_MEMBERS_INIT\n"; + print "#undef _GLIBCXX_BIND_MEMBERS\n"; + print "#undef _GLIBCXX_ARGS_SHIFTED\n"; + print "#undef _GLIBCXX_PARAMS_SHIFTED\n"; + print "#undef _GLIBCXX_TEMPLATE_ARGS_SHIFTED\n"; + print "#undef _GLIBCXX_TEMPLATE_PARAMS_SHIFTED\n"; + print "#undef _GLIBCXX_COMMA_SHIFTED\n"; + print "#undef _GLIBCXX_ARGS\n"; + print "#undef _GLIBCXX_REF_PARAMS\n"; + print "#undef _GLIBCXX_PARAMS\n"; + print "#undef _GLIBCXX_TEMPLATE_ARGS\n"; + print "#undef _GLIBCXX_TEMPLATE_PARAMS\n"; + print "#undef _GLIBCXX_COMMA\n"; + print "#undef _GLIBCXX_NUM_ARGS\n"; + if ($num_args == $max) { + print "#undef _GLIBCXX_LAST_INCLUDE\n" + } +} + +print "\n"; +print "#ifndef _GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS\n"; +print "# define _GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS $template_params\n"; +print "# define _GLIBCXX_TUPLE_ALL_TEMPLATE_PARAMS_UNNAMED $template_params_unnamed\n"; +print "# define _GLIBCXX_TUPLE_ALL_TEMPLATE_ARGS $template_args\n"; +print "#endif\n"; +print "\n"; + diff --git a/libstdc++-v3/scripts/gen_includers2.pl b/libstdc++-v3/scripts/gen_includers2.pl new file mode 100644 index 000000000..88e9becd1 --- /dev/null +++ b/libstdc++-v3/scripts/gen_includers2.pl @@ -0,0 +1,31 @@ +#!/usr/bin/perl -w +use English; + +$max = shift @ARGV; + +$template_params = "typename _U1"; +$template_args = "_U1"; +$params = "_U1& __u1"; +$args = "__u1"; + +for ($num_args = 2; $num_args <= $max; ++$num_args) { + $template_params .= ", typename _U$num_args"; + $template_args .= ", _U$num_args"; + $params .= ", _U$num_args& __u$num_args"; + $args .= ", __u$num_args"; + print "#define _GLIBCXX_BIND_NUM_ARGS $num_args\n"; + print "#define _GLIBCXX_BIND_COMMA ,\n"; + print "#define _GLIBCXX_BIND_TEMPLATE_PARAMS $template_params\n"; + print "#define _GLIBCXX_BIND_TEMPLATE_ARGS $template_args\n"; + print "#define _GLIBCXX_BIND_PARAMS $params\n"; + print "#define _GLIBCXX_BIND_ARGS $args\n"; + print "#include _GLIBCXX_BIND_REPEAT_HEADER\n"; + print "#undef _GLIBCXX_BIND_ARGS\n"; + print "#undef _GLIBCXX_BIND_PARAMS\n"; + print "#undef _GLIBCXX_BIND_TEMPLATE_ARGS\n"; + print "#undef _GLIBCXX_BIND_TEMPLATE_PARAMS\n"; + print "#undef _GLIBCXX_BIND_COMMA\n"; + print "#undef _GLIBCXX_BIND_NUM_ARGS\n"; + print "\n"; +} + diff --git a/libstdc++-v3/scripts/make_exports.pl b/libstdc++-v3/scripts/make_exports.pl new file mode 100644 index 000000000..7c9e4e31d --- /dev/null +++ b/libstdc++-v3/scripts/make_exports.pl @@ -0,0 +1,144 @@ +#!/usr/bin/perl -w + +# This script takes two arguments, a version script and a dynamic library +# (in that order), and prints a list of symbols to be exported from the +# library. +# It expects a 'nm' with the POSIX '-P' option, but everyone has one of +# those, right? It also expects that symbol names have a leading underscore, +# which is somewhat less likely. + +use File::Glob ':glob'; +use FileHandle; +use IPC::Open2; + +# The glob patterns that are to be applied to the demangled name +my @cxx_globs = (); +# The glob patterns that apply directly to the name in the .o files +my @globs = (); +# The patterns for local variables (usually just '*'). +my @ignored = (); + +########## +# Fill in the various glob arrays. + +# The next pattern will go into this array. +my $glob = \@globs; +my $symvers = shift; + +open F,$symvers or die $!; + +while () { + chomp; + # Lines of the form '} SOME_VERSION_NAME_1.0;' + if (/^[ \t]*\}[ \tA-Z0-9_.a-z]*;[ \t]*$/) { + $glob = \@globs; + next; + } + # Comment and blank lines + next if (/^[ \t]*\#/); + next if (/^[ \t]*$/); + # Lines of the form 'SOME_VERSION_NAME_1.1 {' + next if (/^[A-Z0-9_. \t]*{$/); + # Ignore 'global:' + next if (/^[ \t]*global:$/); + # After 'local:', globs should be ignored, they won't be exported. + if (/^[ \t]*local:$/) { + $glob = \@ignored; + next; + } + # After 'extern "C++"', globs are C++ patterns + if (/^[ \t]*extern \"C\+\+\"[ \t]*$/) { + $glob = \@cxx_globs; + next; + } + # Catch globs. Note that '{}' is not allowed in globs by this script, + # so only '*' and '[]' are available. + if (/^[ \t]*([^ \t;{}#]+);?[ \t]*$/) { + my $ptn = $1; + # Turn the glob into a regex by replacing '*' with '.*'. + $ptn =~ s/\*/\.\*/g; + push @$glob,$ptn; + next; + } + # Important sanity check. This script can't handle lots of formats + # that GNU ld can, so be sure to error out if one is seen! + die "strange line `$_'"; +} +close F; + +# Make 'if (1)' for debugging. +if (0) { + print "cxx:\n"; + (printf "%s\n",$_) foreach (@cxx_globs); + print "globs:\n"; + (printf "%s\n", $_) foreach (@globs); + print "ignored:\n"; + (printf "%s\n", $_) foreach (@ignored); +} + +########## +# Combine the arrays into single regular expressions +# This cuts the time required from about 30 seconds to about 0.5 seconds. + +my $glob_regex = '^_(' . (join '|',@globs) . ')$'; +my $cxx_regex = (join '|',@cxx_globs); + +########## +# Get all the symbols from the library, match them, and add them to a hash. + +my %export_hash = (); +my $nm = $ENV{'NM_FOR_TARGET'} || "nm"; +# Process each symbol. +print STDERR $nm.' -P '.(join ' ',@ARGV).'|'; +open NM,$nm.' -P '.(join ' ',@ARGV).'|' or die $!; +# Talk to c++filt through a pair of file descriptors. +open2(*FILTIN, *FILTOUT, "c++filt -_") or die $!; +NAME: while () { + my $i; + chomp; + + # nm prints out stuff at the start, ignore it. + next if (/^$/); + next if (/:$/); + # Ignore undefined and local symbols. + next if (/^([^ ]+) [Ua-z] /); + + # $sym is the name of the symbol, $noeh_sym is the same thing with + # any '.eh' suffix removed. + die "unknown nm output $_" if (! /^([^ ]+) [A-Z] /); + my $sym = $1; + my $noeh_sym = $sym; + $noeh_sym =~ s/\.eh$//; + + # Maybe it matches one of the patterns based on the symbol in the .o file. + if ($noeh_sym =~ /$glob_regex/) { + $export_hash{$sym} = 1; + next NAME; + } + + # No? Well, maybe its demangled form matches one of those patterns. + printf FILTOUT "%s\n",$noeh_sym; + my $dem = ; + chomp $dem; + if ($dem =~ /$cxx_regex/) { + $export_hash{$sym} = 2; + next NAME; + } + + # No? Well, then ignore it. +} +close NM or die "nm error"; +close FILTOUT or die "c++filt error"; +close FILTIN or die "c++filt error"; + +########## +# Print out the export file + +# Print information about generating this file +print "# This is a generated file.\n"; +print "# It was generated by:\n"; +printf "# %s %s %s\n", $0, $symvers, (join ' ',@ARGV); + +foreach my $i (keys %export_hash) { + printf "%s\n",$i or die; +} diff --git a/libstdc++-v3/scripts/make_graph.py b/libstdc++-v3/scripts/make_graph.py new file mode 100755 index 000000000..61e18be47 --- /dev/null +++ b/libstdc++-v3/scripts/make_graph.py @@ -0,0 +1,576 @@ +#!/usr/bin/python + +import string +import sys +import re +import os +import platform +import commands +from Numeric import * +from pychart import * +from xml.dom import minidom + +class exception: + pass + + +def comp_platform_info(compiler): + ret = '
    \n' + so = commands.getstatusoutput('cat /proc/cpuinfo | grep \'cpu MHz\'') + if so[0] == 0: + ret += '
  • CPU speed - %s
  • \n' % so[1] + so = commands.getstatusoutput('cat /proc/meminfo | grep \'MemTotal\'') + if so[0] == 0: + ret += '
  • Memory - %s
  • \n' % so[1] + ret += '
  • Platform - %s
  • \n' % platform.platform() + so = commands.getstatusoutput(compiler + ' --version') + if so[0] == 0: + ret += '
  • Compiler - %s
  • \n' % so[1] + ret += '
\n' + return ret + + +class res: + """ + A 'structure' representing the results of a test. + """ + def __init__(self, x_label, y_label, cntnr_list, cntnr_descs, res_sets): + self.x_label = x_label + self.y_label = y_label + self.cntnr_list = cntnr_list + self.cntnr_descs = cntnr_descs + self.res_sets = res_sets + + +class res_getter: + """ + This class returns a res object for some test. + """ + class __sorter: + def __accum(self, results): + total = 0 + for result in results: + total = total + result[1] + return total + + def sort(self, cntnr_list, res_sets): + cntnrs_and_totals = [] + for cntnr in cntnr_list: + results = res_sets[cntnr] + total = self.__accum(results) + cntnrs_and_totals.append((cntnr, total)) + by_total = lambda x,y: x[1] > y[1] and -1 or 1 + cntnrs_and_totals.sort(by_total) + ret = [] + for cntnr_and_total in cntnrs_and_totals: + cntnr = cntnr_and_total[0] + ret.append(cntnr) + return ret + + def __init__(self, test_infos_f_name): + self.__test_to_container_res_sets = {} + self.__test_to_f_names = {} + tests_dat = minidom.parse(test_infos_f_name) + for test in tests_dat.getElementsByTagName('test'): + test_name = test.attributes['name'].value + self.__test_to_f_names[test_name] = test.getElementsByTagName('file')[0].attributes['name'].value + cntnr_list = [] + for cntnr in test.getElementsByTagName('cntnr'): + cntnr_list.append(cntnr.attributes['name'].value) + self.__test_to_container_res_sets[test_name] = cntnr_list + + def __get_label(self, tst_dat, label_name): + label = tst_dat.getElementsByTagName(label_name)[0].firstChild.data + label = string.strip(label, '\n') + label = string.strip(label) + return label + + def __parse_res_sets(self, f_name, cntnr_list): + tst_dat = minidom.parse(f_name) + x_label = self.__get_label(tst_dat, 'x_name') + y_label = self.__get_label(tst_dat, 'y_name') + parsed_container_list = tst_dat.getElementsByTagName('cntnr') + res_sets = {} + cntnr_descs = {} + for cntnr in parsed_container_list: + cntnr_name = cntnr.attributes["name"].value + res_sets[cntnr_name] = [] + for cntnr in parsed_container_list: + cntnr_name = cntnr.attributes["name"].value + cntnr_desc = cntnr.getElementsByTagName('desc') + if res_sets.has_key(cntnr_name): + res_set = [] + result_list = cntnr.getElementsByTagName('result') + for result in result_list: + x = string.atol(result.attributes["x"].value) + y = string.atof(result.attributes["y"].value) + res_set.append((x, y)) + res_sets[cntnr_name] = res_set + cntnr_descs[cntnr_name] = cntnr_desc[0] + return (x_label, y_label, cntnr_descs, res_sets) + + def get(self, res_dir, test_name): + cntnr_list = self.__test_to_container_res_sets[test_name] + f_name = res_dir + '/' + self.__test_to_f_names[test_name] + parsed = self.__parse_res_sets(f_name, cntnr_list) + x_label = parsed[0] + y_label = parsed[1] + cntnr_descs = parsed[2] + res_sets = parsed[3] + cntnr_list = self.__sorter().sort(cntnr_list, res_sets) + return res(x_label, y_label, cntnr_list, cntnr_descs, res_sets) + + +class png_maker: + """ + This class creates a png file from a result set. + """ + class __style_chooser: + def __init__(self): + self.native_re = re.compile(r'n_(?:.*?)') + + self.native_tick_mark_0 = tick_mark.Circle(size = 4) + self.native_tick_mark_1 = tick_mark.Square(size = 4) + self.native_line_style_0 = line_style.T(color = color.black, width=2) + self.native_line_style_1 = line_style.T(color = color.black, width=2) + + self.mask_re = re.compile(r'mask(?:.*?)') + self.mod_re = re.compile(r'mod(?:.*?)') + + self.rb_tree_mmap_rb_tree_set_re = re.compile(r'rb_tree_mmap_rb_tree_set(?:.*?)') + self.rb_tree_mmap_lu_mtf_set_re = re.compile(r'rb_tree_mmap_lu_mtf_set(?:.*?)') + + self.splay_re = re.compile(r'splay(?:.*?)') + self.rb_tree_re = re.compile(r'rb_tree(?:.*?)') + self.ov_tree_re = re.compile(r'ov_tree(?:.*?)') + self.splay_tree_re = re.compile(r'splay_tree(?:.*?)') + + self.pat_trie_re = re.compile(r'pat_trie(?:.*?)') + + self.lc_1div8_1div2_re = re.compile(r'lc_1div8_1div2(?:.*?)') + self.lc_1div8_1div1_re = re.compile(r'lc_1div8_1div1(?:.*?)') + self.mcolc_1div2_re = re.compile(r'mcolc_1div2(?:.*?)') + + def choose(self, cntnr): + if self.native_re.search(cntnr): + if cntnr == 'n_pq_vector': + return (self.native_tick_mark_1, self.native_line_style_1) + + return (self.native_tick_mark_0, self.native_line_style_0) + + # tick_mark predefined + # square, circle3, dia, tri, dtri, star, plus5, x5, gray70dia, blackdtri, blackdia + if self.mask_re.search(cntnr): + clr = color.navy + elif self.mod_re.search(cntnr): + clr = color.green4 + elif self.rb_tree_mmap_rb_tree_set_re.search(cntnr): + clr = color.mediumblue + tm = tick_mark.square + elif self.rb_tree_mmap_lu_mtf_set_re.search(cntnr) or cntnr == 'rc_binomial_heap': + clr = color.gray50 + tm = tick_mark.dia + elif self.splay_tree_re.search(cntnr) or cntnr == 'binomial_heap': + clr = color.gray58 + tm = tick_mark.tri + elif self.rb_tree_re.search(cntnr) or cntnr == 'binary_heap': + clr = color.red3 + tm = tick_mark.dtri + elif self.ov_tree_re.search(cntnr) or cntnr == 'thin_heap': + clr = color.orangered1 + tm = tick_mark.star + elif self.pat_trie_re.search(cntnr) or cntnr == 'pairing_heap': + clr = color.blueviolet + tm = tick_mark.plus5 + else: + sys.stderr.write(cntnr + '\n') + raise exception + + # mask / mod + if cntnr.find('lc_1div8_1div') <> -1: + if cntnr.find('mask') <> -1: + # mask + if self.lc_1div8_1div2_re.search(cntnr): + if cntnr.find('nsth') <> -1: + tm = tick_mark.x5 + else: + tm = tick_mark.gray70dia + if self.lc_1div8_1div1_re.search(cntnr): + if cntnr.find('nsth') <> -1: + tm = tick_mark.dia + else: + tm = tick_mark.circle3 + else: + # mod + if self.lc_1div8_1div2_re.search(cntnr): + if cntnr.find('nsth') <> -1: + tm = tick_mark.tri + else: + tm = tick_mark.square + if self.lc_1div8_1div1_re.search(cntnr): + if cntnr.find('nsth') <> -1: + tm = tick_mark.dtri + else: + tm = tick_mark.star + + if self.mcolc_1div2_re.search(cntnr): + tm = tick_mark.circle3 + + return (tm, line_style.T(color = clr, width = 2)) + + + def __init__(self): + self.__sc = self.__style_chooser() + self.__mmap_re = re.compile('mmap_') + + def __container_label_name(self, cntnr): + return self.__mmap_re.sub('\nmmap_\n', cntnr) + + def make(self, res, of_name): + theme.output_format = 'png' + theme.output_file = of_name + theme.scale_factor = 2 +# theme.default_font_size = 5 + theme.use_color = 1 + theme.reinitialize() + y_tick_interval = self.__get_y_tics(res) + xaxis = axis.X(format = '/a90/hL%d', + tic_interval = 200, + label = res.x_label) + yaxis = axis.Y(format = '%.2e', + tic_interval = y_tick_interval, + label = res.y_label) + legend_lines = len(res.cntnr_list) + legend_vloc = 50 + (legend_lines * 10) + ar = area.T(x_axis = xaxis, y_axis = yaxis, + legend = legend.T(loc=(0,-legend_vloc), + frame_line_style=None, + inter_row_sep=2), + size=(240,110)) + plot_list = [] + for cntnr in res.cntnr_list: + style = self.__sc.choose(cntnr) + print cntnr + pl = line_plot.T(label = self.__container_label_name(cntnr), + data = res.res_sets[cntnr], + tick_mark = style[0], + line_style = style[1]) + plot_list.append(pl) + for plot in plot_list: + ar.add_plot(plot) + ar.draw() + + + def __get_y_tics(self, res): + mx = 0 + for cntnr in res.cntnr_list: + m = max(d[1] for d in res.res_sets[cntnr]) + mx = max(m, mx) + return mx / 5 + + + +def make_tt(s): + return '' + s + '' + +def make_b(s): + return '' + s + '' + +def make_ttb(s): + return '' + s + '' + +def make_i(s): + return '' + s + '' + +def make_pb_ds_class_href(c_name): + return '' + make_tt(c_name) + '\n' + +def build_value_to_pb_ds_class_href(s_desc): + value = s_desc.attributes['value'].value + ret = make_pb_ds_class_href(value) + return ret + +class hash_desc_to_html_builder: + def build_specific_comb_hash_fn(self, s_desc): + comb_hash_fn_desc = s_desc.getElementsByTagName('Comb_Hash_Fn')[0] + ret = make_tt('Comb_Hash_Fn') + ret = ret + ' = ' + ret = ret + build_value_to_pb_ds_class_href(comb_hash_fn_desc) + return ret + + def __build_nom_denom(self, s_desc): + nom_denom = s_desc.attributes['nom'].value + '/' + s_desc.attributes['denom'].value + return make_i(nom_denom) + + def __build_lc_trigger_desc(self, s_desc): + ret = build_value_to_pb_ds_class_href(s_desc) + ret = ret + ' with ' + make_i('αmin') + ret = ret + ' = ' + self.__build_nom_denom(s_desc.getElementsByTagName('alpha_min')[0]) + ret = ret + ' and ' + make_i('αmax') + ret = ret + ' = ' + self.__build_nom_denom(s_desc.getElementsByTagName('alpha_max')[0]) + return ret + + def build_specific_resize_policy(self, s_desc): + ret = make_tt('Resize_Policy') + ret = ret + ' = ' + resize_policy_desc = s_desc.getElementsByTagName('Resize_Policy')[0] + ret = ret + build_value_to_pb_ds_class_href(resize_policy_desc) + ret = ret + ' with ' + make_tt('Size_Policy') + ret = ret + ' = ' + size_policy_desc = resize_policy_desc.getElementsByTagName('Size_Policy')[0] + ret = ret + build_value_to_pb_ds_class_href(size_policy_desc) + ret = ret + ', and ' + make_tt('Trigger_Policy') + ret = ret + ' = ' + trigger_policy_desc = resize_policy_desc.getElementsByTagName('Trigger_Policy')[0] + if trigger_policy_desc.attributes['value'].value == 'hash_load_check_resize_trigger': + ret = ret + self.__build_lc_trigger_desc(trigger_policy_desc) + else: + raise exception + return ret + + +class cc_hash_desc_to_html_builder: + def __init__(self): + self.__hash_builder = hash_desc_to_html_builder() + + def build(self, s_desc): + ret = build_value_to_pb_ds_class_href(s_desc) + ret = ret + 'with ' + self.__hash_builder.build_specific_comb_hash_fn(s_desc) + ret = ret + ', and ' + self.__hash_builder.build_specific_resize_policy(s_desc) + return ret + + +class gp_hash_desc_to_html_builder: + def __init__(self): + self.__hash_builder = hash_desc_to_html_builder() + + def build(self, s_desc): + ret = build_value_to_pb_ds_class_href(s_desc) + ret = ret + ' with ' + self.__hash_builder.build_specific_comb_hash_fn(s_desc) + ret = ret + ', ' + self.__hash_builder.build_specific_resize_policy(s_desc) + ret = ret + ', and ' + make_tt('Probe_Fn') + ret = ret + ' = ' + probe_fn = s_desc.getElementsByTagName('Probe_Fn')[0].attributes['value'].value + ret = ret + make_pb_ds_class_href(probe_fn) + return ret + + +class basic_tree_like_desc_to_html_builder: + def build_tag(self, s_desc): + ret = make_tt('Tag') + ret = ret + ' = ' + tag_desc = s_desc.getElementsByTagName('Tag')[0] + ret = ret + build_value_to_pb_ds_class_href(tag_desc) + return ret + + def build_node_update(self, s_desc): + ret = make_tt('Node_Update') + ret = ret + ' = ' + node_update_desc = s_desc.getElementsByTagName('Node_Update')[0] + ret = ret + build_value_to_pb_ds_class_href(node_update_desc) + return ret + + +class basic_tree_desc_to_html_builder: + def __init__(self): + self.__tree_like_builder = basic_tree_like_desc_to_html_builder() + + def build(self, s_desc): + ret = build_value_to_pb_ds_class_href(s_desc) + ret = ret + ' with ' + self.__tree_like_builder.build_tag(s_desc) + ret = ret + ', and ' + self.__tree_like_builder.build_node_update(s_desc) + return ret + + +class basic_trie_desc_to_html_builder: + def __init__(self): + self.__tree_like_builder = basic_tree_like_desc_to_html_builder() + + def build(self, s_desc): + ret = build_value_to_pb_ds_class_href(s_desc) + ret = ret + ' with ' + self.__tree_like_builder.build_tag(s_desc) + ret = ret + ', and ' + self.__tree_like_builder.build_node_update(s_desc) + return ret + +class lu_desc_to_html_builder: + def build(self, s_desc): + ret = build_value_to_pb_ds_class_href(s_desc) + ret = ret + ' with ' + make_tt('Update_Policy') + ret = ret + ' = ' + update_policy_desc = s_desc.getElementsByTagName('Update_Policy')[0] + ret = ret + build_value_to_pb_ds_class_href(update_policy_desc) + return ret + + +class std_desc_to_html_builder: + def build(self, s_desc): + value = s_desc.attributes['value'].value + return make_tt(value.replace('std_', 'std::')) + + +class std_tr1_desc_to_html_builder: + def build(self, s_desc): + value = s_desc.attributes['value'].value + ret = make_tt(value.replace('std_tr1_', 'std::tr1::')) + ret = ret + ' with ' + make_tt('cache_hash_code') + ret = ret + ' = ' + cache_hash_code = s_desc.getElementsByTagName('cache_hash_code')[0].attributes['value'].value + ret = ret + make_ttb(cache_hash_code) + return ret + +class gnucxx_desc_to_html_builder: + def build(self, s_desc): + value = s_desc.attributes['value'].value + return make_tt(value.replace('__gnucxx_', '__gnucxx::')) + +class stdext_desc_to_html_builder: + def build(self, s_desc): + value = s_desc.attributes['value'].value + return make_tt(value.replace('stdext_', 'stdext::')) + +class npq_desc_to_html_builder: + def build(self, vector): + if vector: + under = make_tt('std::vector') + else: + under = make_tt('std::deque') + + return make_tt('std::priority_queue') + ' adapting ' + under + +class binary_heap_desc_to_html_builder: + def build(self, s_desc): + ret = make_pb_ds_class_href('priority_queue') + ret = ret + ' with ' + make_tt('Tag') + ret = ret + ' = ' + make_pb_ds_class_href('binary_heap_tag') + return ret + +class thin_heap_desc_to_html_builder: + def build(self, s_desc): + ret = make_pb_ds_class_href('priority_queue') + ret = ret + ' with ' + make_tt('Tag') + ret = ret + ' = ' + make_pb_ds_class_href('thin_heap_tag') + return ret + +class binomial_heap_desc_to_html_builder: + def build(self, s_desc): + ret = make_pb_ds_class_href('priority_queue') + ret = ret + ' with ' + make_tt('Tag') + ret = ret + ' = ' + make_pb_ds_class_href('binomial_heap_tag') + return ret + +class rc_binomial_heap_desc_to_html_builder: + def build(self, s_desc): + ret = make_pb_ds_class_href('priority_queue') + ret = ret + ' with ' + make_tt('Tag') + ret = ret + ' = ' + make_pb_ds_class_href('rc_binomial_heap_tag') + return ret + +class pairing_heap_desc_to_html_builder: + def build(self, s_desc): + ret = make_pb_ds_class_href('priority_queue') + ret = ret + ' with ' + make_tt('Tag') + ret = ret + ' = ' + make_pb_ds_class_href('pairing_heap_tag') + return ret + +class legend_desc_builder: + """ + Returns a string corresponding to a specific container type. + """ + def __init__(self): + self.__cc_hash_builder = cc_hash_desc_to_html_builder() + self.__gp_hash_builder = gp_hash_desc_to_html_builder() + self.__basic_tree_builder = basic_tree_desc_to_html_builder() + self.__basic_trie_builder = basic_trie_desc_to_html_builder() + self.__lu_builder = lu_desc_to_html_builder() + self.__std_builder = std_desc_to_html_builder() + self.__std_tr1_builder = std_tr1_desc_to_html_builder() + self.__gnucxx_builder = gnucxx_desc_to_html_builder() + self.__stdext_builder = stdext_desc_to_html_builder() + self.__npq_builder = npq_desc_to_html_builder() + self.__thin_heap_builder = thin_heap_desc_to_html_builder() + self.__thin_heap_builder = thin_heap_desc_to_html_builder() + self.__binary_heap_builder = binary_heap_desc_to_html_builder() + self.__binomial_heap_builder = binomial_heap_desc_to_html_builder() + self.__rc_binomial_heap_builder = rc_binomial_heap_desc_to_html_builder() + self.__pairing_heap_builder = pairing_heap_desc_to_html_builder() + + def __build_specific(self, s_desc): + type = s_desc.attributes['value'].value + + if type == 'thin_heap': + return self.__thin_heap_builder.build(s_desc) + if type == 'binary_heap': + return self.__binary_heap_builder.build(s_desc) + if type == 'binomial_heap': + return self.__binomial_heap_builder.build(s_desc) + if type == 'rc_binomial_heap': + return self.__rc_binomial_heap_builder.build(s_desc) + if type == 'pairing_heap': + return self.__pairing_heap_builder.build(s_desc) + if type == 'cc_hash_table': + ret = self.__cc_hash_builder.build(s_desc) + elif type == 'gp_hash_table': + ret = self.__gp_hash_builder.build(s_desc) + elif type == 'tree': + ret = self.__basic_tree_builder.build(s_desc) + elif type == 'trie': + ret = self.__basic_trie_builder.build(s_desc) + elif type == 'list_update': + ret = self.__lu_builder.build(s_desc) + elif type == 'std::priority_queue_vector': + return self.__npq_builder.build(True) + elif type == 'std::priority_queue_deque': + return self.__npq_builder.build(False) + elif type == 'std_set' or type == 'std_map' or type == 'std_multimap': + return self.__std_builder.build(s_desc) + elif type == 'std_tr1_unordered_set' or type == 'std_tr1_unordered_map': + return self.__std_tr1_builder.build(s_desc) + elif type == 'stdext_hash_set' or type == 'stdext_hash_map' or type == 'stdext_hash_multimap': + return self.__stdext_builder.build(s_desc) + elif type == '__gnucxx_hash_set' or type == '__gnucxx_hash_map' or type == '__gnucxx_hash_multimap': + return self.__gnucxx_builder.build(s_desc) + else: + sys.stderr.write('cannot recognize %s\n' % type) + raise exception + return ret + + + def build(self, desc): + s_descs = desc.getElementsByTagName('type') + if s_descs.length == 0: + print desc.toxml() + raise exception + ret = '' + count = 0 + for s_desc in s_descs: + if count > 0: + ret = ret + ', mapping each key to ' + ret = ret + self.__build_specific(s_desc) + count = count + 1 + return ret + + +def main(doc_dir, res_dir, test_infos_f_name, test_name, build_name): + res_gtr = res_getter(test_infos_f_name) + res = res_gtr.get(res_dir, test_name) + png_mkr = png_maker() + png_of_name = doc_dir + '/' + test_name + '_' + build_name + '.png' + print png_of_name + png_mkr.make(res, png_of_name) + + +if __name__ == "__main__": + """ + This module takes 6 parameters from the command line: + Docs directory + Results directory + Tests info XML file name + Test name + Build name + Compiler name + """ + usg = "make_graph.py \n" + if len(sys.argv) != 6: + sys.stderr.write(usg) + raise exception + main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4], sys.argv[5]) diff --git a/libstdc++-v3/scripts/make_graphs.py b/libstdc++-v3/scripts/make_graphs.py new file mode 100755 index 000000000..e230e7a99 --- /dev/null +++ b/libstdc++-v3/scripts/make_graphs.py @@ -0,0 +1,160 @@ +#!/usr/bin/python + +import sys +import commands +import re +from xml.dom import minidom +from BeautifulSoup import BeautifulSoup +import make_graph + +class exception: + pass + +res_div_re = re.compile('(.*?)_res_div') +settings_div_re = re.compile('(.*?)_settings_div') + + +gray_border_div_str = '
' +space_div_str = '
' + + + +def logical_build_from_build(build): + if build == 'gcc': + return 'g++' + if build == 'msvc': + return 'msvc++' + if build == 'local': + return 'local' + sys.stderr.write(build) + raise exception + + +def img_title_from_origs(label, title, base_build_ref, build_name, logical_build_name): + title = title.replace('_tt_', '') + title = title.replace('_455tt_', '') + title = title.replace('_b_', '') + title = title.replace('_455b_', '') + title = title.replace('_456', ',') + title = title.replace('_457', '[]') + title = title.replace('_', ' ') + return '%s: %s - %s' % ( + label, + title, + base_build_ref, + build_name, + logical_build_name) + + +def make_png(src_dir, doc_dir, res_dir, tests_info_xml_f_name, build_name, test_name): + cmd_str = '%s/scripts/make_graph.py %s %s %s %s %s' % ( + src_dir, doc_dir, + res_dir, + tests_info_xml_f_name, + test_name, + build_name) + # Must start a new process for pychart - otherwise pngs overlap. + so = commands.getstatusoutput(cmd_str) + if(so[0] != 0): + sys.stderr.write(cmd_str + '\n') + sys.stderr.write(so[1] + '\n') + sys.exit(-1) + + +def make_png_str(label, test_name, build): + ret = '
' + ret += '' % (label, label) + ret += ' \ +# v3srcdir \ +# v3builddir \ +# shortname +# +# Originally hacked together by Phil Edwards + + +# We can check now that the version of doxygen is >= this variable. +DOXYVER=1.7.0 + +find_doxygen() { + local -r v_required=`echo $DOXYVER | \ + awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'` + local testing_version doxygen maybedoxy v_found + # thank you goat book + set `IFS=:; X="$PATH:/usr/local/bin:/bin:/usr/bin"; echo $X` + for dir + do + # AC_EXEEXT could come in useful here + maybedoxy="$dir/doxygen" + test -f "$maybedoxy" && testing_version=`$maybedoxy --version` + if test -n "$testing_version"; then + v_found=`echo $testing_version | \ + awk -F. '{if(NF<3)$3=0;print ($1*100+$2)*100+$3}'` + if test $v_found -ge $v_required; then + doxygen="$maybedoxy" + break + fi + fi + done + if test -z "$doxygen"; then + echo run_doxygen error: Could not find Doxygen $DOXYVER in path. 1>&2 + print_usage + fi + # We need to use other tools from the same package/version. + echo :: Using Doxygen tools from ${dir}. + PATH=$dir:$PATH + hash -r +} + +print_usage() { + cat 1>&2 <] + + MODE is one of: + html Generate user-level HTML library documentation. + man Generate user-level man pages. + xml Generate user-level XML pages. + latex Generate user-level LaTeX pages. + + BUILD_ALIAS is the GCC build alias set at configure time. + +Note: Requires Doxygen ${DOXYVER} or later; get it at + ftp://ftp.stack.nl/pub/users/dimitri/doxygen-${DOXYVER}.src.tar.gz + +EOF + exit 1 +} + +parse_options() { + for o + do + # Blatantly ripped from autoconf, er, I mean, "gratefully standing + # on the shoulders of those giants who have gone before us." + case "$o" in + -*=*) arg=`echo "$o" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) arg= ;; + esac + + case "$o" in + --mode=*) + mode=$arg ;; + --host_alias=*) + host_alias=$arg ;; + --mode | --host_alias | --help | -h) + print_usage ;; + *) + # this turned out to be a mess, maybe change to --srcdir=, etc + if test $srcdir = unset; then + srcdir=$o + elif test $outdir = unset; then + builddir=${o} + outdir=${o}/doc/doxygen + elif test $shortname = unset; then + shortname=$o + else + echo run_doxygen error: Too many arguments 1>&2 + exit 1 + fi + ;; + esac + done +} + + +# script begins here +mode=unset +host_alias=unset +srcdir=unset +outdir=unset +shortname=unset +do_html=false +do_man=false +do_xml=false +do_latex=false +enabled_sections= +generate_tagfile= +DATEtext=`date '+%Y-%m-%d'` + +# Show how this script is called. +echo run_doxygen $* + +parse_options $* +find_doxygen + +if test $srcdir = unset || test $outdir = unset || test $mode = unset || test $shortname = unset || test $host_alias = unset; then + # this could be better + echo run_doxygen error: You have not given enough information...! 1>&2 + print_usage +fi + +case x"$mode" in + xhtml) + do_html=true + enabled_sections=maint + generate_tagfile="$outdir/html/libstdc++.tag" + ;; + xlatex) + do_latex=true + enabled_sections=maint + ;; + xman) + do_man=true + ;; + xxml) + do_xml=true + enabled_sections=maint + ;; + *) + echo run_doxygen error: $mode is an invalid mode 1>&2 + exit 1 ;; +esac + +case x"$shortname" in + xYES) + ;; + xNO) + ;; + *) + echo run_doxygen error: $shortname is invalid 1>&2 + exit 1 ;; +esac + + +mkdir -p $outdir +chmod u+w $outdir + +# Run it +( + set -e + cd $builddir + sed -e "s=@outdir@=${outdir}=g" \ + -e "s=@srcdir@=${srcdir}=g" \ + -e "s=@shortname@=${shortname}=g" \ + -e "s=@builddir@=${builddir}=g" \ + -e "s=@host_alias@=${host_alias}=g" \ + -e "s=@enabled_sections@=${enabled_sections}=" \ + -e "s=@do_html@=${do_html}=" \ + -e "s=@do_latex@=${do_latex}=" \ + -e "s=@do_man@=${do_man}=" \ + -e "s=@do_xml@=${do_xml}=" \ + -e "s=@generate_tagfile@=${generate_tagfile}=" \ + ${srcdir}/doc/doxygen/user.cfg.in > ${outdir}/${mode}.cfg + echo :: NOTE that this may take some time... + echo doxygen ${outdir}/${mode}.cfg + doxygen ${outdir}/${mode}.cfg +) +ret=$? +test $ret -ne 0 && exit $ret + +if $do_xml; then + echo :: + echo :: XML pages begin with + echo :: ${outdir}/xml/index.xml +fi + +if $do_latex; then + cd ${outdir}/${mode} + + # Also drop in the header file and style sheet + doxygen -w latex header.tex doxygen.sty + + echo :: + echo :: LaTeX pages begin with + echo :: ${outdir}/latex/refman.tex +fi + +if $do_html; then + cd ${outdir}/${mode} + + #doxytag -t libstdc++.tag . > /dev/null 2>&1 + sed -e '//d' libstdc++.tag > TEMP + mv TEMP libstdc++.tag + + sed -e "s=@DATE@=${DATEtext}=" \ + ${srcdir}/doc/doxygen/mainpage.html > index.html + + # The following bit of line noise changes annoying + # std::foo < typename _Ugly1, typename _Ugly2, .... _DefaultUgly17 > + # to user-friendly + # std::foo + # in the major "Compound List" page. + sed -e 's=\(::[[:alnum:]_]*\)< .* >=\1=' annotated.html > annstrip.html + mv annstrip.html annotated.html + + cp ${srcdir}/doc/doxygen/tables.html tables.html + + echo :: + echo :: HTML pages begin with + echo :: ${outdir}/html/index.html +fi + +# Mess with the man pages. We don't need documentation of the internal +# headers, since the man pages for those contain nothing useful anyhow. The +# man pages for doxygen modules need to be renamed (or deleted). And the +# generated #include lines need to be changed from the internal names to the +# standard ones (e.g., "#include " -> "#include "). +if $do_man; then +echo :: +echo :: Fixing up the man pages... +cd $outdir/man/man3 + +# File names with embedded spaces (EVIL!) need to be....? renamed or removed? +find . -name "* *" -print0 | xargs -0r rm # requires GNU tools + +# man pages are for functions/types/other entities, not source files +# directly. who the heck would type "man foo.h" anyhow? +find . -name "[a-z]*" -a ! -name "std_*" -print | xargs rm +rm -f *.h.3 *.hpp.3 *config* *.cc.3 *.tcc.3 *_t.3 +#rm ext_*.3 tr1_*.3 debug_*.3 + +# this is used to examine what we would have deleted, for debugging +#mkdir trash +#find . -name "[a-z]*" -a ! -name "std_*" -print | xargs -i mv {} trash +#mv *.h.3 *config* *.cc.3 *.tcc.3 *_t.3 trash + +# Standardize the displayed header names. If anyone who knows perl cares +# enough to rewrite all this, feel free. This only gets run once a century, +# and I'm off getting coffee then anyhow, so I didn't care enough to make +# this super-fast. +g++ ${srcdir}/doc/doxygen/stdheader.cc -o ./stdheader +problematic=`egrep -l '#include <.*_.*>' [a-z]*.3` +for f in $problematic; do + # this is also slow, but safe and easy to debug + oldh=`sed -n '/fC#include .*/\1/p' $f` + newh=`echo $oldh | ./stdheader` + sed "s=${oldh}=${newh}=" $f > TEMP + mv TEMP $f +done +rm stdheader + +# Some of the pages for generated modules have text that confuses certain +# implementations of man(1), e.g., Linux's. We need to have another top-level +# *roff tag to /stop/ the .SH NAME entry. +problematic=`egrep --files-without-match '^\.SH SYNOPSIS' [A-Z]*.3` +#problematic='Containers.3 Sequences.3 Assoc_containers.3 Iterator_types.3' + +for f in $problematic; do + sed '/^\.SH NAME/{ +n +a\ +\ +.SH SYNOPSIS + }' $f > TEMP + mv TEMP $f +done + +# Also, break this (generated) line up. It's ugly as sin. +problematic=`grep -l '[^^]Definition at line' *.3` +for f in $problematic; do + sed 's/Definition at line/\ +.PP\ +&/' $f > TEMP + mv TEMP $f +done + +cp ${srcdir}/doc/doxygen/Intro.3 C++Intro.3 + +# Why didn't I do this at the start? Were rabid weasels eating my brain? +# Who the fsck would "man std_vector" when the class isn't named that? + +# First, deal with nested namespaces. +for f in *chrono_*; do + newname=`echo $f | sed 's/chrono_/chrono::/'` + mv $f $newname +done +for f in *__debug_*; do + newname=`echo $f | sed 's/__debug_/__debug::/'` + mv $f $newname +done +for f in *decimal_*; do + newname=`echo $f | sed 's/decimal_/decimal::/'` + mv $f $newname +done +for f in *__detail_*; do + newname=`echo $f | sed 's/__detail_/__detail::/'` + mv $f $newname +done +for f in *__parallel_*; do + newname=`echo $f | sed 's/__parallel_/__parallel::/'` + mv $f $newname +done +for f in *__profile_*; do + newname=`echo $f | sed 's/__profile_/__profile::/'` + mv $f $newname +done +for f in *__atomic0_*; do + newname=`echo $f | sed 's/__atomic0_/__atomic0::/'` + mv $f $newname +done +for f in *__atomic2_*; do + newname=`echo $f | sed 's/__atomic2_/__atomic2::/'` + mv $f $newname +done + +# Then, clean up other top-level namespaces. +for f in std_tr1_*; do + newname=`echo $f | sed 's/^std_tr1_/std::tr1::/'` + mv $f $newname +done +for f in std_*; do + newname=`echo $f | sed 's/^std_/std::/'` + mv $f $newname +done +for f in __gnu_cxx_*; do + newname=`echo $f | sed 's/^__gnu_cxx_/__gnu_cxx::/'` + mv $f $newname +done +for f in __gnu_debug_*; do + newname=`echo $f | sed 's/^__gnu_debug_/__gnu_debug::/'` + mv $f $newname +done +for f in __gnu_parallel_*; do + newname=`echo $f | sed 's/^__gnu_parallel_/__gnu_parallel::/'` + mv $f $newname +done +for f in __gnu_profile_*; do + newname=`echo $f | sed 's/^__gnu_profile_/__gnu_profile::/'` + mv $f $newname +done +for f in __gnu_pbds_*; do + newname=`echo $f | sed 's/^__gnu_pbds_/__gnu_pbds::/'` + mv $f $newname +done +for f in __cxxabiv1_*; do + newname=`echo $f | sed 's/^__cxxabiv1_/abi::/'` + mv $f $newname +done + +# Then piecemeal nested classes +for f in *__future_base_*; do + newname=`echo $f | sed 's/__future_base_/__future_base::/'` + mv $f $newname +done + + + +# Generic removal bits, where there are things in the generated man +# pages that need to be killed. +for f in *_libstdc__-v3_*; do + rm $f +done + +for f in *_src_*; do + rm $f +done + + +# Also, for some reason, typedefs don't get their own man pages. Sigh. +for f in ios streambuf istream ostream iostream stringbuf \ + istringstream ostringstream stringstream filebuf ifstream \ + ofstream fstream string; +do + echo ".so man3/std::basic_${f}.3" > std::${f}.3 + echo ".so man3/std::basic_${f}.3" > std::w${f}.3 +done + +echo :: +echo :: Man pages in ${outdir}/man +fi + +# all done +echo :: + +exit 0 diff --git a/libstdc++-v3/scripts/testsuite_flags.in b/libstdc++-v3/scripts/testsuite_flags.in new file mode 100755 index 000000000..457adaf4d --- /dev/null +++ b/libstdc++-v3/scripts/testsuite_flags.in @@ -0,0 +1,81 @@ +#!/bin/sh + +# +# This script computes the various flags needed to run GNU C++ testsuites +# (compiler specific as well as library specific). +# +# Written by Benjamin Kosnik +# Gabriel Dos Reis +# + +# Print a message saying how this script is intended to be invoked +print_usage() { + cat <