On 29/01/16 17:01, Prathamesh Kulkarni wrote:
Thanks for the review. AFAIK the type-qualifiers would be const,
restrict, volatile and _Atomic (n1570 p 6.7.3) ?
I added a check for those and for variable length array.
I am having issues with writing the test-case,
some cases pass with -std=c++11 but fail with -std=c++98.
Could you please have a look ?
Is there _Atomic in C++?
Also, why not simply reuse cp_parser_cv_qualifier_seq_opt (cp_parser* parser),
perhaps adding a complain parameter that defaults to tf_error and calling it
here with tf_none.
I think you will get nicer errors if you don't set bounds to error-mark, just
give the error, consume the tokens and continue as usual.
Ideally, smart error-recovery should only be done when things already go wrong,
thus after
bounds = cp_parser_constant_expression (parser,
/*allow_non_constant=*/true,
&non_constant_p);
if (!non_constant_p)
/* OK */;
fails, however our C++ parser tends to give errors quite deep in the stack
instead of letting the caller decide what to do, which makes this too noisy in
this case. Nonetheless, moving this error-recovery within:
if (token->type != CPP_CLOSE_SQUARE) { }
but before the above can only make the parser (marginally) faster for correct
code.
Cheers,
Manuel.