[PATCH] Add support for unroll pragma

Aaron Ballman aaron.ballman at gmail.com
Wed Jul 9 11:16:59 PDT 2014


On Wed, Jul 9, 2014 at 1:53 PM, Mark Heffernan <meheff at google.com> wrote:
> On Wed, Jul 9, 2014 at 7:42 AM, Aaron Ballman <aaron.ballman at gmail.com> wrote:
>> I wonder how horrible it would be to simply canonicalize based on
>> compiler options when pretty printing, and skip this field entirely.
>> Eg) when CUDA is on, pretty print does not emit the parens. When CUDA
>> mode is off, it does emit the parens. Yes, this isn't *exactly* what
>> the user wrote, but the semantics are identical either way.
>
> It would be nice to get rid of the ValueInParens ugliness.  One idea
> might be to consider the form with parentheses an error when compiling
> for cuda and the form without parentheses an error when compiling for
> !cuda.  Then the parentheses can be emitted based only on whether cuda
> mode is enabled and we don't have to worry about the pragmas being
> silently transformed from one form to the other when printing out the
> ast.

That would work, but it would be at the expense of the user's
experience (and some compatibility with other compilers). I guess my
question really boils down to whether pretty printing is important
enough to warrant this sort of hackiness, and I don't think it is (we
have other, existing pretty printing issues which I think are of
higher priority). Richard, do you have thoughts or ideas?

~Aaron



More information about the cfe-commits mailing list