Create c style math function ltgm query #39388
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: None
Purpose of change
There have been perennial problems caused by invoking c-style match functions such as floor() and exp() instead of the equivalent c++ style functions such as std::floor() and std::exp().
Most recently they triggered a large number of lgtm.com warnings (just noise) due to the fact that the c-style variants do not have float overloads while the c++ style equivalents do.
Describe the solution
Add this query to mark new instances of these functions to discourage their proliferation.
Describe alternatives you've considered
The listing is incomplete, the full list of functions is quite extensve, see cppreference.com, I'll add more later.
Testing
Let lgtm do its thing.
Additional context
I'm interested to see what over checks we can use this for, it seems very flexible and easy to use.
See https://lgtm.com/help/lgtm/writing-custom-queries for the outline of adding them.