This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC 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: C-frontend NOP_EXPR help


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


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