Repository navigation
Conversation
#includes in /src
8d76750 to
99c3164
Compare
| #include <cstring> | ||
| #include <exception> | ||
| #include <iterator> | ||
| #include <math.h> |
There was a problem hiding this comment.
This is the same as cmath, but in the wrong namespace? Should just fix the usage instead.
There was a problem hiding this comment.
It's due to M_PI. <cmath> doesn't define it directly and std::numbers::pi is C++20 only.
There was a problem hiding this comment.
We hard-code a d_M_PI in path_converters.cpp as well. I could move everything to mpl::pi if you want and use that in all 3 places.
There was a problem hiding this comment.
I think consolidating makes sense
There was a problem hiding this comment.
Oh yes, I think I may have tried to delete a copy, but they were slightly different precision and it caused very small image comparison failures, but I could be misremembering.
There was a problem hiding this comment.
I looked and M_PI and d_M_PI are the same (double d_M_PI = 3.14159265358979323846)
There was a problem hiding this comment.
There are three in our sources:
// ft2font.h
#define M_PI 3.14159265358979323846264338328
// ft2font_wrapper.cpp
#define M_PI 3.14159265358979323846264338328
// path_converters.h
const double d_M_PI = 3.14159265358979323846;
On my machine, macOS defines M_PI as:
#define M_PI 3.14159265358979323846264338327950288
macOS defines std::numbers::pi as:
3.141592653589793238462643383279502
(Whitespace adjusted to make it easier to read)
There was a problem hiding this comment.
Oh, and Agg is const double pi = 3.14159265358979323846 in agg_basics.h. That might be what @scottshambaugh was thinking of.
There was a problem hiding this comment.
I'm making the following changes in 72f6403:
- Define
mpl::pito be the same asstd::numbers::piin LLVM libc++. This is a change in precision fromM_PI, but I don't think it should matter asM_PIcan already vary from platform to platform. - Use
mpl::piin ft2… and remove<math.h> - Use
agg::pifrom agg_basics.h in path_converters.h
There was a problem hiding this comment.
Ah, that was me looking at posix's M_PI (3.14159265358979323846) rather than grepping to see if we defined it...
Anyway, chalk up another one for moving to something consistent
PR summary
This PR adds a new "check-cpp-includes.py" tool which wraps
clang-include-cleanerfrom LLVM. I then ran this tool on all files in/srcand used the output to fix our includes.AI Disclosure
I used Claude to create a prototype to integrate
mesonwithclang-include-cleaner. I heavily modified that original into the version included in this PR.PR quality check