C-frontend NOP_EXPR help

Ian Lance Taylor iant@google.com
Fri Mar 11 16:13:00 GMT 2011


Markus Lottmann <lottvomschlott@gmx.de> writes:

> That works so far but not for empty do-loops with an always false condition:
>     do {
>
>     } while(0);
>
> In this case in c-typeck.c:c_finish_loop() nothing is added to the
> frontend internal tree.
> My question is: Is it possible to add a NOP_EXPR, which has no further
> children, to the current
> statement list. If yes how?

Just do something like
    add_stmt (build1 (NOP_EXPR, void_type_node, integer_zero_node));
See many existing examples.

Ian



More information about the Gcc-help mailing list