Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix parsing error with right angle bracket detection #2291

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

guwirth
Copy link
Collaborator

@guwirth guwirth commented Jan 5, 2022

void check() {
    a() < 0 || c >= 1;
    a() < 0 || c > 1;
    a() < 0 || c >> 1;

    if(a() < 0 || c >= 1) {}
    if(a() < 0 || c > 1) {}
    if(a() < 0 || c >> 1) {}

    Y<X<(6<1)>>;
    Y<X<(6>=1)>>;
    Y<X<(6<=1)>>;
    Y<X<(6>>1)>>;
    Y<X<(6<<1)>>;
    Y<X<(6<=>1)>>;
}

This change is Reviewable

@guwirth guwirth added the bug label Jan 5, 2022
@guwirth guwirth added this to the 2.0.7 milestone Jan 5, 2022
@guwirth guwirth self-assigned this Jan 5, 2022
@amai2012
Copy link

@guwirth What about this?
void check() { a() < 0 || c >> 1; }

@guwirth
Copy link
Collaborator Author

guwirth commented Jan 10, 2022

What about this? void check() { a() < 0 || c >> 1; }

@amai2012 ...I also had this in mind, but more complicated :-). Need more time to think about this, do you have a proposal?

@amai2012
Copy link

What about this? void check() { a() < 0 || c >> 1; }

@amai2012 ...I also had this in mind, but more complicated :-). Need more time to think about this, do you have a proposal?

I didn't try, just got curious while looking at the commit...
In case it fails we could add another known issue to be addressed later?

- close SonarOpenCommunity#2286

```C++
void check() {
    a() < 0 || c >= 1;
    a() < 0 || c > 1;
    a() < 0 || c >> 1;

    if(a() < 0 || c >= 1) {}
    if(a() < 0 || c > 1) {}
    if(a() < 0 || c >> 1) {}

    Y<X<(6<1)>>;
    Y<X<(6>=1)>>;
    Y<X<(6<=1)>>;
    Y<X<(6>>1)>>;
    Y<X<(6<<1)>>;
    Y<X<(6<=>1)>>;
}
```
@guwirth
Copy link
Collaborator Author

guwirth commented Jan 11, 2022

@amai2012 please have a look to current solution, this should fix your issue. You can test with https://ci.appveyor.com/project/SonarOpenCommunity/sonar-cxx/builds/42156789/artifacts.

@guwirth guwirth merged commit b6a8f3a into SonarOpenCommunity:master Jan 12, 2022
@guwirth guwirth changed the title fix parsing error with right angle bracket detection Fix parsing error with right angle bracket detection Feb 11, 2022
@guwirth guwirth deleted the fix-2286 branch July 26, 2022 09:06
@guwirth guwirth restored the fix-2286 branch July 26, 2022 09:14
@guwirth guwirth deleted the fix-2286 branch February 8, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2 participants