Review Request: Parser support for C99 designated initializers

Milian Wolff mail at milianw.de
Sun Apr 15 21:18:00 UTC 2012



> On April 15, 2012, 11:42 a.m., Milian Wolff wrote:
> > languages/cpp/parser/parser.cpp, line 2869
> > <http://git.reviewboard.kde.org/r/103448/diff/4/?file=56665#file56665line2869>
> >
> >     please don't use goto, just copy the rewind + return clause here
> >     
> >     though actually there is afaiks even a macro defined that checks the lookahead + returns on error
> 
> Alexandre Courbot wrote:
>     The macro would be CHECK I guess, but it does not rewind and automatically advances on success, which is not always what I need here.
>     
>     About the gotos: you might not have spotted them, but there are 3 more of them in this function. Their purpose is to avoid duplicating common error-handling code by having it after the error-free return of the function. What is wrong with them, especially here? They are actually useful. And this is not the only place where they are used in the parser.

Yes, there are other places that use goto and they should be removed as well imo. Better introduce a new macro or function that does this, then using goto which we try to avoid.


- Milian


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103448/#review12463
-----------------------------------------------------------


On April 15, 2012, 7:20 a.m., Alexandre Courbot wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/103448/
> -----------------------------------------------------------
> 
> (Updated April 15, 2012, 7:20 a.m.)
> 
> 
> Review request for KDevelop and Milian Wolff.
> 
> 
> Description
> -------
> 
> Parser support for C99 designated initializers
> 
> Support C99 initializers in the C++ parser, e.g:
> 
> struct foo_t foo = {
>   .has_cake = true,
>   .nb_candles = 12,
> };
> 
> int bar[10] = {
>   [1] = 15,
>   [9] = 25,
> };
> 
> REVIEW: 103448
> 
> 
> Diffs
> -----
> 
>   languages/cpp/parser/parser.h 64b5c505866ac2a0ed847aa67e4c7809df3af6b5 
>   languages/cpp/parser/parser.cpp a45ee31a1207d56efef292babb2e774b51378ead 
>   languages/cpp/parser/tests/test_parser.h 2869d9ddae2632aced2f2e2fa966382da3a0082d 
>   languages/cpp/parser/tests/test_parser.cpp 94e3ee06dc9187568c000dcdd8baf8d87d1d06e6 
> 
> Diff: http://git.reviewboard.kde.org/r/103448/diff/
> 
> 
> Testing
> -------
> 
> Used it for a couple of weeks, ensured the parser tests all pass.
> 
> 
> Thanks,
> 
> Alexandre Courbot
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120415/a6ef0a61/attachment.html>


More information about the KDevelop-devel mailing list