This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C-frontend NOP_EXPR help
- From: Ian Lance Taylor <iant at google dot com>
- To: Markus Lottmann <lottvomschlott at gmx dot de>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 11 Mar 2011 08:13:04 -0800
- Subject: Re: C-frontend NOP_EXPR help
- References: <4D7A3C76.7000509@gmx.de>
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