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]

Re: [PATCH] Use gdb_produce_source


>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> 2013-11-28  Yao Qi  <yao@codesourcery.com>
Yao> 	* lib/gdb.exp (support_complex_tests): Use gdb_produce_source.
Yao> 	(is_elf_target, is_ilp32_target, is_ilp64_target): Likewise.
Yao> 	(is_64_target, is_amd64_regs_target): Likewise.
Yao> 	(skip_altivec_tests, skip_vsx_tests, skip_btrace_tests): Likewise.

Ok.

Yao> -    set f [open $src "w"]
Yao> -    puts $f "int main() {"
Yao> -    puts $f "_Complex float cf;"
Yao> -    puts $f "_Complex double cd;"
Yao> -    puts $f "_Complex long double cld;"
Yao> -    puts $f "  return 0; }"
Yao> -    close $f
Yao> +    set list {
Yao> +	"int main() {"
Yao> +	"_Complex float cf;"
Yao> +	"_Complex double cd;"
Yao> +	"_Complex long double cld;"
Yao> +	"  return 0; }"
Yao> +    }
Yao> +    gdb_produce_source $src [join $list \n]

There's a more idiomatic approach, which is to just take advantage of
Tcl's string-based nature.  That is:

gdb_produce_source $src {
  int main() {
    _Complex float cf;
    ...
  }
}

Tom


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