Catch2 provides a customization point for converting our types to
strings by specializing the StringMaker template.
We have some specializations in stringmaker.h, but this feature was only
working intermittently. I finally figured out that was due to an ODR
violation. The test files that didn't include stringmaker.h were
compiling a different specialization than the ones that did.
Re-jig the test includes so that any file including catch.hpp also
includes stringmaker.h, thereby ensuring that the custom
specializations are used everywhere and there is no ODR violation.
I achieved this by adding a new cata_catch.h header and making all
existing headers include catch.hpp via the new header.
* Change _ctype.h and __locale to cctype and clocale
* Change _wctype.h to cwctype in game.cpp
* Change __functional_base to functional
* Remove libcxx internal headers
* Remove UNIX system headers
* Fix clang-tidy error with -nostdinc++
Use the new clang-tidy check to convert a bunch of declarations to
static.
In a few cases, there were 'secret' dependencies being exposed without
headers. Convert those to work via headers instead.
* Define mappings for std::hash
IWYU was including system_error for std::has. Give it some more
reasonable alternatives in the mapping file.
* More IWYU doc updates
Add the --reorder flag to the example, and mention issue related to
clang-tidy disliking some of its changes.
* Work around IWYU failing
IWYU didn't realise that we were constructing a point here, so it
removed the #include "point.h"; make it more explicit to avoid that
issue.
* Use consistent include style in clang-tidy plugin
The plugin code was mostly using ""-style includes, but IWYU was adding
<>-style includes. I prefer the latter anyway for external project
includes, so convert them. That way, IWYU's additions are more
consistent.
Thanks to Qrox for suggesting this in review.
* Add IWYU pragma: keep
* Run IWYU and astyle
* Run IWYU a second time
* Prevent #include <cxxabi.h>
Unclear why IWYU thinks this is needed. It isn't, and it causes
problems on Visual Studio.
* Fix missing declarations
Mark functions with no prior declarations as static, and remove the
unused ones.
* Move debug_is_safe_string definition
Put it inside !WIN32 since it's only used there.
The <chrono> header here is used only in RELEASE mode, so IWYU run with
debug mode options will want to delete it. Guard the #include behind
RELEASE as well so that it isn't removed.
A first step towards IWYU support. Doing the sorting first because it
makes reviewing any additions or removals of headers much simpler.
The IWYU order is:
- Associated headers
- Misc system headers
- C++ STL headers
- Other project headers
The biggest change is moving system headers before project headers (they
are usually afterwards in Cata at the moment.
The associated header for a cpp file is the header file which declares
the functions defined in that cpp file. Normally that's the one which
shares the same name (up to extension), and if so IWYU figures it out
automatically.
However, in this project there are many corner cases, so we need to use
IWYU pragma: associated to tell it which header (or, in some cases,
which headers) is the associated header. We are unusual in having
multiple associated headers for some files, which might lead to
discovering some interesting IWYU bugs later, but in theory it is
supported.
At the end of the day this should be more efficient due to memory locality, even though there is an additional O(nlogn + n) processing step at the end of the test.
Increased range of test to 300x300(x21) to take advantage of the increased speed.