From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16209 invoked by alias); 5 Feb 2004 12:34:40 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 16202 invoked from network); 5 Feb 2004 12:34:39 -0000 Received: from unknown (HELO smtp10.atl.mindspring.net) (207.69.200.246) by sources.redhat.com with SMTP; 5 Feb 2004 12:34:39 -0000 Received: from user-119a90a.biz.mindspring.com ([66.149.36.10] helo=berman.michael-chastain.com) by smtp10.atl.mindspring.net with esmtp (Exim 3.33 #1) id 1AoiiL-0007EN-00; Thu, 05 Feb 2004 07:34:37 -0500 Received: by berman.michael-chastain.com (Postfix, from userid 502) id 184BC4B364; Thu, 5 Feb 2004 07:34:48 -0500 (EST) To: brobecker@gnat.com, gdb-patches@sources.redhat.com Subject: more robust get_compiler_info Message-Id: <20040205123448.184BC4B364@berman.michael-chastain.com> Date: Thu, 05 Feb 2004 12:34:00 -0000 From: mec.gnu@mindspring.com (Michael Elizabeth Chastain) X-SW-Source: 2004-02/txt/msg00096.txt.bz2 Joel, can you try this patch? It works for me on native i686-pc-linux-gnu and native hppa2.0w-hp-hpux11.11. I also gaffed my hpux machine so that the test suite finds a C compiler but not a C++ compiler, to exercise the "unknown" path. That works too. If you don't have any problems with this patch, then I will submit it in a day or two. Michael C 2004-02-05 Michael Chastain * lib/gdb.exp (get_compiler_info): Eval lines only if they are 'set' commands. Log diagnostics for other lines. Index: gdb.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v retrieving revision 1.45 diff -c -3 -p -r1.45 gdb.exp *** gdb.exp 2 Feb 2004 21:14:33 -0000 1.45 --- gdb.exp 5 Feb 2004 09:25:04 -0000 *************** proc get_compiler_info {binfile args} { *** 1186,1200 **** set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ] log_file -a "$outdir/$tool.log" ! # Source the output. foreach cppline [ split "$cppout" "\n" ] { ! if { ! [ regexp "^#" "$cppline" ] } { ! if { ! [ regexp "^\[\n\r\t \]*$" "$cppline" ] } { ! verbose "get_compiler_info: $cppline" 2 ! eval "$cppline" ! } } } verbose -log "get_compiler_info: $compiler_info" # Most compilers will evaluate comparisons and other boolean --- 1186,1219 ---- set cppout [ gdb_compile "${ifile}" "" preprocess [list "$args" quiet] ] log_file -a "$outdir/$tool.log" ! # Eval the output. ! set unknown 0 foreach cppline [ split "$cppout" "\n" ] { ! 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 gcc_compiled 0 + set hp_cc_compiler 0 + set hp_ACC_compiler 0 + set signed_keyword_not_used 0 + } + + # Log what happened. verbose -log "get_compiler_info: $compiler_info" # Most compilers will evaluate comparisons and other boolean