]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/ada-lang.c
avoid "if ... else if ... else" logic in ada-lang.c::ada_evaluate_subexp
authorJoel Brobecker <brobecker@adacore.com>
Thu, 14 Aug 2014 20:36:24 +0000 (13:36 -0700)
committerJoel Brobecker <brobecker@adacore.com>
Mon, 18 Aug 2014 15:09:33 +0000 (17:09 +0200)
commitda5c522f5be478d020c14038ace2ba2ee2b9e032
tree57f31c2f61bf4dea0ed37f3626751a1185e62a20
parent0d72a7c318b83384973583323f8c7d54bf1bbffa
avoid "if ... else if ... else" logic in ada-lang.c::ada_evaluate_subexp

The OP_VAR_VALUE branch in ada_evaluate_subexp is written with
multiple "if ... else if ... else if ... else ..." block. But
in practice, these blocks  all either goto out of that block of
code, or return.

This patch rewrites this code slightly by replacing the "else if"-s
by simple "if"s. This should better reflect the ideal processing
where we try to do a standard eval whenever possible, and only
do something else when the standard eval does not work. On a pratical
level, this patch makes it easier to fall through to the default
processing when none of the special situations are detected, thus
making it easier to add more handlers of those special situations;
or to remove them as they no longer become necessary!

gdb/ChangeLog:

        * ada-lang.c (ada_evaluate_subexp) <OP_VAR_VALUE>: Slight code
        rewrite to avoid "else if" and "else" constructs.  Should be
        a no-op in practice.
gdb/ChangeLog
gdb/ada-lang.c