2004-01-24 Michael Chastain <mec.gnu@mindspring.com>
* lib/compiler.c: Add hp_cc_compiler and hp_aCC_compiler. * lib/compiler.cc: Likewise. * lib/gdb.exp (get_compiler_info): Always call gdb_compile to get the right preprocessor. Eval the output directly. Remove special tests for hp_cc_compiler and hp_aCC_compiler. Remove hp_f77_compiler and hp_f90_compiler completely. (gdb_preprocess): Delete. (get_compiler): Delete.
This commit is contained in:
parent
690668cc17
commit
94b8e87660
4 changed files with 166 additions and 187 deletions
|
@ -1,3 +1,14 @@
|
||||||
|
2004-01-24 Michael Chastain <mec.gnu@mindspring.com>
|
||||||
|
|
||||||
|
* lib/compiler.c: Add hp_cc_compiler and hp_aCC_compiler.
|
||||||
|
* lib/compiler.cc: Likewise.
|
||||||
|
* lib/gdb.exp (get_compiler_info): Always call gdb_compile to
|
||||||
|
get the right preprocessor. Eval the output directly. Remove
|
||||||
|
special tests for hp_cc_compiler and hp_aCC_compiler. Remove
|
||||||
|
hp_f77_compiler and hp_f90_compiler completely.
|
||||||
|
(gdb_preprocess): Delete.
|
||||||
|
(get_compiler): Delete.
|
||||||
|
|
||||||
2004-01-24 Mark Kettenis <kettenis@gnu.org>
|
2004-01-24 Mark Kettenis <kettenis@gnu.org>
|
||||||
|
|
||||||
* gdb.base/charset.c, gdb.base/dump.c, gdb.base/huge.c: Include
|
* gdb.base/charset.c, gdb.base/dump.c, gdb.base/huge.c: Include
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* This test file is part of GDB, the GNU debugger.
|
/* This test file is part of GDB, the GNU debugger.
|
||||||
|
|
||||||
Copyright 1995, 1997, 1999, 2003 Free Software Foundation, Inc.
|
Copyright 1995, 1997, 1999, 2003, 2004 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
|
@ -19,36 +19,47 @@
|
||||||
Please email any bugs, comments, and/or additions to this file to:
|
Please email any bugs, comments, and/or additions to this file to:
|
||||||
bug-gdb@prep.ai.mit.edu */
|
bug-gdb@prep.ai.mit.edu */
|
||||||
|
|
||||||
/* Often the behavior of any particular test depends upon what compiler was
|
/* Sometimes the behavior of a test depends upon the compiler used to
|
||||||
used to compile the test. As each test is compiled, this file is
|
compile the test program. A test script can call get_compiler_info
|
||||||
preprocessed by the same compiler used to compile that specific test
|
to figure out the compiler version and test_compiler_info to test it.
|
||||||
(different tests might be compiled by different compilers, particularly
|
|
||||||
if compiled at different times), and used to generate a *.ci (compiler
|
|
||||||
info) file for that test.
|
|
||||||
|
|
||||||
I.E., when callfuncs is compiled, a callfuncs.ci file will be generated,
|
get_compiler_info runs the preprocessor on this file and then eval's
|
||||||
which can then be sourced by callfuncs.exp to give callfuncs.exp access
|
the result. This sets various symbols for use by test_compiler_info.
|
||||||
to information about the compilation environment.
|
|
||||||
|
|
||||||
TODO: It might be a good idea to add expect code that tests each
|
TODO: make compiler_info a local variable for get_compiler_info and
|
||||||
definition made with 'set" to see if one already exists, and if so
|
test_compiler_info.
|
||||||
warn about conflicts if it is being set to something else. */
|
|
||||||
|
|
||||||
/* This needs to be kept in sync with whatis.c and gdb.exp(get_compiler_info).
|
TODO: all clients should use test_compiler_info and should not
|
||||||
If this ends up being hairy, we could use a common header file. */
|
use gcc_compiled, hp_cc_compiler, or hp_aCC_compiler.
|
||||||
|
|
||||||
|
TODO: purge signed_keyword_not_used. */
|
||||||
|
|
||||||
|
set compiler_info ""
|
||||||
|
|
||||||
|
#if defined (__GNUC__)
|
||||||
|
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
|
||||||
|
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 */
|
||||||
#if defined (__STDC__) || defined (_AIX)
|
#if defined (__STDC__) || defined (_AIX)
|
||||||
set signed_keyword_not_used 0
|
set signed_keyword_not_used 0
|
||||||
#else
|
#else
|
||||||
set signed_keyword_not_used 1
|
set signed_keyword_not_used 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined (__GNUC__)
|
|
||||||
set gcc_compiled __GNUC__
|
|
||||||
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
|
|
||||||
#else
|
|
||||||
set gcc_compiled 0
|
|
||||||
set compiler_info ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
|
@ -19,27 +19,35 @@
|
||||||
Please email any bugs, comments, and/or additions to this file to:
|
Please email any bugs, comments, and/or additions to this file to:
|
||||||
bug-gdb@prep.ai.mit.edu */
|
bug-gdb@prep.ai.mit.edu */
|
||||||
|
|
||||||
/* Often the behavior of any particular test depends upon what compiler was
|
/* This file is exactly like compiler.c. I could just use compiler.c if
|
||||||
used to compile the test. As each test is compiled, this file is
|
I could be sure that every C++ compiler accepted extensions of ".c". */
|
||||||
preprocessed by the same compiler used to compile that specific test
|
|
||||||
(different tests might be compiled by different compilers, particularly
|
|
||||||
if compiled at different times), and used to generate a *.ci (compiler
|
|
||||||
info) file for that test.
|
|
||||||
|
|
||||||
I.E., when callfuncs is compiled, a callfuncs.ci file will be generated,
|
set compiler_info ""
|
||||||
which can then be sourced by callfuncs.exp to give callfuncs.exp access
|
|
||||||
to information about the compilation environment.
|
|
||||||
|
|
||||||
TODO: It might be a good idea to add expect code that tests each
|
|
||||||
definition made with 'set" to see if one already exists, and if so
|
|
||||||
warn about conflicts if it is being set to something else. */
|
|
||||||
|
|
||||||
#if defined (__GNUC__)
|
#if defined (__GNUC__)
|
||||||
set gcc_compiled __GNUC__
|
|
||||||
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
|
set compiler_info [join {gcc __GNUC__ __GNUC_MINOR__ } -]
|
||||||
|
set gcc_compiled __GNUC__
|
||||||
#else
|
#else
|
||||||
set gcc_compiled 0
|
set gcc_compiled 0
|
||||||
set compiler_info ""
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0
|
#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 */
|
||||||
|
#if defined (__STDC__) || defined (_AIX)
|
||||||
|
set signed_keyword_not_used 0
|
||||||
|
#else
|
||||||
|
set signed_keyword_not_used 1
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||||
# 2002, 2003
|
# 2002, 2003, 2004
|
||||||
# Free Software Foundation, Inc.
|
# Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -1094,86 +1094,114 @@ proc skip_hp_tests {} {
|
||||||
return $skip_hp
|
return $skip_hp
|
||||||
}
|
}
|
||||||
|
|
||||||
global compiler_info
|
set compiler_info "unknown"
|
||||||
set compiler_info unknown
|
set gcc_compiled 0
|
||||||
|
set hp_cc_compiler 0
|
||||||
|
set hp_aCC_compiler 0
|
||||||
|
set signed_keyword_not_used 0
|
||||||
|
|
||||||
|
# Figure out what compiler I am using.
|
||||||
|
#
|
||||||
|
# BINFILE is a "compiler information" output file. This implementation
|
||||||
|
# does not use BINFILE.
|
||||||
|
#
|
||||||
|
# ARGS can be empty or "C++". If empty, "C" is assumed.
|
||||||
|
#
|
||||||
|
# There are several ways to do this, with various problems.
|
||||||
|
#
|
||||||
|
# [ gdb_compile -E $ifile -o $binfile.ci ]
|
||||||
|
# source $binfile.ci
|
||||||
|
#
|
||||||
|
# Single Unix Spec v3 says that "-E -o ..." together are not
|
||||||
|
# specified. And in fact, the native compiler on hp-ux 11 (among
|
||||||
|
# others) does not work with "-E -o ...". Most targets used to do
|
||||||
|
# this, and it mostly worked, because it works with gcc.
|
||||||
|
#
|
||||||
|
# [ catch "exec $compiler -E $ifile > $binfile.ci" exec_output ]
|
||||||
|
# source $binfile.ci
|
||||||
|
#
|
||||||
|
# This avoids the problem with -E and -o together. This almost works
|
||||||
|
# if the build machine is the same as the host machine, which is
|
||||||
|
# usually true of the targets which are not gcc. But this code does
|
||||||
|
# not figure which compiler to call, and it always ends up using the C
|
||||||
|
# compiler. Not good for setting hp_aCC_compiler. Targets
|
||||||
|
# hppa*-*-hpux* and mips*-*-irix* used to do this.
|
||||||
|
#
|
||||||
|
# [ gdb_compile -E $ifile > $binfile.ci ]
|
||||||
|
# source $binfile.ci
|
||||||
|
#
|
||||||
|
# dejagnu target_compile says that it supports output redirection,
|
||||||
|
# but the code is completely different from the normal path and I
|
||||||
|
# don't want to sweep the mines from that path. So I didn't even try
|
||||||
|
# this.
|
||||||
|
#
|
||||||
|
# set cppout [ gdb_compile $ifile "" preprocess $args quiet ]
|
||||||
|
# eval $cppout
|
||||||
|
#
|
||||||
|
# I actually do this for all targets now. gdb_compile runs the right
|
||||||
|
# compiler, and TCL captures the output, and I eval the output.
|
||||||
|
#
|
||||||
|
# Unfortunately, expect logs the output of the command as it goes by,
|
||||||
|
# and dejagnu helpfully prints a second copy of it right afterwards.
|
||||||
|
# So I turn off expect logging for a moment.
|
||||||
|
#
|
||||||
|
# [ gdb_compile $ifile $ciexe_file executable $args ]
|
||||||
|
# [ remote_exec $ciexe_file ]
|
||||||
|
# [ source $ci_file.out ]
|
||||||
|
#
|
||||||
|
# I could give up on -E and just do this.
|
||||||
|
# I didn't get desperate enough to try this.
|
||||||
|
#
|
||||||
|
# -- chastain 2004-01-06
|
||||||
|
|
||||||
proc get_compiler_info {binfile args} {
|
proc get_compiler_info {binfile args} {
|
||||||
# Create and source the file that provides information about the compiler
|
# For compiler.c and compiler.cc
|
||||||
# used to compile the test case.
|
|
||||||
# Compiler_type can be null or c++. If null we assume c.
|
|
||||||
global srcdir
|
global srcdir
|
||||||
global subdir
|
|
||||||
# These two come from compiler.c.
|
# I am going to play with the log to keep noise out.
|
||||||
global signed_keyword_not_used
|
global outdir
|
||||||
global gcc_compiled
|
global tool
|
||||||
|
|
||||||
|
# These come from compiler.c or compiler.cc
|
||||||
global compiler_info
|
global compiler_info
|
||||||
|
global gcc_compiled
|
||||||
|
global hp_cc_compiler
|
||||||
|
global hp_aCC_compiler
|
||||||
|
global signed_keyword_not_used
|
||||||
|
|
||||||
if {![istarget "hppa*-*-hpux*"] && ![istarget "mips*-*-irix*"]} {
|
# Choose which file to preprocess.
|
||||||
if { [llength $args] > 0 } {
|
set ifile "${srcdir}/lib/compiler.c"
|
||||||
if {$args == "c++"} {
|
if { [llength $args] > 0 && [lindex $args 0] == "c++" } {
|
||||||
if { [gdb_compile "${srcdir}/lib/compiler.cc" "${binfile}.ci" preprocess {}] != "" } {
|
set ifile "${srcdir}/lib/compiler.cc"
|
||||||
perror "Couldn't make ${binfile}.ci file"
|
}
|
||||||
return 1;
|
|
||||||
}
|
# Run $ifile through the right preprocessor.
|
||||||
}
|
# Toggle gdb.log to keep the compiler output out of the log.
|
||||||
} else {
|
log_file
|
||||||
if { [gdb_compile "${srcdir}/lib/compiler.c" "${binfile}.ci" preprocess {}] != "" } {
|
set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ]
|
||||||
perror "Couldn't make ${binfile}.ci file"
|
log_file -a "$outdir/$tool.log"
|
||||||
return 1;
|
|
||||||
}
|
# Source the output.
|
||||||
}
|
foreach cppline [ split "$cppout" "\n" ] {
|
||||||
} else {
|
if { ! [ regexp "^#" "$cppline" ] } {
|
||||||
if { [llength $args] > 0 } {
|
if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } {
|
||||||
if {$args == "c++"} {
|
verbose "get_compiler_info: $cppline" 2
|
||||||
if { [eval gdb_preprocess \
|
eval "$cppline"
|
||||||
[list "${srcdir}/lib/compiler.cc" "${binfile}.ci"] \
|
|
||||||
$args] != "" } {
|
|
||||||
perror "Couldn't make ${binfile}.ci file"
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif { $args != "f77" } {
|
|
||||||
if { [eval gdb_preprocess \
|
|
||||||
[list "${srcdir}/lib/compiler.c" "${binfile}.ci"] \
|
|
||||||
$args] != "" } {
|
|
||||||
perror "Couldn't make ${binfile}.ci file"
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
verbose -log "get_compiler_info: $compiler_info"
|
||||||
uplevel \#0 { set gcc_compiled 0 }
|
|
||||||
|
|
||||||
if { [llength $args] == 0 || $args != "f77" } {
|
|
||||||
source ${binfile}.ci
|
|
||||||
}
|
|
||||||
|
|
||||||
# Most compilers will evaluate comparisons and other boolean
|
# Most compilers will evaluate comparisons and other boolean
|
||||||
# operations to 0 or 1.
|
# operations to 0 or 1.
|
||||||
uplevel \#0 { set true 1 }
|
uplevel \#0 { set true 1 }
|
||||||
uplevel \#0 { set false 0 }
|
uplevel \#0 { set false 0 }
|
||||||
|
|
||||||
uplevel \#0 { set hp_cc_compiler 0 }
|
# Use of aCC results in boolean results being displayed as
|
||||||
uplevel \#0 { set hp_aCC_compiler 0 }
|
# "true" or "false"
|
||||||
uplevel \#0 { set hp_f77_compiler 0 }
|
if { $hp_aCC_compiler } {
|
||||||
uplevel \#0 { set hp_f90_compiler 0 }
|
uplevel \#0 { set true true }
|
||||||
if { !$gcc_compiled && [istarget "hppa*-*-hpux*"] } {
|
uplevel \#0 { set false false }
|
||||||
# Check for the HP compilers
|
|
||||||
set compiler [lindex [split [get_compiler $args] " "] 0]
|
|
||||||
catch "exec what $compiler" output
|
|
||||||
if [regexp ".*HP aC\\+\\+.*" $output] {
|
|
||||||
uplevel \#0 { set hp_aCC_compiler 1 }
|
|
||||||
# Use of aCC results in boolean results being displayed as
|
|
||||||
# "true" or "false"
|
|
||||||
uplevel \#0 { set true true }
|
|
||||||
uplevel \#0 { set false false }
|
|
||||||
} elseif [regexp ".*HP C Compiler.*" $output] {
|
|
||||||
uplevel \#0 { set hp_cc_compiler 1 }
|
|
||||||
} elseif [regexp ".*HP-UX f77.*" $output] {
|
|
||||||
uplevel \#0 { set hp_f77_compiler 1 }
|
|
||||||
} elseif [regexp ".*HP-UX f90.*" $output] {
|
|
||||||
uplevel \#0 { set hp_f90_compiler 1 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1184,85 +1212,6 @@ proc test_compiler_info { compiler } {
|
||||||
return [string match $compiler $compiler_info]
|
return [string match $compiler $compiler_info]
|
||||||
}
|
}
|
||||||
|
|
||||||
proc get_compiler {args} {
|
|
||||||
global CC CC_FOR_TARGET CXX CXX_FOR_TARGET F77_FOR_TARGET
|
|
||||||
|
|
||||||
if { [llength $args] == 0
|
|
||||||
|| ([llength $args] == 1 && [lindex $args 0] == "") } {
|
|
||||||
set which_compiler "c"
|
|
||||||
} else {
|
|
||||||
if { $args =="c++" } {
|
|
||||||
set which_compiler "c++"
|
|
||||||
} elseif { $args =="f77" } {
|
|
||||||
set which_compiler "f77"
|
|
||||||
} else {
|
|
||||||
perror "Unknown compiler type supplied to gdb_preprocess"
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if [info exists CC_FOR_TARGET] {
|
|
||||||
if {$which_compiler == "c"} {
|
|
||||||
set compiler $CC_FOR_TARGET
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if [info exists CXX_FOR_TARGET] {
|
|
||||||
if {$which_compiler == "c++"} {
|
|
||||||
set compiler $CXX_FOR_TARGET
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if [info exists F77_FOR_TARGET] {
|
|
||||||
if {$which_compiler == "f77"} {
|
|
||||||
set compiler $F77_FOR_TARGET
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if { ![info exists compiler] } {
|
|
||||||
if { $which_compiler == "c" } {
|
|
||||||
if {[info exists CC]} {
|
|
||||||
set compiler $CC
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if { $which_compiler == "c++" } {
|
|
||||||
if {[info exists CXX]} {
|
|
||||||
set compiler $CXX
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if {![info exists compiler]} {
|
|
||||||
set compiler [board_info [target_info name] compiler];
|
|
||||||
if { $compiler == "" } {
|
|
||||||
perror "get_compiler: No compiler found"
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $compiler
|
|
||||||
}
|
|
||||||
|
|
||||||
proc gdb_preprocess {source dest args} {
|
|
||||||
set compiler [get_compiler "$args"]
|
|
||||||
if { $compiler == "" } {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
set cmdline "$compiler -E $source > $dest"
|
|
||||||
|
|
||||||
verbose "Invoking $compiler -E $source > $dest"
|
|
||||||
verbose -log "Executing on local host: $cmdline" 2
|
|
||||||
set status [catch "exec ${cmdline}" exec_output]
|
|
||||||
|
|
||||||
set result [prune_warnings $exec_output]
|
|
||||||
regsub "\[\r\n\]*$" "$result" "" result;
|
|
||||||
regsub "^\[\r\n\]*" "$result" "" result;
|
|
||||||
if { $result != "" } {
|
|
||||||
clone_output "gdb compile failed, $result"
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
|
|
||||||
set gdb_wrapper_initialized 0
|
set gdb_wrapper_initialized 0
|
||||||
|
|
||||||
proc gdb_wrapper_init { args } {
|
proc gdb_wrapper_init { args } {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue