rewrite ada_val_print_ref to reduce if/else block nesting depth
authorJoel Brobecker <brobecker@adacore.com>
Thu, 19 Dec 2013 15:26:27 +0000 (19:26 +0400)
committerJoel Brobecker <brobecker@adacore.com>
Tue, 7 Jan 2014 04:17:39 +0000 (08:17 +0400)
commit34b27950541eaf717bd02b31d460bab2edfbbbe6
treeba0ea5512f7d26347e3b2c6554115f993b2803b2
parent079e459161edae487c667a7f976a6462957389ef
rewrite ada_val_print_ref to reduce if/else block nesting depth

The logic as currently implemented in this function was a little
difficult to follow, due to the nested of if/else conditions,
but most of the time, the "else" block was very simple. So this
patch re-organizes the code to use fewer levels of nesting by
using return statements, and writing the code as a sequence of
"if something simple, then handle it and return" blocks.

While touching this code, this patch changes the cryptic "???"
printed when trying to print a reference pointing to an undefined
type. This should only ever happen if the debugging information
was corrupted or improperly read. But in case that happens, we now
print "<ref to undefined type>" instead. This is more in line
with how we print other conditions such as optimized out pieces,
or synthetic pointers.

gdb/ChangeLog:

        * ada-valprint.c (ada_val_print_ref): Rewrite by mostly
        re-organizing the code. Change the "???" message printed
        when target type is a TYPE_CODE_UNDEF into
        "<ref to undefined type>".
gdb/ChangeLog
gdb/ada-valprint.c
This page took 0.024586 seconds and 4 git commands to generate.