Review Request: __attribute__((...)) parsing fixed with MinGW headers
Milian Wolff
mail at milianw.de
Thu May 3 08:29:10 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104805/#review13311
-----------------------------------------------------------
hm considering that __attribute__ is not part of the standard anyways, removing it from our parser and workarounding it with such an empty macro sounds fine to me.
please add a unit test in cpp/tests/test_cppcodecompletion.cpp (ignore the file name...). there you have e.g. testPreprocessor() which shows you how to test this, e.g. by assuring
a)
#ifdef __attribute__
#define FOO 1
#else
#define FOO 0
#endif
FOO
=> preprocessed == 1
b)
#undef __attribute__
__attribute__(1)
=> preprocessed == "" (empty)
- Milian Wolff
On May 1, 2012, 11:36 a.m., Ivan Shapovalov wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104805/
> -----------------------------------------------------------
>
> (Updated May 1, 2012, 11:36 a.m.)
>
>
> Review request for KDevelop.
>
>
> Description
> -------
>
> MinGW system headers tend to undefine __attribute__ (which is internally defined to no-op in the KDevelop preprocessor since C++ parser cannot handle it correctly in all cases).
>
> Patch just adds "fixed" property to the definition.
> Also, removed from parser some dead code related to __attribute__ parsing, since it handles only one case from possibly infinite number of these.
>
>
> Diffs
> -----
>
> languages/cpp/parser/lexer.cpp d097710
> languages/cpp/parser/parser.cpp 172b6b6
> languages/cpp/parser/tokens.h 77ab417
> languages/cpp/parser/tokens.cpp 7df4bb9
> languages/cpp/setuphelpers.cpp 59bb850
>
> Diff: http://git.reviewboard.kde.org/r/104805/diff/
>
>
> Testing
> -------
>
> Used it with MinGW and normal system headers, no regressions detected. Unit-tests are passed.
>
> BTW: I couldn't find out how to use the standard preprocessing environment (which has been modified) in preprocessor unit-tests, so no unit-tests added.
>
>
> Thanks,
>
> Ivan Shapovalov
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20120503/244f611a/attachment.html>
More information about the KDevelop-devel
mailing list