Skip to content

Fixed issue #1289 - #41

Merged
hschlichter merged 3 commits into
masterfrom
fixes/fix-for-bad-tokenization-of-double-pointers
Dec 4, 2017
Merged

hschlichter merged 3 commits into
masterfrom
fixes/fix-for-bad-tokenization-of-double-pointers

Conversation

@KalyanaChakravarthi

Copy link
Copy Markdown

Fixed issue of bad tokenization of double pointers

Fixed issue of bad tokenization of double pointers

@hschlichter hschlichter left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't at all solve the "bad tokenization of double pointers" issue.

As far as we can see, the reason why the travis and appveyor tests are green is because it ignores the function prototypes that have the __declspec. Which is super specific and wrong.

Furthermore, this causes major regressions in our code base, because the default behavior is changing in a dramatic way.

In a meeting some weeks ago, we talked about how to solve this. Currently uncrustify doesn't know enough about the type information when parsing function prototypes. This could be solved by running through the parsing a second time. We take this approach in several places. If you have any doubts about to actually fix this issue, reach out to us on #devs-uncrustify so we can talk about the solution.

Comment thread src/keywords.cpp Outdated
{ "__attribute__", CT_ATTRIBUTE, LANG_C | LANG_CPP },
{ "__block", CT_QUALIFIER, LANG_OC },
{ "__const__", CT_QUALIFIER, LANG_C | LANG_CPP },
{ "__declspec", CT_DECLSPEC, LANG_C | LANG_CPP | LANG_CS },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__declspec is a C/C++ specific modifier. Why is C# added as a language?

Comment thread src/token_enum.h
CT_MACRO, // a macro def
CT_QUALIFIER, // static, const, etc
CT_EXTERN, // extern
CT_DECLSPEC, // __declspec

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's way too specific to add as a token. If anything, it should be something about the storage class.

Comment thread src/space.cpp
if (first->type == CT_DECLSPEC)
{
log_rule("IGNORE");
return(AV_IGNORE);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you ignoring here? Doesn't make much sense.

@hschlichter

Copy link
Copy Markdown

There is still a diff on the unity-diff-checker. It removes a single line break. Which on the surface wouldn't seem like a big deal(and you can definitely argue that the line break should be removed). But the question is why does it do that?

@KalyanaChakravarthi

Copy link
Copy Markdown
Author

Hi Henrik,
Can you please forward the test case for the above scenario?

@agandavarapu-rythmos

Copy link
Copy Markdown

@unitydevtools test

@hschlichter
hschlichter merged commit 93ce27a into master Dec 4, 2017
hschlichter added a commit that referenced this pull request Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants