aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Savoye <rob@welcomehome.org>2001-05-26 05:55:28 +0000
committerRob Savoye <rob@welcomehome.org>2001-05-26 05:55:28 +0000
commit4330bafff46c45742dc65b79a7e06196f0d89336 (patch)
tree37f7b37ad0a0f2ed4b94c848d7d0d9c2487d077f
parent93d1d8d757dfbf0738f9fcb72ea6f04050772da4 (diff)
* acinclude.m4: Add DJ_AC_STL, which figures out if we're running
libstdc++ version 2 or 3. * aclocal.m4: Regenerated. * configure.in: Add DJ_AC_STL. * configure: Regenerated. * dejagnu.h: Add the use of the std namespace, so we work with libstdc++ version 2 or 3. * testsuite/libdejagnu/unit.cc: Use setbuf() or pubsetbuff(), depending on the version.
-rw-r--r--ChangeLog12
-rw-r--r--acinclude.m421
-rw-r--r--aclocal.m430
-rwxr-xr-xconfigure352
-rw-r--r--configure.in8
-rw-r--r--dejagnu.h57
-rw-r--r--testsuite/libdejagnu/unit.cc13
7 files changed, 455 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index e2896a6..efa0fc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2001-05-25 Rob Savoye <rob@peggyo.welcomehome.org>
+
+ * acinclude.m4: Add DJ_AC_STL, which figures out if we're running
+ libstdc++ version 2 or 3.
+ * aclocal.m4: Regenerated.
+ * configure.in: Add DJ_AC_STL.
+ * configure: Regenerated.
+ * dejagnu.h: Add the use of the std namespace, so we work with
+ libstdc++ version 2 or 3.
+ * testsuite/libdejagnu/unit.cc: Use setbuf() or pubsetbuff(),
+ depending on the version.
+
2001-05-20 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* baseboards/m68hc11-sim.exp: New file for 68HC11/68HC12 validation.
diff --git a/acinclude.m4 b/acinclude.m4
index 20497d0..9f6cec4 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,3 +1,24 @@
+AC_DEFUN(DJ_AC_STL, [
+AC_MSG_CHECKING(for for STL versions)
+AC_CACHE_VAL(ac_cv_stl,[
+ AC_TRY_COMPILE([#include <iostream>], [
+ using namespace std;
+ char bbuuff[5120];
+ cout.rdbuf()->pubsetbuf(bbuuff, 5120); ],
+ ac_cv_stl=v3
+ ,
+ ac_cv_stl=v2
+ ),
+])
+
+if test x"${ac_cv_stl}" != x"v2" ; then
+ AC_MSG_RESULT(v3)
+ AC_DEFINE(HAVE_STL3)
+else
+ AC_MSG_RESULT(v2)
+fi
+])
+
AC_DEFUN(DJ_AC_PATH_TCLSH, [
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../..
diff --git a/aclocal.m4 b/aclocal.m4
index 4884dc2..f5b577e 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -10,6 +10,27 @@ dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
+AC_DEFUN(DJ_AC_STL, [
+AC_MSG_CHECKING(for for STL versions)
+AC_CACHE_VAL(ac_cv_stl,[
+ AC_TRY_COMPILE([#include <iostream>], [
+ using namespace std;
+ char bbuuff[5120];
+ cout.rdbuf()->pubsetbuf(bbuuff, 5120); ],
+ ac_cv_stl=v3
+ ,
+ ac_cv_stl=v2
+ ),
+])
+
+if test x"${ac_cv_stl}" != x"v2" ; then
+ AC_MSG_RESULT(v3)
+ AC_DEFINE(HAVE_STL3)
+else
+ AC_MSG_RESULT(v2)
+fi
+])
+
AC_DEFUN(DJ_AC_PATH_TCLSH, [
dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../..
@@ -223,3 +244,12 @@ else
$1_FALSE=
fi])
+
+dnl AM_PROG_LEX
+dnl Look for flex, lex or missing, then run AC_PROG_LEX and AC_DECL_YYTEXT
+AC_DEFUN(AM_PROG_LEX,
+[missing_dir=ifelse([$1],,`cd $ac_aux_dir && pwd`,$1)
+AC_CHECK_PROGS(LEX, flex lex, "$missing_dir/missing flex")
+AC_PROG_LEX
+AC_DECL_YYTEXT])
+
diff --git a/configure b/configure
index 755e157..c780689 100755
--- a/configure
+++ b/configure
@@ -1358,10 +1358,302 @@ echo "$ac_t""${ac_cv_exeext}" 1>&6
ac_exeext=$EXEEXT
+for ac_prog in 'bison -y' byacc
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1367: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$YACC"; then
+ ac_cv_prog_YACC="$YACC" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_YACC="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+YACC="$ac_cv_prog_YACC"
+if test -n "$YACC"; then
+ echo "$ac_t""$YACC" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$YACC" && break
+done
+test -n "$YACC" || YACC="yacc"
+
+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
+echo "configure:1398: checking how to run the C preprocessor" >&5
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # This must be in double quotes, not single quotes, because CPP may get
+ # substituted into the Makefile and "${CC-cc}" will confuse make.
+ CPP="${CC-cc} -E"
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp.
+ cat > conftest.$ac_ext <<EOF
+#line 1413 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1419: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -E -traditional-cpp"
+ cat > conftest.$ac_ext <<EOF
+#line 1430 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP="${CC-cc} -nologo -E"
+ cat > conftest.$ac_ext <<EOF
+#line 1447 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1453: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+ :
+else
+ echo "$ac_err" >&5
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ CPP=/lib/cpp
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+ ac_cv_prog_CPP="$CPP"
+fi
+ CPP="$ac_cv_prog_CPP"
+else
+ ac_cv_prog_CPP="$CPP"
+fi
+echo "$ac_t""$CPP" 1>&6
+
+missing_dir=`cd $ac_aux_dir && pwd`
+for ac_prog in flex lex
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1483: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$LEX"; then
+ ac_cv_prog_LEX="$LEX" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_LEX="$ac_prog"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+fi
+fi
+LEX="$ac_cv_prog_LEX"
+if test -n "$LEX"; then
+ echo "$ac_t""$LEX" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+test -n "$LEX" && break
+done
+test -n "$LEX" || LEX=""$missing_dir/missing flex""
+
+# Extract the first word of "flex", so it can be a program name with args.
+set dummy flex; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:1516: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_LEX'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test -n "$LEX"; then
+ ac_cv_prog_LEX="$LEX" # Let the user override the test.
+else
+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
+ ac_dummy="$PATH"
+ for ac_dir in $ac_dummy; do
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$ac_word; then
+ ac_cv_prog_LEX="flex"
+ break
+ fi
+ done
+ IFS="$ac_save_ifs"
+ test -z "$ac_cv_prog_LEX" && ac_cv_prog_LEX="lex"
+fi
+fi
+LEX="$ac_cv_prog_LEX"
+if test -n "$LEX"; then
+ echo "$ac_t""$LEX" 1>&6
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+if test -z "$LEXLIB"
+then
+ case "$LEX" in
+ flex*) ac_lib=fl ;;
+ *) ac_lib=l ;;
+ esac
+ echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6
+echo "configure:1550: checking for yywrap in -l$ac_lib" >&5
+ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-l$ac_lib $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1558 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char yywrap();
+
+int main() {
+yywrap()
+; return 0; }
+EOF
+if { (eval echo configure:1569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ LEXLIB="-l$ac_lib"
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking lex output file root""... $ac_c" 1>&6
+echo "configure:1592: checking lex output file root" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_lex_root'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # The minimal lex program is just a single line: %%. But some broken lexes
+# (Solaris, I think it was) want two %% lines, so accommodate them.
+echo '%%
+%%' | $LEX
+if test -f lex.yy.c; then
+ ac_cv_prog_lex_root=lex.yy
+elif test -f lexyy.c; then
+ ac_cv_prog_lex_root=lexyy
+else
+ { echo "configure: error: cannot find output from $LEX; giving up" 1>&2; exit 1; }
+fi
+fi
+
+echo "$ac_t""$ac_cv_prog_lex_root" 1>&6
+LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
+
+echo $ac_n "checking whether yytext is a pointer""... $ac_c" 1>&6
+echo "configure:1613: checking whether yytext is a pointer" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_lex_yytext_pointer'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ # POSIX says lex can declare yytext either as a pointer or an array; the
+# default is implementation-dependent. Figure out which it is, since
+# not all implementations provide the %pointer and %array declarations.
+ac_cv_prog_lex_yytext_pointer=no
+echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
+ac_save_LIBS="$LIBS"
+LIBS="$LIBS $LEXLIB"
+cat > conftest.$ac_ext <<EOF
+#line 1625 "configure"
+#include "confdefs.h"
+`cat $LEX_OUTPUT_ROOT.c`
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:1632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ ac_cv_prog_lex_yytext_pointer=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+rm -f "${LEX_OUTPUT_ROOT}.c"
+
+fi
+
+echo "$ac_t""$ac_cv_prog_lex_yytext_pointer" 1>&6
+if test $ac_cv_prog_lex_yytext_pointer = yes; then
+ cat >> confdefs.h <<\EOF
+#define YYTEXT_POINTER 1
+EOF
+
+fi
+
+
dirlist=".. ../../ ../../.. ../../../.. ../../../../.. ../../../../../.. ../../../../../../.. ../../../../../../../.. ../../../../../../../../.. ../../../../../../../../../.."
echo $ac_n "checking for docbook tools""... $ac_c" 1>&6
-echo "configure:1365: checking for docbook tools" >&5
+echo "configure:1657: checking for docbook tools" >&5
# Check whether --with-oskith or --without-oskith was given.
if test "${with_oskith+set}" = set; then
withval="$with_oskith"
@@ -1407,7 +1699,7 @@ dirlist=".. ../../ ../../../ ../../../../ ../../../../../ ../../../../../../ ../
/../../../../../.."
no_itcl=true
echo $ac_n "checking for the tclsh program""... $ac_c" 1>&6
-echo "configure:1411: checking for the tclsh program" >&5
+echo "configure:1703: checking for the tclsh program" >&5
# Check whether --with-tclinclude or --without-tclinclude was given.
if test "${with_tclinclude+set}" = set; then
withval="$with_tclinclude"
@@ -1452,7 +1744,7 @@ if test x"${ac_cv_path_tclsh}" = x ; then
# Extract the first word of "tclsh", so it can be a program name with args.
set dummy tclsh; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1456: checking for $ac_word" >&5
+echo "configure:1748: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_tclsh'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1491,6 +1783,51 @@ TCLSH="${ac_cv_path_tclsh}"
+
+echo $ac_n "checking for for STL versions""... $ac_c" 1>&6
+echo "configure:1789: checking for for STL versions" >&5
+if eval "test \"`echo '$''{'ac_cv_stl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ cat > conftest.$ac_ext <<EOF
+#line 1795 "configure"
+#include "confdefs.h"
+#include <iostream>
+int main() {
+
+ using namespace std;
+ char bbuuff[5120];
+ cout.rdbuf()->pubsetbuf(bbuuff, 5120);
+; return 0; }
+EOF
+if { (eval echo configure:1805: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_stl=v3
+
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_stl=v2
+
+fi
+rm -f conftest*,
+
+fi
+
+
+if test x"${ac_cv_stl}" != x"v2" ; then
+ echo "$ac_t""v3" 1>&6
+ cat >> confdefs.h <<\EOF
+#define HAVE_STL3 1
+EOF
+
+else
+ echo "$ac_t""v2" 1>&6
+fi
+
+
BOARDS='$(boards)'
CONFIG='$(config)'
@@ -1613,7 +1950,7 @@ ac_given_srcdir=$srcdir
ac_given_INSTALL="$INSTALL"
trap 'rm -fr `echo "Makefile doc/Makefile testsuite/Makefile example/Makefile
-testsuite/libdejagnu/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+testsuite/libdejagnu/Makefile unitparse/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
@@ -1662,6 +1999,11 @@ s%@MAINT@%$MAINT%g
s%@CC@%$CC%g
s%@CXX@%$CXX%g
s%@EXEEXT@%$EXEEXT%g
+s%@YACC@%$YACC%g
+s%@LEX@%$LEX%g
+s%@LEXLIB@%$LEXLIB%g
+s%@CPP@%$CPP%g
+s%@LEX_OUTPUT_ROOT@%$LEX_OUTPUT_ROOT%g
s%@DOCBOOK@%$DOCBOOK%g
s%@tclsh@%$tclsh%g
s%@TCLSH@%$TCLSH%g
@@ -1710,7 +2052,7 @@ EOF
cat >> $CONFIG_STATUS <<EOF
CONFIG_FILES=\${CONFIG_FILES-"Makefile doc/Makefile testsuite/Makefile example/Makefile
-testsuite/libdejagnu/Makefile"}
+testsuite/libdejagnu/Makefile unitparse/Makefile"}
EOF
cat >> $CONFIG_STATUS <<\EOF
for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
diff --git a/configure.in b/configure.in
index a857b63..df387b9 100644
--- a/configure.in
+++ b/configure.in
@@ -13,12 +13,18 @@ AC_PROG_CXX
AC_PROG_INSTALL
AC_EXEEXT
+AC_PROG_YACC
+AM_PROG_LEX
+
dnl we need the path to Docbook so we can build packages.
DJ_AC_PATH_DOCBOOK
dnl we need the path to the tcl shell to build a release
DJ_AC_PATH_TCLSH
+dnl we need to know if we have libstl v2 or v3
+DJ_AC_STL
+
dnl Level of indirection for automake macro (baseboards:boards_DATA)
BOARDS='$(boards)'
AC_SUBST(BOARDS)
@@ -28,5 +34,5 @@ AC_SUBST(CONFIG)
AC_CONFIG_SUBDIRS(example/calc)
AC_OUTPUT(Makefile doc/Makefile testsuite/Makefile example/Makefile
-testsuite/libdejagnu/Makefile)
+testsuite/libdejagnu/Makefile unitparse/Makefile)
diff --git a/dejagnu.h b/dejagnu.h
index 7d6c7f7..9d51c47 100644
--- a/dejagnu.h
+++ b/dejagnu.h
@@ -63,6 +63,7 @@ totals (void) {
#ifdef __cplusplus
+
#include <iostream>
#include <iomanip>
#include <fstream>
@@ -110,12 +111,13 @@ OMANIP<int> testout(int i) {
#endif
char *testout (int x) {
- const int len = 128;
- static char buf[len];
- static ostrstream oss(buf, len, ios::out);
- oss.seekp(ios::beg);
- oss << outstate[x] << ends;
- return buf;
+ using namespace std;
+ const int len = 128;
+ static char buf[len];
+ static ostrstream oss(buf, len, ios::out);
+ oss.seekp(ios::beg);
+ oss << outstate[x] << ends;
+ return buf;
}
enum teststate {FAILED, PASSED,UNTESTED,UNRESOLVED} laststate;
@@ -123,7 +125,7 @@ enum teststate {FAILED, PASSED,UNTESTED,UNRESOLVED} laststate;
class TestState {
private:
teststate laststate;
- string lastmsg;
+ std::string lastmsg;
public:
TestState(void) {
passed = 0;
@@ -135,75 +137,76 @@ class TestState {
totals();
};
- void testrun (bool b, string s) {
+
+ void testrun (bool b, std::string s) {
if (b)
pass (s);
else
fail (s);
}
- void pass (string s) {
+ void pass (std::string s) {
passed++;
laststate = PASSED;
lastmsg = s;
- cout << "\t" << testout(PASSED) << s << endl;
+ std::cout << "\t" << testout(PASSED) << s << std::endl;
}
void pass (const char *c) {
- string s = c;
+ std::string s = c;
pass (s);
}
- void fail (string s) {
+ void fail (std::string s) {
failed++;
laststate = FAILED;
lastmsg = s;
- cout << "\t" << testout(FAILED) << s << endl;
+ std::cout << "\t" << testout(FAILED) << s << std::endl;
}
void fail (const char *c) {
- string s = c;
+ std::string s = c;
fail (s);
}
- void untested (string s) {
+ void untested (std::string s) {
untest++;
laststate = UNTESTED;
lastmsg = s;
- cout << "\t" << testout(UNTESTED) << s << endl;
+ std::cout << "\t" << testout(UNTESTED) << s << std::endl;
}
void untested (const char *c) {
- string s = c;
+ std::string s = c;
untested (s);
}
- void unresolved (string s) {
+ void unresolved (std::string s) {
unresolve++;
laststate = UNRESOLVED;
lastmsg = s;
- cout << "\t" << testout(UNRESOLVED) << s << endl;
+ std::cout << "\t" << testout(UNRESOLVED) << s << std::endl;
}
void unresolved (const char *c) {
- string s = c;
+ std::string s = c;
unresolved (s);
}
void totals (void) {
- cout << "\t#passed:\t\t" << passed << endl;
- cout << "\t#failed:\t\t" << failed << endl;
+ std::cout << "\t#passed:\t\t" << passed << std::endl;
+ std::cout << "\t#failed:\t\t" << failed << std::endl;
if (untest)
- cout << "\t#untested:\t\t" << untest << endl;
+ std::cout << "\t#untested:\t\t" << untest << std::endl;
if (unresolve)
- cout << "\t#unresolved:\t\t" << unresolve << endl;
+ std::cout << "\t#unresolved:\t\t" << unresolve << std::endl;
}
- // This is so thjis class can be printed in an ostream.
- friend ostream & operator << (ostream &os, TestState& t) {
+ // This is so this class can be printed in an ostream.
+ friend std::ostream & operator << (std::ostream &os, TestState& t) {
return os << "\t" << outstate[t.laststate] << t.lastmsg ;
}
int GetState(void) {
return laststate;
}
- string GetMsg(void) {
+ std::string GetMsg(void) {
return lastmsg;
}
};
diff --git a/testsuite/libdejagnu/unit.cc b/testsuite/libdejagnu/unit.cc
index 9f070aa..6f3918a 100644
--- a/testsuite/libdejagnu/unit.cc
+++ b/testsuite/libdejagnu/unit.cc
@@ -1,13 +1,14 @@
// unit.cc -- This is a test case for the Dejagnu.h classes.
#include <iostream>
-#include <dejagnu.h>
-
#include <regex.h>
#include <string>
#include <fstream>
#include <set>
#include <sys/types.h>
+#include <dejagnu.h>
+
+using namespace std;
TestState runtest;
TestState test;
@@ -48,9 +49,12 @@ main (int argc, char *argv[]) {
// Replace the output buffer for cout, so we can examine it to
// see what was displayed. Otherwise, there is no way we can test
// the logging functions completely.
- streambuf *sb = cout.rdbuf();
char bbuuff[5120];
- sb->setbuf(bbuuff, 5120);
+#ifdef HAVE_STL3
+ cout.rdbuf()->pubsetbuf(bbuuff, 5120);
+#else
+ cout.rdbuf()->setbuf(bbuuff, 5120);
+#endif
testClass1.tname = "testType1";
testClass1.tnum = 1;
@@ -108,7 +112,6 @@ main (int argc, char *argv[]) {
} else {
runtest.fail ("Totals message");
}
-
}