This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Call get_compiler_info before test_compiler_info. (was: Re: [PATCH] Call get_compiler_info directly from test_compiler_info if needed.)


On 10/12/2013 3:49 PM, Pedro Alves wrote:
> On 12/10/2013 03:16 PM, Andrew Burgess wrote:
>> On 10/12/2013 3:00 PM, Pedro Alves wrote:
> 
>> @@ -2027,10 +2027,6 @@ gdb_caching_proc skip_altivec_tests {
>>
>>      # Make sure we have a compiler that understands altivec.
>>      set compile_flags {debug nowarnings}
>> -    if [get_compiler_info] {
>> -       warning "Could not get compiler info"
>> -       return 1
>> -    }
>>      if [test_compiler_info gcc*] {
>>          set compile_flags "$compile_flags additional_flags=-maltivec"
>>      } elseif [test_compiler_info xlc*] {
> 
> Before, the removed get_compiler_info would always overwrite
> whatever was in the compiler_info before.  Now, if the previous
> call to get_compiler_info happened to get an $arg,
> test_compiler_info will now reuse the wrong compiler_info.

OK, I see.  Here's a simpler solution that just adds the missing
call to get_compiler_info.

The example I found where this is an issue was: gdb.trace/pending.exp,
which pre-patch fails to build for me (when I run just that test), but
after the patch does run.  There are probably other examples around.

OK to apply?

Thanks,
Andrew

    gdb/testsuite/ChangeLog
    
    	* lib/gdb.exp (gdb_compile_shlib): Call get_compiler_info before
    	calling test_compiler_info.

diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 2c1cf29..eddfb9d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -2812,6 +2812,14 @@ proc gdb_compile_pthreads {source dest type options} {
 proc gdb_compile_shlib {sources dest options} {
     set obj_options $options
 
+    set info_options ""
+    if { [lsearch -exact $options "c++"] >= 0 } {
+	set info_options "c++"
+    }
+    if [get_compiler_info ${info_options}] {
+       return -1
+    }
+
     switch -glob [test_compiler_info] {
         "xlc-*" {
             lappend obj_options "additional_flags=-qpic"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]