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

Detect "index" variable names to avoid build issues #2591

Closed
lrstewart opened this issue Feb 16, 2021 · 0 comments · Fixed by #2597
Closed

Detect "index" variable names to avoid build issues #2591

lrstewart opened this issue Feb 16, 2021 · 0 comments · Fixed by #2597

Comments

@lrstewart
Copy link
Contributor

Problem:

An "index" function exists in strings.h, and older compilers (<GCC 4.8) warn if any local variables called "index" are used because they are considered to shadow that declaration. This issue broke our builds before #2540, and we almost introduced the same bug in #2589 (comment).

"index" is a reasonable variable name in other languages, and we'll probably make this mistake again. We should detect and prevent it with a linter.

Solution:

We can add a check for "index" to grep_simple_mistakes.sh, which runs against every pull request.

@lrstewart lrstewart changed the title Detect "index" variable name in simple_mistakes script Detect "index" variable names to avoid build issues Feb 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants