Skip to content

Fix parsing error with right angle bracket detection#2291

Merged
guwirth merged 1 commit intoSonarOpenCommunity:masterfrom
guwirth:fix-2286
Jan 12, 2022
Merged

Fix parsing error with right angle bracket detection#2291
guwirth merged 1 commit intoSonarOpenCommunity:masterfrom
guwirth:fix-2286

Conversation

@guwirth
Copy link
Copy Markdown
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
Copy Markdown

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

@guwirth
Copy link
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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

Development

Successfully merging this pull request may close these issues.

Parsing error when two template closing delimiter are used together without separator ">>" Question: Reproduce parsing errors on local machine

2 participants