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

Stop shadowing ONE #205

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Stop shadowing ONE #205

merged 2 commits into from
Dec 4, 2023

Conversation

chiphogg
Copy link
Contributor

@chiphogg chiphogg commented Dec 2, 2023

Our loosening of the overflow safety surface introduced a warning, which
is prominently visible on our canonical godbolt link:

image

Oops! We shadowed the magnitude ONE (globally available in the
library) with the constant ONE.

The quick fix is to rename the newcomer (which is not publicly visible
anyway) to UNITY.

To prevent this problem from recurring, we also add -Wshadow to our
regular compiler options.

Our loosening of the overflow safety surface introduced a warning, which
is prominently visible on our [canonical godbolt link]:

![image](https://github.com/aurora-opensource/au/assets/1819744/d55ef99f-7073-4644-9ffc-f75fa3893441)

Oops!  We shadowed the _magnitude_ `ONE` (globally available in the
library) with the _constant_ `ONE`.

The quick fix is to rename the newcomer (which is not publicly visible
anyway) to `UNITY`.

[canonical godbolt link]: https://godbolt.org/z/KrvfhP4M3
@chiphogg chiphogg added the release notes: 🐛 lib (bugfix) PR fixing a defect in the library code label Dec 2, 2023
This will prevent this kind of problem from landing in the future.
Copy link
Contributor

@geoffviola geoffviola left a comment

Choose a reason for hiding this comment

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

The name seems fine. The compiler warning works as expected. Thanks for removing the warning!

@chiphogg chiphogg merged commit 013c343 into main Dec 4, 2023
10 checks passed
@chiphogg chiphogg deleted the chiphogg/there-can-be-only-ONE-lol#190 branch December 4, 2023 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release notes: 🐛 lib (bugfix) PR fixing a defect in the library code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants