* Convert integer parsing test to use normal TEST_CASEs
* Rename test name too similar to another
* Test to enforce normalized test names
* Normalize TEST_CASE names (scripted)
In LLVM 16 this check was a lot more effective. So, it was briefly
disabled during the migration. This fixes all its warnings again, and
re-enables it.
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++
The creature_test tests were still using srand to seed the RNG. This
serves no purpose now since we don't use rand for randomness. Moreover,
it was causing the tests to fail more often than they used to when this
mattered.
Switch these tests over to rng_set_engine_seed instead, and expand the
existing clang-tidy check looking for uses of rand to also flag uses of
srand (and similar library randomness functions).
Things we want to be able to call on these new point types:
* square_dist
* trig_dist
* rl_dist
* manhattan_dist
* direction_from
* line_to
* midpoint
And tests for all the above.
The vertical axis was reversed for various functions dealing with
the direction enum, so tests looked illogical and z-coordinates had to
be reversed in one place.
Rationalize this inconsistency, and add some additional tests.
* Helper script to run IWYU
* Run IWYU
* Update deprecated headers
* Run IWYU again
* Re-suppress cxxabi.h
This pragma got accidentally removed because it was deemed to be a
comment attached to a #include.
* Remove extra SDL header includes
* Fix ime.cpp headers
Some tweaks to help IWYU not break this file by messing with
platform-specific stuff not relevant on Linux.
* Update game.h
* Move new point.h includes inside #ifdef
* Re-add platform_win.h to mapsharing.cpp
* Apply suggestions from code review
Co-authored-by: ZhilkinSerg <ZhilkinSerg@users.noreply.github.com>
* Initial version of UseNamedPointConstantsCheck
This is intended to convert hand-rolled point constants like
point( 0, 0 ) into point_zero.
* Apply refactoring pass
* Manual fixup of refactored code
Add various manual tweaks to the automatically refactored code where I
think it makes sense.
* Remove some unnecessary initializations
* Remove constructor for quantity from nullptr
This was to allow a zero integer literal to be used as a zero of any
quantity. But it confuses static analysis into thinking quantity is a
pointer-like type and that nullptr should be used instead, so better to
do without.
You can still use the default constructor or a user-defined literal to
get a zero quantity fairly easily.
* Remove constructor for time_point / _duration from nullptr
This was to allow a zero integer literal to be used as a zero of any
quantity. But it confuses static analysis into thinking quantity is a
pointer-like type and that nullptr should be used instead, so better to
do without.
You can still use the default constructor or a user-defined literal to
get a zero value fairly easily. However, to make that true I had to
update the time_duration default constructor to zero-initialize where
previously it might have left the value uninitialized.
* Prefer nullptr as null pointer value
These are changes performed automatically by clang-tidy's
modernize-use-nullptr check.
* Enable modernize-use-nullptr
* 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.
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.