[PATCH] cppduchain: Understand C-style use of struct in declarations

Nicolai Hähnle nhaehnle at gmail.com
Wed Sep 2 21:34:04 UTC 2009


Am Monday 31 August 2009 13:23:52 schrieb David Nolden:
> Am Sonntag 30 August 2009 18:24:47 schrieb Nicolai Hähnle:
> > Currently, KDevelop does not fully understand the following C-style code:
> >
> > void foo(struct bar * p)
> > {
> >   struct baz * q;
> >   ...
> > }
<snip>
>
> I guess your fix is correct. But I think this already worked at some point,
> which makes clear that this needs a unit-test, to verify that the patch
> works, and that it stays working.
>
> See kdevelop/languages/cpp/cppduchain/tests/test_duchain.cpp, the test
> could be another compound statement within testDeclareStruct. Can you
> create such a test?

Okay, see the attached patch. First one adds a test-case, the second is just a 
resend of my earlier patch.

For the test-case, I am mostly relying on checking that the number of uses of 
the struct and its member are correct. From what I understand, this should 
ensure that the types are assigned correctly.

cu,
Nicolai
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cppduchain-Add-test-for-C-style-struct-usage.patch
Type: text/x-patch
Size: 2483 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090902/e4a006fd/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-c-support-correctly-identify-use-of-types-in-C-st.patch
Type: text/x-patch
Size: 2134 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090902/e4a006fd/attachment-0001.patch>


More information about the KDevelop-devel mailing list