This is the mail archive of the gcc-patches@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: [PATCH] Pretty-printing of some unsupported expressions (PR c/35441)


On Fri, 10 Mar 2017, Volker Reichelt wrote:

> a) This part (with foo1 and foo2 from the testcase) is straightforward.

That part is OK.

> b) I chose the shift operators 'a << b' and 'a >> b' for the rotate
>    expressions, which is not 100% correct. Would it be better to use
>    something like 'lrotate(a, b)', '__lrotate__(a, b)' or 'a lrotate b'
>    instead? Or is there something like an '__builtin_lrotate' that I misseed?

I'd be inclined to use the notation <<< and >>> for rotation, cf. 
<https://stackoverflow.com/questions/32785998/symbol-for-bitwise-circular-shifts>.

> c) I chose 'max(q, b)' and 'min(q, b)'.

I think that's fine.

> In addition I found some more division operators in gcc/tree.def that
> aren't handled by the pretty-printer:
> 
>   CEIL_DIV_EXPR
>   FLOOR_DIV_EXPR
>   ROUND_DIV_EXPR
>   CEIL_MOD_EXPR
>   FLOOR_MOD_EXPR
>   ROUND_MOD_EXPR
> 
> Alas I don't have testcases for them. Nevertheless, I could handle them
> like the other MOD and DIV operators just to be safe.

These can probably appear from Ada code, but maybe not from C.

Now we have caret diagnostics and location ranges I think we should be 
moving away from printing complicated expressions from trees anyway.  So 
for the diagnostics about calling non-functions, it would be best to make 
a location range for the called expression available if it isn't already, 
then do a diagnostic with a location that underlines that text rather than 
trying to reproduce an expression text from trees.

-- 
Joseph S. Myers
joseph@codesourcery.com


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