#
# -- chastain 2004-01-06
-proc get_compiler_info {{arg ""}} {
+proc get_compiler_info {{language "c"}} {
# For compiler.c, compiler.cc and compiler.F90.
global srcdir
}
# Choose which file to preprocess.
- set ifile "${srcdir}/lib/compiler.c"
- if { $arg == "c++" } {
+ if { $language == "c++" } {
set ifile "${srcdir}/lib/compiler.cc"
- } elseif { $arg == "f90" } {
+ } elseif { $language == "f90" } {
set ifile "${srcdir}/lib/compiler.F90"
+ } elseif { $language == "c" } {
+ set ifile "${srcdir}/lib/compiler.c"
+ } else {
+ perror "Unable to fetch compiler version for language: $language"
+ return -1
}
# Run $ifile through the right preprocessor.
# We have to use -E and -o together, despite the comments
# above, because of how DejaGnu handles remote host testing.
set ppout "$outdir/compiler.i"
- gdb_compile "${ifile}" "$ppout" preprocess [list "$arg" quiet getting_compiler_info]
+ gdb_compile "${ifile}" "$ppout" preprocess [list "$language" quiet getting_compiler_info]
set file [open $ppout r]
set cppout [read $file]
close $file
} else {
- set cppout [ gdb_compile "${ifile}" "" preprocess [list "$arg" quiet getting_compiler_info] ]
+ set cppout [ gdb_compile "${ifile}" "" preprocess [list "$language" quiet getting_compiler_info] ]
}
eval log_file $saved_log
# Otherwise the argument is a glob-style expression to match against
# compiler_info.
-proc test_compiler_info { {compiler ""} {language ""} } {
+proc test_compiler_info { {compiler ""} {language "c"} } {
global compiler_info
get_compiler_info $language
set ada 1
}
- set info_options ""
if { [lsearch -exact $options "c++"] >= 0 } {
set info_options "c++"
} elseif { [lsearch -exact $options "f90"] >= 0 } {
set info_options "f90"
+ } else {
+ set info_options "c"
}
switch -glob [test_compiler_info "" ${info_options}] {