Skip to content

fix #14034: AST broken for 'or' keyword#7698

Merged
danmar merged 2 commits intocppcheck-opensource:mainfrom
ludviggunne:14034
Jul 31, 2025
Merged

fix #14034: AST broken for 'or' keyword#7698
danmar merged 2 commits intocppcheck-opensource:mainfrom
ludviggunne:14034

Conversation

@ludviggunne
Copy link
Copy Markdown
Collaborator

No description provided.

Copy link
Copy Markdown
Collaborator

@danmar danmar left a comment

Choose a reason for hiding this comment

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

In C it's not a keyword. It's a macro defined in iso646.h. So ideally we should be a bit careful.
In C++ I believe we can treat it as a keyword.
In C it would be good to check if iso646 is included or if the token is used as an operator or variable name..

@ludviggunne
Copy link
Copy Markdown
Collaborator Author

In C it's not a keyword. It's a macro defined in iso646.h. So ideally we should be a bit careful. In C++ I believe we can treat it as a keyword. In C it would be good to check if iso646 is included or if the token is used as an operator or variable name..

I believe the current approach is to always simplify it if it's used as an operator. I think it's fine without looking for the <iso646.h> since the code wouldn't compile otherwise anyway.

@sonarqubecloud
Copy link
Copy Markdown

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Jul 31, 2025

I believe the current approach is to always simplify it if it's used as an operator.

ah yes.. I looked too quickly I thought you were doing something in the AST. This looks fine however there is some unhappy CI.

@danmar danmar merged commit e71ed28 into cppcheck-opensource:main Jul 31, 2025
69 of 73 checks passed
@ludviggunne ludviggunne deleted the 14034 branch August 4, 2025 08:40
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.

2 participants