23 Commits

Author SHA1 Message Date
dumb-kevin e9a7af4fc6 Upgrade vendored plf_colony to v7.6.13, plf_list to v2.8.02
- Replace src/third-party/plf/{colony,list}.h with upstream verbatim
- Add cata:: index<->iterator free helpers (plf removed members)
- Rename plf-facing get_iterator_from_pointer to get_iterator
- Switch deallocating clear() calls to reset() in map and item_wakeup
- Drop const from local map_stack in pickup autopickup
- Migrate colony_test and list_test for reshape, splice, ADL friends
- Add IWYU mapping for plf::void_cast in list.h and colony.h
2026-05-19 18:06:07 +04:00
moxian 2ee44002fd Mechanically IWYU the tests
python3 ~/github/include-what-you-use/iwyu_tool.py -j5 -p build $( find
src/ tests/ -maxdepth 1 -name '*.cpp' | grep -v -f
tools/iwyu/bad_files.txt )  --  -Xiwyu --comment_style=long -Xiwyu -
-max_line_length=1000 -Xiwyu --cxx17ns -Xiwyu
--mapping_file=../tools/iwyu/cata.imp   | tee out/iwyu/f-a-01.txt >
/dev/null

followed by

cat out/iwyu/f-a-02.txt | python3
~/github/include-what-you-use/fix_includes.py --reorder --nosafe_headers

followed by manual fixups of <stddef.h> -> <cstddef> and similar.

tests/generic_factory_test.cpp gets mangled very badly (IWYU bug) so
it's excluded from the list.

Code size:
includes:
$ cat obj/tiles/*.inc | wc
 288068  576136 17898260
$ cat tests/obj/tiles/*.inc | wc
 167044  334088 10465766

post-processed source (clang -E):
./make_preproc.sh src/
68567896 177775140 2134075721
./make_preproc.sh tests/
39341957 102891720 1243323710
2025-02-10 00:46:57 -08:00
Alexey 07356b65a5 Normalize TEST_CASE names (#66241)
* 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)
2023-06-17 13:57:19 -03:00
John Bytheway eec4f113c6 No more static declarations in headers
Use the new clang-tidy check to expunge all the static declarations in
headers.  Sometimes the 'static' can be simply be removed.  Other times
it is replaced by inline.
2023-03-24 06:51:16 -04:00
RipleyTom 1264425026 remove unused variables (nfc) (#61997) 2022-10-31 19:04:04 -04:00
John Bytheway 0a1191638e Remove redundant parentheses
Apply the new check to remove lots of redundant parentheses throughout
the codebase.
2021-11-07 12:57:53 -05:00
John Bytheway ebd549b300 Fix StringMaker ODR violations in tests
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.
2021-07-03 07:42:06 -07:00
John Bytheway a8f17b497e Enable clang-tidy readability-isolate-declaration (#48629)
* Enable clang-tidy readability-isolate-declaration

Enable this clang-tidy check and apply the changes it suggests.

Perform some minor refactoring on the result to move some declarations
to first use.

* Refactor some point code

These changes were suggested by clang-tidy as a result of the earlier
tweaks to isolate declarations.
2021-07-03 07:42:06 -07:00
Binrui Dong 9fdb7ef59c Run IWYU
* 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++
2021-02-06 00:18:41 -05:00
Kevin Granade 6d1841ac67 Precompiled Catch2 header (#42453)
* Hoist catch.hpp include to the top of files

* Precompile the catch header in tests
2020-07-29 01:28:26 +03:00
John Bytheway 32bda5329c Enable modernize-use-transparent-functors
Enable this clang-tidy check.
2020-07-03 23:12:51 -07:00
ZhilkinSerg f3fa0f901d Remove redundant empty statements, declarations and lines 2020-05-29 11:01:28 +03:00
John Bytheway 095bd51974 Use C++-style includes
Convert all C library includes to their C++ equivalents (stdio.h ->
cstdio, etc.).
2019-12-24 17:04:16 -05:00
John Bytheway 19f0f67928 clang-tidy bugprone-use-after-move (#33557)
* Enable bugprone-use-after-move

Enable this clang-tidy check and deal with associated warnings.

Mostly these were suppressions for things in the tests that are
specifically testing move constructor semantics, but one case was a
genuine latent bug.

* Fix mismatched declaration name

This error seems to have crept into master.
2019-08-26 13:17:04 +03:00
John Bytheway e47cd44c48 Enable readability-container-size-empty
Enable this clang-tidy check and fix the issues it raises.
2019-08-19 14:45:14 -04:00
Isaac Freund faa5eb15b8 Move colony and list test helpers to new header 2019-07-07 15:33:38 +02:00
Isaac Freund 488a837fa7 Add list test cases 2019-07-07 15:33:38 +02:00
John Bytheway bb37fa2194 Convert various loops to range-for
These were ones that clang-tidy could auto-convert, although I manually
tweaked most of them after clang's changes.
2019-07-06 20:25:30 +01:00
John Bytheway 4321c025d2 IWYU 20190629 (#31990)
* 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.
2019-07-01 12:25:53 +03:00
Kevin Granade 9e3ade54f3 Merge pull request #30886 from jbytheway/custom_clang_tidy
Custom clang tidy plugin
2019-06-20 16:42:34 -07:00
Isaac Freund fb8947e4bb Move colony to cata namespace and add documentation (#31659)
* Move colony to cata namespace

* Add documentation to colony.h

For the most part taken directly from https://www.plflib.org/colony.htm
2019-06-20 22:45:20 +03:00
John Bytheway 2d801eaf23 Fix a couple of casts to unsigned long
These had snuck in while I was getting all my other "removing long" PRs
merged.
2019-06-19 10:32:14 +01:00
Isaac Freund 62d8cc6a82 Add colony test cases
- colony basics (simple insertion/erasure/iterator testing)
- insert and erase
- range erase
- sort
- insertion methods
- perfect forwarding
- emplace
- group size and capacity
- splice

Delete `group_size_sum()` from colony as it is only needed for debugging
2019-06-13 14:50:16 +02:00