Review Request: Parser support for C99 designated initializers
Alexandre Courbot
gnurou at gmail.com
Tue Apr 10 06:17:24 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/103448/
-----------------------------------------------------------
(Updated April 10, 2012, 6:17 a.m.)
Review request for KDevelop and Milian Wolff.
Changes
-------
New version of the patch with the following changes:
- Do not reorder statements in parserInitializerClause (as suggested by Milian)
- Parse the right part as a const instead of a comma expression (cause of infinite loop for some cases)
So now this patch do not change any existing behavior, only introduces a new one. This should make it safer. Parsing is done correctly 99% of the time, but the case of designated arrays initializers still need some work: in the new test introduced, the following array is not correctly parsed:
int ia[10] = {
[1] = 10,
[2] = 2,
};
Reordering the statements allows it to pass, but creates an infinite loop issue, so it is safer as-is for now. It should be safe to merge it in its current state, keeping in mind that some more work is necessary for the array case.
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,
};
Diffs (updated)
-----
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/20120410/5d8dc079/attachment.html>
More information about the KDevelop-devel
mailing list