diff options
author | Michael Chastain <mec@google.com> | 2004-06-14 15:29:30 +0000 |
---|---|---|
committer | Michael Chastain <mec@google.com> | 2004-06-14 15:29:30 +0000 |
commit | 4f70a4c95ab41254f8d08c00f6c51bcf07814aab (patch) | |
tree | 59bdb6b976e431415c96307307858b937be9a9f2 | |
parent | cea4838c90297f951d3fe58672b75e4184a29f44 (diff) | |
download | binutils-4f70a4c95ab41254f8d08c00f6c51bcf07814aab.zip binutils-4f70a4c95ab41254f8d08c00f6c51bcf07814aab.tar.gz binutils-4f70a4c95ab41254f8d08c00f6c51bcf07814aab.tar.bz2 |
2004-06-14 Michael Chastain <mec.gnu@mindspring.com>
* lib/compiler.c: Remove gcc_compiled, hp_cc_compiler,
hp_aCC_compiler.
* lib/compiler.cc: Likewise.
* lib/gdb.exp (get_compiler_info): Eval lines only if they are
'set' commands. Log diagnostics for other lines. Set
gcc_compiled, hp_cc_compiler, and hp_aCC_compiler.
-rw-r--r-- | gdb/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | gdb/testsuite/lib/compiler.c | 11 | ||||
-rw-r--r-- | gdb/testsuite/lib/compiler.cc | 11 | ||||
-rw-r--r-- | gdb/testsuite/lib/gdb.exp | 44 |
4 files changed, 48 insertions, 27 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index cf5ae08..d8000e8 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2004-06-14 Michael Chastain <mec.gnu@mindspring.com> + + * lib/compiler.c: Remove gcc_compiled, hp_cc_compiler, + hp_aCC_compiler. + * lib/compiler.cc: Likewise. + * lib/gdb.exp (get_compiler_info): Eval lines only if they are + 'set' commands. Log diagnostics for other lines. Set + gcc_compiled, hp_cc_compiler, and hp_aCC_compiler. + 2004-06-13 Michael Chastain <mec.gnu@mindspring.com> * gdb.cp/try_catch.cc: Add copyright notice. diff --git a/gdb/testsuite/lib/compiler.c b/gdb/testsuite/lib/compiler.c index dbce43e..47b376f 100644 --- a/gdb/testsuite/lib/compiler.c +++ b/gdb/testsuite/lib/compiler.c @@ -34,7 +34,7 @@ TODO: purge signed_keyword_not_used. */ -set compiler_info "" +set compiler_info "unknown" #if defined (__GNUC__) #if defined (__GNUC_PATCHLEVEL__) @@ -43,23 +43,14 @@ set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -] #else set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ "unknown"} -] #endif -set gcc_compiled __GNUC__ -#else -set gcc_compiled 0 #endif #if defined (__HP_cc) set compiler_info [join {hpcc __HP_cc} -] -set hp_cc_compiler __HP_cc -#else -set hp_cc_compiler 0 #endif #if defined (__HP_aCC) set compiler_info [join {hpacc __HP_aCC} -] -set hp_aCC_compiler __HP_aCC -#else -set hp_aCC_compiler 0 #endif /* gdb.base/whatis.exp still uses this */ diff --git a/gdb/testsuite/lib/compiler.cc b/gdb/testsuite/lib/compiler.cc index 8059e97..72b9dc1 100644 --- a/gdb/testsuite/lib/compiler.cc +++ b/gdb/testsuite/lib/compiler.cc @@ -22,7 +22,7 @@ /* This file is exactly like compiler.c. I could just use compiler.c if I could be sure that every C++ compiler accepted extensions of ".c". */ -set compiler_info "" +set compiler_info "unknown" #if defined (__GNUC__) #if defined (__GNUC_PATCHLEVEL__) @@ -31,23 +31,14 @@ set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__} -] #else set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ "unknown"} -] #endif -set gcc_compiled __GNUC__ -#else -set gcc_compiled 0 #endif #if defined (__HP_cc) set compiler_info [join {hpcc __HP_cc} -] -set hp_cc_compiler __HP_cc -#else -set hp_cc_compiler 0 #endif #if defined (__HP_aCC) set compiler_info [join {hpacc __HP_aCC} -] -set hp_aCC_compiler __HP_aCC -#else -set hp_aCC_compiler 0 #endif /* gdb.base/whatis.exp still uses this */ diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 32f36d1..a41291c 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -1190,10 +1190,12 @@ proc get_compiler_info {binfile args} { # These come from compiler.c or compiler.cc global compiler_info + global signed_keyword_not_used + + # Legacy global data symbols. global gcc_compiled global hp_cc_compiler global hp_aCC_compiler - global signed_keyword_not_used # Choose which file to preprocess. set ifile "${srcdir}/lib/compiler.c" @@ -1207,15 +1209,43 @@ proc get_compiler_info {binfile args} { set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ] log_file -a "$outdir/$tool.log" - # Source the output. + # Eval the output. + set unknown 0 foreach cppline [ split "$cppout" "\n" ] { - if { ! [ regexp "^#" "$cppline" ] } { - if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } { - verbose "get_compiler_info: $cppline" 2 - eval "$cppline" - } + if { [ regexp "^#" "$cppline" ] } { + # line marker + } elseif { [ regexp "^\[\n\r\t \]*$" "$cppline" ] } { + # blank line + } elseif { [ regexp "^\[\n\r\t \]*set\[\n\r\t \]" "$cppline" ] } { + # eval this line + verbose "get_compiler_info: $cppline" 2 + eval "$cppline" + } else { + # unknown line + verbose -log "get_compiler_info: $cppline" + set unknown 1 } } + + # Reset to unknown compiler if any diagnostics happened. + if { $unknown } { + set compiler_info "unknown" + set signed_keyword_not_used 0 + } + + # Set the legacy symbols. + set gcc_compiled 0 + set hp_cc_compiler 0 + set hp_aCC_compiler 0 + if { [regexp "^gcc-1-" "$compiler_info" ] } { set gcc_compiled 1 } + if { [regexp "^gcc-2-" "$compiler_info" ] } { set gcc_compiled 2 } + if { [regexp "^gcc-3-" "$compiler_info" ] } { set gcc_compiled 3 } + if { [regexp "^gcc-4-" "$compiler_info" ] } { set gcc_compiled 4 } + if { [regexp "^gcc-5-" "$compiler_info" ] } { set gcc_compiled 5 } + if { [regexp "^hpcc-" "$compiler_info" ] } { set hp_cc_compiler 1 } + if { [regexp "^hpacc-" "$compiler_info" ] } { set hp_aCC_compiler 1 } + + # Log what happened. verbose -log "get_compiler_info: $compiler_info" # Most compilers will evaluate comparisons and other boolean |