Re: docs: confusing gimple "Statement and operand traversals"
Andrea Pinski via Gcc <[email protected]>
| Newsgroups | gmane.comp.gcc.devel |
|---|---|
| Message-ID | <CALvbMcCRHRhwps+2k+JiCu7PrcsZMRrUJmwdSfLb6Xsee=aaJg@mail.gmail.com> |
On Mon, Aug 24, 2026 at 4:46 AM Georg-Johann Lay via Gcc <[email protected]> wrote: > > https://gcc.gnu.org/onlinedocs/gccint/Statement-and-operand-traversals.html > > has: > > tree walk_gimple_op (gimple stmt, walk_tree_fn callback_op, struct > walk_stmt_info *wi) > > but according to gimple-walk.h, the 1st arg is of type gimple*. Looks like the documentation was not updated after r6-3402-g355fe0884b8097 which changed the name of the struct from gimple_statement_base to gimple and then removed the typedef and added the `*` everywhere. > > Moreover: > > tree walk_gimple_seq (gimple_seq seq, walk_stmt_fn callback_stmt, > walk_tree_fn callback_op, struct walk_stmt_info *wi) > > This function walks all the statements in the sequence SEQ calling > walk_gimple_stmt on each one. [...] If walk_gimple_stmt returns non- > NULL, the walk is stopped and the value returned. [...] > > - According to gimple-walk.h, the return value of walk_gimple_seq > is gimple* and not tree. > > - The return value of walk_gimple_stmt is of type tree, and it is > unclear how that is mapped to the return value of walk_gimple_seq > which is gimple*. And it looks like the documentation there was not updated way back in 2008 by r0-88576-g726a989a8b74bf for the change to tuples. So in this case walk_stmt_info's callback_result will contain the return value of walk_gimple_stmt. But the return value is either the gimple stmt where the non-null walk_gimple_stmt returned a non-null result or NULL if walk_stmt_info's removed_stmt was set (removed_stmt will be unset still). callback_result will be non null in the case of the removed_stmt case. > > Johann >