From 9c7bbd531fdf9b5f2be2a7591ad7ecaf0eda54c1 Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Thu, 17 Jul 2025 20:14:23 +0200 Subject: [PATCH] Fix some includes in source/lib Make include-what-you-use happy with some files in source/lib and fix what needs to be fixed. Ref: #8086 Signed-off-by: Ralph Sennhauser --- source/graphics/MapIO.cpp | 3 ++- source/lib/adts/cache_adt.h | 4 ++++ source/lib/allocators/DynamicArena.h | 3 +++ source/lib/allocators/STLAllocators.h | 3 ++- source/lib/allocators/allocator_checker.h | 3 +++ source/lib/allocators/allocator_policies.h | 8 ++++++- source/lib/allocators/dynarray.h | 2 +- source/lib/allocators/overrun_protector.h | 4 ++-- source/lib/allocators/page_aligned.cpp | 8 +++++-- source/lib/allocators/page_aligned.h | 3 +-- source/lib/allocators/shared_ptr.h | 2 +- source/lib/allocators/stateless_allocators.h | 3 ++- source/lib/allocators/tests/test_adapters.h | 3 ++- source/lib/app_hooks.h | 6 ++++- source/lib/debug.h | 5 +++-- source/lib/file/archive/archive.h | 3 ++- source/lib/file/archive/archive_zip.cpp | 1 + source/lib/file/archive/archive_zip.h | 3 ++- source/lib/file/archive/stream.h | 2 +- .../lib/file/archive/tests/test_archive_zip.h | 5 +++++ source/lib/file/common/file_stats.h | 4 +--- source/lib/file/file.cpp | 2 ++ source/lib/file/file.h | 6 +++-- source/lib/file/file_system.cpp | 8 ++++++- source/lib/file/file_system.h | 8 +++++-- source/lib/file/io/io.h | 3 +++ source/lib/file/io/write_buffer.h | 3 ++- .../lib/file/vfs/tests/test_vfs_real_path.h | 10 ++++++--- source/lib/file/vfs/tests/test_vfs_tree.h | 7 ++++++ source/lib/file/vfs/tests/test_vfs_util.h | 10 +++++++-- source/lib/file/vfs/vfs_lookup.cpp | 1 + source/lib/file/vfs/vfs_lookup.h | 2 +- source/lib/file/vfs/vfs_populate.h | 3 ++- source/lib/file/vfs/vfs_tree.h | 6 +++-- source/lib/file/vfs/vfs_util.h | 10 +++++++-- source/lib/hash.h | 2 +- source/lib/input.cpp | 9 +++++--- source/lib/input.h | 5 +++-- source/lib/os_path.h | 8 ++++++- source/lib/path.h | 5 ++++- source/lib/posix/posix.h | 5 +++-- source/lib/secure_crt.h | 3 +++ source/lib/self_test.h | 11 ++++++---- source/lib/sysdep/smbios.cpp | 18 +++++++++++---- source/lib/sysdep/tests/test_rtl.h | 5 ++++- source/lib/sysdep/vm.h | 1 + source/lib/tests/test_bits.h | 3 ++- source/lib/tests/test_byte_order.h | 3 ++- source/lib/tests/test_cache_adt.h | 4 +++- source/lib/tests/test_path.h | 7 ++++-- source/lib/tests/test_rand.h | 6 ++++- source/lib/tests/test_secure_crt.h | 6 +++++ source/lib/tests/test_wchar.h | 8 ++++++- source/lib/tex/tests/test_tex.h | 7 +++--- source/lib/tex/tex_dds.cpp | 22 +++++++++++++++---- source/lib/tex/tex_png.cpp | 20 ++++++++++++++--- source/lib/tex/tex_tga.cpp | 10 ++++++++- source/lib/utf8.cpp | 10 +++++++-- source/ps/ConfigDB.h | 1 + source/ps/VisualReplay.cpp | 5 +++-- source/ps/scripting/JSInterface_VFS.cpp | 1 + source/simulation2/Simulation2.cpp | 3 ++- 62 files changed, 264 insertions(+), 81 deletions(-) diff --git a/source/graphics/MapIO.cpp b/source/graphics/MapIO.cpp index b055764668..66aaea128b 100644 --- a/source/graphics/MapIO.cpp +++ b/source/graphics/MapIO.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -29,6 +29,7 @@ #include "maths/MathUtil.h" #include "ps/Filesystem.h" +#include #include #include diff --git a/source/lib/adts/cache_adt.h b/source/lib/adts/cache_adt.h index 6fbbedb219..5c53af567e 100644 --- a/source/lib/adts/cache_adt.h +++ b/source/lib/adts/cache_adt.h @@ -28,12 +28,16 @@ #define INCLUDED_CACHE_ADT #include "lib/debug.h" +#include "lib/status.h" #include #include +#include #include #include // std::priority_queue #include +#include +#include /* Cache for items of variable size and value/"cost". diff --git a/source/lib/allocators/DynamicArena.h b/source/lib/allocators/DynamicArena.h index b0bcfc90b2..d4ff273d58 100644 --- a/source/lib/allocators/DynamicArena.h +++ b/source/lib/allocators/DynamicArena.h @@ -24,7 +24,10 @@ #define INCLUDED_ALLOCATORS_DYNAMIC_ARENA #include "lib/bits.h" +#include "lib/code_annotation.h" +#include "lib/debug.h" +#include #include #include // bad_alloc #include diff --git a/source/lib/allocators/STLAllocators.h b/source/lib/allocators/STLAllocators.h index 62a04714f6..c8040d8bd9 100644 --- a/source/lib/allocators/STLAllocators.h +++ b/source/lib/allocators/STLAllocators.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -23,6 +23,7 @@ #ifndef INCLUDED_STL_ALLOCATORS #define INCLUDED_STL_ALLOCATORS +#include #include #include diff --git a/source/lib/allocators/allocator_checker.h b/source/lib/allocators/allocator_checker.h index 9ea147d89f..50b634c877 100644 --- a/source/lib/allocators/allocator_checker.h +++ b/source/lib/allocators/allocator_checker.h @@ -24,8 +24,11 @@ #define INCLUDED_ALLOCATORS_ALLOCATOR_CHECKER #include "lib/debug.h" +#include "lib/status.h" +#include #include +#include /** * allocator test rig. diff --git a/source/lib/allocators/allocator_policies.h b/source/lib/allocators/allocator_policies.h index dc2fdbea62..39cb71eeee 100644 --- a/source/lib/allocators/allocator_policies.h +++ b/source/lib/allocators/allocator_policies.h @@ -29,9 +29,15 @@ #include "lib/alignment.h" // pageSize #include "lib/allocators/stateless_allocators.h" -#include "lib/allocators/freelist.h" +#include "lib/code_annotation.h" +#include "lib/debug.h" +#include "lib/sysdep/vm.h" +#include +#include #include +#include +#include namespace Allocators { diff --git a/source/lib/allocators/dynarray.h b/source/lib/allocators/dynarray.h index 9ede27d7d9..0a21c3ecab 100644 --- a/source/lib/allocators/dynarray.h +++ b/source/lib/allocators/dynarray.h @@ -27,7 +27,7 @@ #ifndef INCLUDED_ALLOCATORS_DYNARRAY #define INCLUDED_ALLOCATORS_DYNARRAY -#include "lib/debug.h" +#include "lib/status.h" #include "lib/types.h" #include diff --git a/source/lib/allocators/overrun_protector.h b/source/lib/allocators/overrun_protector.h index 7901227d6f..787f9e273a 100644 --- a/source/lib/allocators/overrun_protector.h +++ b/source/lib/allocators/overrun_protector.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2011 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -23,8 +23,8 @@ #ifndef INCLUDED_ALLOCATORS_OVERRUN_PROTECTOR #define INCLUDED_ALLOCATORS_OVERRUN_PROTECTOR +#include "lib/code_annotation.h" #include "lib/config2.h" // CONFIG2_ALLOCATORS_OVERRUN_PROTECTION -#include "lib/sysdep/vm.h" /** OverrunProtector wraps an arbitrary object in isolated page(s) and diff --git a/source/lib/allocators/page_aligned.cpp b/source/lib/allocators/page_aligned.cpp index 9051945f7f..98bf67fab6 100644 --- a/source/lib/allocators/page_aligned.cpp +++ b/source/lib/allocators/page_aligned.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -21,10 +21,14 @@ */ #include "precompiled.h" -#include "lib/allocators/page_aligned.h" + +#include "page_aligned.h" #include "lib/alignment.h" +#include "lib/debug.h" +#include "lib/posix/posix_mman.h" +#include //----------------------------------------------------------------------------- diff --git a/source/lib/allocators/page_aligned.h b/source/lib/allocators/page_aligned.h index 75afee2e88..866974b4f1 100644 --- a/source/lib/allocators/page_aligned.h +++ b/source/lib/allocators/page_aligned.h @@ -23,8 +23,7 @@ #ifndef INCLUDED_ALLOCATORS_PAGE_ALIGNED #define INCLUDED_ALLOCATORS_PAGE_ALIGNED -#include "lib/posix/posix_mman.h" // PROT_* -#include "lib/debug.h" +#include "lib/status.h" #include "lib/types.h" #include diff --git a/source/lib/allocators/shared_ptr.h b/source/lib/allocators/shared_ptr.h index 5afbdbc53d..be6dcc7025 100644 --- a/source/lib/allocators/shared_ptr.h +++ b/source/lib/allocators/shared_ptr.h @@ -24,7 +24,7 @@ #define INCLUDED_ALLOCATORS_SHARED_PTR #include "lib/alignment.h" -#include "lib/status.h" +#include "lib/debug.h" #include "lib/sysdep/rtl.h" // rtl_AllocateAligned #include "lib/types.h" diff --git a/source/lib/allocators/stateless_allocators.h b/source/lib/allocators/stateless_allocators.h index daae82f7bd..23dca287bf 100644 --- a/source/lib/allocators/stateless_allocators.h +++ b/source/lib/allocators/stateless_allocators.h @@ -23,11 +23,12 @@ #ifndef INCLUDED_STATELESS_ALLOCATORS #define INCLUDED_STATELESS_ALLOCATORS +#include "lib/alignment.h" +#include "lib/posix/posix_mman.h" #include "lib/sysdep/rtl.h" #include "lib/sysdep/vm.h" #include -#include // NB: STL allocators are parameterized on the object type and indicate // the number of elements to [de]allocate. however, these adapters are diff --git a/source/lib/allocators/tests/test_adapters.h b/source/lib/allocators/tests/test_adapters.h index 96966d2a70..108e6d588b 100644 --- a/source/lib/allocators/tests/test_adapters.h +++ b/source/lib/allocators/tests/test_adapters.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/source/lib/app_hooks.h b/source/lib/app_hooks.h index 897659c2ee..9213ed5f94 100644 --- a/source/lib/app_hooks.h +++ b/source/lib/app_hooks.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -91,8 +91,12 @@ extern const wchar_t*, translate, (const wchar_t* text), (text), return) #ifndef INCLUDED_APP_HOOKS #define INCLUDED_APP_HOOKS +#include "lib/debug.h" #include "lib/os_path.h" +#include +#include + // trampolines for user code to call the hooks. they encapsulate // the details of how exactly to do this. diff --git a/source/lib/debug.h b/source/lib/debug.h index 6c117bc984..5a52707f24 100644 --- a/source/lib/debug.h +++ b/source/lib/debug.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -38,11 +38,12 @@ #include "lib/alignment.h" #include "lib/code_annotation.h" -#include "lib/code_generation.h" #include "lib/status.h" +#include "lib/sysdep/compiler.h" #include "lib/types.h" #include +#include /** * trigger a breakpoint when reached/"called". diff --git a/source/lib/file/archive/archive.h b/source/lib/file/archive/archive.h index c1915fee8a..e94900fd80 100644 --- a/source/lib/file/archive/archive.h +++ b/source/lib/file/archive/archive.h @@ -31,7 +31,6 @@ #include "lib/file/file_system.h" // FileInfo #include "lib/file/vfs/vfs_path.h" #include "lib/os_path.h" -#include "lib/path.h" #include "lib/status.h" #include "lib/types.h" @@ -39,6 +38,8 @@ #include #include +class Path; + // rationale: this module doesn't build a directory tree of the entries // within an archive. that task is left to the VFS; here, we are only // concerned with enumerating all archive entries. diff --git a/source/lib/file/archive/archive_zip.cpp b/source/lib/file/archive/archive_zip.cpp index 29c3e02d75..f64fe3fbdb 100644 --- a/source/lib/file/archive/archive_zip.cpp +++ b/source/lib/file/archive/archive_zip.cpp @@ -54,6 +54,7 @@ #include #include #include +#include #include #include diff --git a/source/lib/file/archive/archive_zip.h b/source/lib/file/archive/archive_zip.h index aaade7e94a..e6a0660e75 100644 --- a/source/lib/file/archive/archive_zip.h +++ b/source/lib/file/archive/archive_zip.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +28,7 @@ #define INCLUDED_ARCHIVE_ZIP #include "lib/file/archive/archive.h" +#include "lib/os_path.h" /** * @return 0 if opening the archive failed (e.g. because an external program is holding on to it) diff --git a/source/lib/file/archive/stream.h b/source/lib/file/archive/stream.h index a30e534921..60ea9210ef 100644 --- a/source/lib/file/archive/stream.h +++ b/source/lib/file/archive/stream.h @@ -28,8 +28,8 @@ #define INCLUDED_STREAM #include "lib/code_annotation.h" -#include "lib/debug.h" #include "lib/file/archive/codec.h" +#include "lib/status.h" #include "lib/types.h" #include diff --git a/source/lib/file/archive/tests/test_archive_zip.h b/source/lib/file/archive/tests/test_archive_zip.h index 3983a4ed71..364829eb5b 100644 --- a/source/lib/file/archive/tests/test_archive_zip.h +++ b/source/lib/file/archive/tests/test_archive_zip.h @@ -22,11 +22,16 @@ #include "lib/self_test.h" +#include "lib/file/archive/archive.h" #include "lib/file/archive/archive_zip.h" #include "lib/file/file_system.h" #include "lib/file/io/io.h" +#include "lib/file/vfs/vfs_path.h" +#include "lib/os_path.h" +#include "lib/path.h" #include "lib/status.h" +#include #include #include diff --git a/source/lib/file/common/file_stats.h b/source/lib/file/common/file_stats.h index 9c271b269a..5c186e6ad0 100644 --- a/source/lib/file/common/file_stats.h +++ b/source/lib/file/common/file_stats.h @@ -27,9 +27,7 @@ #ifndef INCLUDED_FILE_STATS #define INCLUDED_FILE_STATS -#include "lib/code_annotation.h" - -#include +#include "lib/posix/posix_types.h" #define FILE_STATS_ENABLED 0 diff --git a/source/lib/file/file.cpp b/source/lib/file/file.cpp index 25845ad58a..ed4cd05854 100644 --- a/source/lib/file/file.cpp +++ b/source/lib/file/file.cpp @@ -31,10 +31,12 @@ #include "lib/code_annotation.h" #include "lib/debug.h" #include "lib/file/common/file_stats.h" +#include "lib/posix/posix_filesystem.h" #include "lib/posix/posix_types.h" #include "lib/sysdep/filesystem.h" #include +#include static const StatusDefinition fileStatusDefinitions[] = { { ERR::FILE_ACCESS, L"Insufficient access rights to open file", EACCES }, diff --git a/source/lib/file/file.h b/source/lib/file/file.h index 26e1ca121c..2fd0e9e759 100644 --- a/source/lib/file/file.h +++ b/source/lib/file/file.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,7 +28,9 @@ #define INCLUDED_FILE #include "lib/os_path.h" -#include "lib/sysdep/filesystem.h" // O_*, S_* +#include "lib/status.h" + +#include namespace ERR { diff --git a/source/lib/file/file_system.cpp b/source/lib/file/file_system.cpp index e095eab0eb..619dc8213c 100644 --- a/source/lib/file/file_system.cpp +++ b/source/lib/file/file_system.cpp @@ -28,12 +28,18 @@ #include "lib/debug.h" #include "lib/file/file_system.h" - +#include "lib/posix/posix_filesystem.h" #include "lib/sysdep/filesystem.h" +#include "lib/sysdep/os.h" #include #include +#include +#include #include +#include + +struct WDIR; bool DirectoryExists(const OsPath& path) { diff --git a/source/lib/file/file_system.h b/source/lib/file/file_system.h index 039c46f3ba..fd39af90ab 100644 --- a/source/lib/file/file_system.h +++ b/source/lib/file/file_system.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,7 +28,11 @@ #define INCLUDED_FILE_SYSTEM #include "lib/os_path.h" -#include "lib/posix/posix_filesystem.h" // mode_t +#include "lib/path.h" +#include "lib/posix/posix_filesystem.h" +#include "lib/posix/posix_types.h" +#include "lib/status.h" +#include "lib/types.h" #include diff --git a/source/lib/file/io/io.h b/source/lib/file/io/io.h index ed9c9b32af..03542cd673 100644 --- a/source/lib/file/io/io.h +++ b/source/lib/file/io/io.h @@ -36,6 +36,8 @@ #include "lib/lib.h" #include "lib/os_path.h" #include "lib/posix/posix_aio.h" // LIO_READ, LIO_WRITE +#include "lib/posix/posix_types.h" +#include "lib/status.h" #include "lib/sysdep/filesystem.h" // wtruncate #include "lib/sysdep/os.h" #include "lib/sysdep/rtl.h" @@ -44,6 +46,7 @@ #include #include #include +#include #include namespace ERR diff --git a/source/lib/file/io/write_buffer.h b/source/lib/file/io/write_buffer.h index dd66c39cf9..f1fcf33a2c 100644 --- a/source/lib/file/io/write_buffer.h +++ b/source/lib/file/io/write_buffer.h @@ -24,8 +24,9 @@ #define INCLUDED_WRITE_BUFFER #include "lib/code_annotation.h" -#include "lib/debug.h" #include "lib/file/file.h" +#include "lib/posix/posix_types.h" +#include "lib/status.h" #include "lib/types.h" #include diff --git a/source/lib/file/vfs/tests/test_vfs_real_path.h b/source/lib/file/vfs/tests/test_vfs_real_path.h index dd6fcc5696..614f5f3f67 100644 --- a/source/lib/file/vfs/tests/test_vfs_real_path.h +++ b/source/lib/file/vfs/tests/test_vfs_real_path.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,11 +22,15 @@ #include "lib/self_test.h" +#include "lib/file/file_system.h" #include "lib/file/vfs/vfs.h" -#include "lib/file/vfs/vfs_populate.h" #include "lib/os_path.h" +#include "lib/path.h" +#include "lib/types.h" -#include +#include +#include +#include static OsPath TEST_FOLDER(DataDir()/"_test.temp"); diff --git a/source/lib/file/vfs/tests/test_vfs_tree.h b/source/lib/file/vfs/tests/test_vfs_tree.h index 90cc50ff6c..b2fce3788c 100644 --- a/source/lib/file/vfs/tests/test_vfs_tree.h +++ b/source/lib/file/vfs/tests/test_vfs_tree.h @@ -22,10 +22,17 @@ #include "lib/self_test.h" +#include "lib/code_annotation.h" #include "lib/file/common/file_loader.h" #include "lib/file/vfs/vfs.h" #include "lib/file/vfs/vfs_lookup.h" +#include "lib/file/vfs/vfs_path.h" #include "lib/file/vfs/vfs_tree.h" +#include "lib/os_path.h" +#include "lib/status.h" +#include "lib/types.h" + +#include class MockLoader : public IFileLoader { diff --git a/source/lib/file/vfs/tests/test_vfs_util.h b/source/lib/file/vfs/tests/test_vfs_util.h index cffefdb728..c88a7f4564 100644 --- a/source/lib/file/vfs/tests/test_vfs_util.h +++ b/source/lib/file/vfs/tests/test_vfs_util.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,9 +22,15 @@ #include "lib/self_test.h" -#include "lib/file/vfs/vfs_util.h" #include "lib/file/file_system.h" +#include "lib/file/vfs/vfs.h" +#include "lib/file/vfs/vfs_path.h" +#include "lib/file/vfs/vfs_util.h" #include "lib/os_path.h" +#include "lib/path.h" +#include "lib/types.h" + +#include static OsPath MOD_PATH(DataDir() / "mods" / "_test.vfs" / ""); static OsPath CACHE_PATH(DataDir() / "_testcache" / ""); diff --git a/source/lib/file/vfs/vfs_lookup.cpp b/source/lib/file/vfs/vfs_lookup.cpp index 56a2e3a7e4..5f48acd311 100644 --- a/source/lib/file/vfs/vfs_lookup.cpp +++ b/source/lib/file/vfs/vfs_lookup.cpp @@ -37,6 +37,7 @@ #include "lib/file/vfs/vfs_tree.h" #include "lib/os_path.h" #include "lib/path.h" +#include "lib/posix/posix_filesystem.h" #include "lib/posix/posix_types.h" #include "lib/sysdep/filesystem.h" diff --git a/source/lib/file/vfs/vfs_lookup.h b/source/lib/file/vfs/vfs_lookup.h index a13f004ed8..5d32c9586d 100644 --- a/source/lib/file/vfs/vfs_lookup.h +++ b/source/lib/file/vfs/vfs_lookup.h @@ -27,8 +27,8 @@ #ifndef INCLUDED_VFS_LOOKUP #define INCLUDED_VFS_LOOKUP -#include "lib/debug.h" #include "lib/file/vfs/vfs_path.h" +#include "lib/status.h" #include diff --git a/source/lib/file/vfs/vfs_populate.h b/source/lib/file/vfs/vfs_populate.h index 95a11f8bf6..7bc4818a50 100644 --- a/source/lib/file/vfs/vfs_populate.h +++ b/source/lib/file/vfs/vfs_populate.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -28,6 +28,7 @@ #define INCLUDED_VFS_POPULATE #include "lib/file/common/real_directory.h" +#include "lib/status.h" class VfsDirectory; diff --git a/source/lib/file/vfs/vfs_tree.h b/source/lib/file/vfs/vfs_tree.h index 4a78735069..b78505ee74 100644 --- a/source/lib/file/vfs/vfs_tree.h +++ b/source/lib/file/vfs/vfs_tree.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -29,11 +29,13 @@ #include -#include "lib/file/file_system.h" // CFileInfo #include "lib/file/common/file_loader.h" // PIFileLoader #include "lib/file/common/real_directory.h" // PRealDirectory #include "lib/file/vfs/vfs_path.h" +#include +#include + class VfsFile { public: diff --git a/source/lib/file/vfs/vfs_util.h b/source/lib/file/vfs/vfs_util.h index ea03ee0f0e..ea7bc84f4d 100644 --- a/source/lib/file/vfs/vfs_util.h +++ b/source/lib/file/vfs/vfs_util.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,8 +27,14 @@ #ifndef INCLUDED_VFS_UTIL #define INCLUDED_VFS_UTIL -#include "lib/os_path.h" +#include "lib/file/file_system.h" #include "lib/file/vfs/vfs.h" +#include "lib/file/vfs/vfs_path.h" +#include "lib/os_path.h" +#include "lib/status.h" + +#include +#include namespace vfs { diff --git a/source/lib/hash.h b/source/lib/hash.h index 7af5d3f662..6e3d788c0b 100644 --- a/source/lib/hash.h +++ b/source/lib/hash.h @@ -24,7 +24,7 @@ #define INCLUDED_HASH #include -#include +#include /** * This function is the same as hash_combine, i.e. allows dropping the boost dependency just for this function. diff --git a/source/lib/input.cpp b/source/lib/input.cpp index 76b130819c..eec9d157c4 100644 --- a/source/lib/input.cpp +++ b/source/lib/input.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -25,13 +25,16 @@ */ #include "precompiled.h" + #include "input.h" +#include "lib/debug.h" #include "lib/external_libraries/libsdl.h" +#include "lib/status.h" +#include +#include #include -#include -#include const size_t MAX_HANDLERS = 10; static InHandler handler_stack[MAX_HANDLERS]; diff --git a/source/lib/input.h b/source/lib/input.h index a1c450a22a..8a673af762 100644 --- a/source/lib/input.h +++ b/source/lib/input.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -27,9 +27,10 @@ #ifndef INCLUDED_INPUT #define INCLUDED_INPUT - #include "lib/external_libraries/libsdl_fwd.h" +struct SDL_Event_; + // input handler return values. enum InReaction { diff --git a/source/lib/os_path.h b/source/lib/os_path.h index 61e92fc3c2..8df5979222 100644 --- a/source/lib/os_path.h +++ b/source/lib/os_path.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -23,7 +23,13 @@ #ifndef INCLUDED_OS_PATH #define INCLUDED_OS_PATH +#include "lib/debug.h" #include "lib/path.h" +#include "lib/sysdep/os.h" + +#include +#include +#include // rationale: // users are responsible for ensuring the path doesn't contain any forbidden diff --git a/source/lib/path.h b/source/lib/path.h index eae1353a9a..2a50ed4218 100644 --- a/source/lib/path.h +++ b/source/lib/path.h @@ -44,8 +44,11 @@ #include #include +#include #include -#include +#include +#include +#include namespace ERR { diff --git a/source/lib/posix/posix.h b/source/lib/posix/posix.h index f50941f881..30ff15e5c1 100644 --- a/source/lib/posix/posix.h +++ b/source/lib/posix/posix.h @@ -60,12 +60,13 @@ need only be renamed (e.g. _open, _stat). #ifndef INCLUDED_POSIX #define INCLUDED_POSIX +#include "lib/sysdep/compiler.h" +#include "lib/sysdep/os.h" + #if OS_WIN # include "lib/sysdep/os/win/wposix/wposix.h" #endif -#include "lib/posix/posix_types.h" - // disabled to reduce dependencies. include them where needed. //#include "lib/posix/posix_aio.h" //#include "lib/posix/posix_dlfcn.h" diff --git a/source/lib/secure_crt.h b/source/lib/secure_crt.h index f6cbedad39..07497e7136 100644 --- a/source/lib/secure_crt.h +++ b/source/lib/secure_crt.h @@ -29,8 +29,11 @@ #include "lib/code_annotation.h" #include "lib/status.h" +#include "lib/sysdep/compiler.h" +#include "lib/sysdep/os.h" #include +#include namespace ERR { diff --git a/source/lib/self_test.h b/source/lib/self_test.h index a42c455d06..f0c3275086 100644 --- a/source/lib/self_test.h +++ b/source/lib/self_test.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -23,11 +23,14 @@ #ifndef INCLUDED_SELF_TEST #define INCLUDED_SELF_TEST -// for convenience, to avoid having to include all of these manually #include "lib/lib.h" #include "lib/os_path.h" -#include "lib/status.h" -#include "lib/posix/posix.h" +#include "lib/self_test.h" + +#include +#include +#include +#include #define CXXTEST_HAVE_EH #define CXXTEST_HAVE_STD diff --git a/source/lib/sysdep/smbios.cpp b/source/lib/sysdep/smbios.cpp index 147ca2b4a9..0a83ba6a74 100644 --- a/source/lib/sysdep/smbios.cpp +++ b/source/lib/sysdep/smbios.cpp @@ -25,19 +25,29 @@ */ #include "precompiled.h" -#include "lib/sysdep/smbios.h" -#include "lib/bits.h" +#include "smbios.h" + #include "lib/alignment.h" -#include "lib/byte_order.h" // FOURCC_BE +#include "lib/bits.h" +#include "lib/code_annotation.h" +#include "lib/code_generation.h" +#include "lib/debug.h" #include "lib/module_init.h" +#include "lib/posix/posix.h" +#include "lib/status.h" +#include "lib/sysdep/os.h" #if OS_WIN -# include "lib/sysdep/os/win/wutil.h" +# include "lib/byte_order.h" # include "lib/sysdep/os/win/wfirmware.h" +# include "lib/sysdep/os/win/wutil.h" #endif +#include +#include #include +#include #include #include diff --git a/source/lib/sysdep/tests/test_rtl.h b/source/lib/sysdep/tests/test_rtl.h index 66467c75d7..449bbe7108 100644 --- a/source/lib/sysdep/tests/test_rtl.h +++ b/source/lib/sysdep/tests/test_rtl.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -24,6 +24,9 @@ #include "lib/sysdep/rtl.h" +#include +#include + class Test_rtl : public CxxTest::TestSuite { void _test_AllocateAligned_helper(size_t size, size_t align) diff --git a/source/lib/sysdep/vm.h b/source/lib/sysdep/vm.h index 0346a6a2af..315655d2e1 100644 --- a/source/lib/sysdep/vm.h +++ b/source/lib/sysdep/vm.h @@ -31,6 +31,7 @@ #include "lib/alignment.h" #include "lib/posix/posix_mman.h" // PROT_* +#include #include namespace vm { diff --git a/source/lib/tests/test_bits.h b/source/lib/tests/test_bits.h index aaa101917a..088c9ab496 100644 --- a/source/lib/tests/test_bits.h +++ b/source/lib/tests/test_bits.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -23,6 +23,7 @@ #include "lib/self_test.h" #include "lib/bits.h" +#include "lib/types.h" //#define EQUALS(actual, expected) ENSURE((actual) == (expected)) #define EQUALS TS_ASSERT_EQUALS diff --git a/source/lib/tests/test_byte_order.h b/source/lib/tests/test_byte_order.h index c23b2f34f2..1f0c82f1d1 100644 --- a/source/lib/tests/test_byte_order.h +++ b/source/lib/tests/test_byte_order.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2020 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -23,6 +23,7 @@ #include "lib/self_test.h" #include "lib/byte_order.h" +#include "lib/types.h" #include diff --git a/source/lib/tests/test_cache_adt.h b/source/lib/tests/test_cache_adt.h index a41e99e9cf..e59eb47667 100644 --- a/source/lib/tests/test_cache_adt.h +++ b/source/lib/tests/test_cache_adt.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -24,6 +24,8 @@ #include "lib/adts/cache_adt.h" +#include +#include #include class TestCache: public CxxTest::TestSuite diff --git a/source/lib/tests/test_path.h b/source/lib/tests/test_path.h index 4f81f64e6a..94dca22a8d 100644 --- a/source/lib/tests/test_path.h +++ b/source/lib/tests/test_path.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2012 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,8 +22,11 @@ #include "lib/self_test.h" -#include "lib/path.h" #include "lib/os_path.h" +#include "lib/path.h" +#include "lib/sysdep/os.h" + +#include class TestPath : public CxxTest::TestSuite { diff --git a/source/lib/tests/test_rand.h b/source/lib/tests/test_rand.h index b3beab7869..2ee4b6b81f 100644 --- a/source/lib/tests/test_rand.h +++ b/source/lib/tests/test_rand.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,7 +22,11 @@ #include "lib/self_test.h" +#include "lib/debug.h" #include "lib/rand.h" +#include "lib/status.h" + +#include class TestRand : public CxxTest::TestSuite { diff --git a/source/lib/tests/test_secure_crt.h b/source/lib/tests/test_secure_crt.h index e36706013f..969f5fd4a8 100644 --- a/source/lib/tests/test_secure_crt.h +++ b/source/lib/tests/test_secure_crt.h @@ -22,9 +22,15 @@ #include "lib/self_test.h" +#include "lib/debug.h" #include "lib/secure_crt.h" +#include "lib/status.h" +#include "lib/sysdep/os.h" +#include +#include #include +#include // note: we only test the char version. this avoids having to // expose secure_crt.cpp's tchar / tcpy etc. macros in the header and/or diff --git a/source/lib/tests/test_wchar.h b/source/lib/tests/test_wchar.h index ba539a1753..13e5161dc5 100644 --- a/source/lib/tests/test_wchar.h +++ b/source/lib/tests/test_wchar.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2010 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -21,8 +21,14 @@ */ #include "lib/self_test.h" + +#include "lib/code_annotation.h" +#include "lib/status.h" #include "lib/utf8.h" +#include +#include + // (copied from CStr test) class Test_wchar : public CxxTest::TestSuite diff --git a/source/lib/tex/tests/test_tex.h b/source/lib/tex/tests/test_tex.h index 860f8a8a62..5eca0dcb29 100644 --- a/source/lib/tex/tests/test_tex.h +++ b/source/lib/tex/tests/test_tex.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,11 +22,12 @@ #include "lib/self_test.h" -#include "lib/tex/tex.h" -#include "lib/tex/tex_codec.h" #include "lib/allocators/shared_ptr.h" +#include "lib/tex/tex.h" +#include "lib/types.h" #include +#include class TestTex : public CxxTest::TestSuite { diff --git a/source/lib/tex/tex_dds.cpp b/source/lib/tex/tex_dds.cpp index 12331ebb0c..881dc57914 100644 --- a/source/lib/tex/tex_dds.cpp +++ b/source/lib/tex/tex_dds.cpp @@ -26,12 +26,26 @@ #include "precompiled.h" -#include "lib/byte_order.h" -#include "lib/bits.h" -#include "lib/timer.h" -#include "lib/allocators/shared_ptr.h" #include "tex_codec.h" +#include "lib/alignment.h" +#include "lib/allocators/shared_ptr.h" +#include "lib/bits.h" +#include "lib/byte_order.h" +#include "lib/code_annotation.h" +#include "lib/debug.h" +#include "lib/lib.h" +#include "lib/os_path.h" +#include "lib/posix/posix_types.h" +#include "lib/status.h" +#include "lib/tex/tex.h" +#include "lib/tex/tex_internal.h" +#include "lib/timer.h" +#include "lib/types.h" + +#include +#include +#include // NOTE: the convention is bottom-up for DDS, but there's no way to tell. diff --git a/source/lib/tex/tex_png.cpp b/source/lib/tex/tex_png.cpp index c84617f214..2f4782cd4b 100644 --- a/source/lib/tex/tex_png.cpp +++ b/source/lib/tex/tex_png.cpp @@ -26,12 +26,26 @@ #include "precompiled.h" -#include "lib/external_libraries/png.h" - -#include "lib/byte_order.h" #include "tex_codec.h" + +#include "lib/alignment.h" +#include "lib/allocators/dynarray.h" #include "lib/allocators/shared_ptr.h" +#include "lib/byte_order.h" +#include "lib/code_annotation.h" +#include "lib/debug.h" +#include "lib/external_libraries/png.h" +#include "lib/os_path.h" +#include "lib/status.h" +#include "lib/sysdep/compiler.h" +#include "lib/tex/tex.h" #include "lib/timer.h" +#include "lib/types.h" + +#include +#include +#include +#include #if MSC_VERSION diff --git a/source/lib/tex/tex_tga.cpp b/source/lib/tex/tex_tga.cpp index 30d50751d2..acc1418443 100644 --- a/source/lib/tex/tex_tga.cpp +++ b/source/lib/tex/tex_tga.cpp @@ -26,9 +26,17 @@ #include "precompiled.h" -#include "lib/byte_order.h" #include "tex_codec.h" + #include "lib/bits.h" +#include "lib/byte_order.h" +#include "lib/code_annotation.h" +#include "lib/os_path.h" +#include "lib/status.h" +#include "lib/tex/tex.h" +#include "lib/types.h" + +#include #pragma pack(push, 1) diff --git a/source/lib/utf8.cpp b/source/lib/utf8.cpp index 8986dddc7c..5d6002e917 100644 --- a/source/lib/utf8.cpp +++ b/source/lib/utf8.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the @@ -22,7 +22,13 @@ #include "precompiled.h" -#include "lib/utf8.h" +#include "utf8.h" + +#include "lib/code_annotation.h" +#include "lib/debug.h" +#include "lib/types.h" + +#include static const StatusDefinition utf8StatusDefinitions[] = { { ERR::UTF8_SURROGATE, L"UTF-16 surrogate pairs aren't supported" }, diff --git a/source/ps/ConfigDB.h b/source/ps/ConfigDB.h index 093e8fca36..478e7d1941 100644 --- a/source/ps/ConfigDB.h +++ b/source/ps/ConfigDB.h @@ -31,6 +31,7 @@ #include "ps/CStr.h" #include +#include #include #include #include diff --git a/source/ps/VisualReplay.cpp b/source/ps/VisualReplay.cpp index 3074044b34..9da9e8bb2e 100644 --- a/source/ps/VisualReplay.cpp +++ b/source/ps/VisualReplay.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 Wildfire Games. +/* Copyright (C) 2025 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -22,8 +22,9 @@ #include "lib/timer.h" #include "lib/utf8.h" #include "lib/allocators/shared_ptr.h" -#include "lib/file/file_system.h" #include "lib/external_libraries/libsdl.h" +#include "lib/file/file_system.h" +#include "lib/sysdep/filesystem.h" #include "network/NetClient.h" #include "network/NetServer.h" #include "ps/CLogger.h" diff --git a/source/ps/scripting/JSInterface_VFS.cpp b/source/ps/scripting/JSInterface_VFS.cpp index 6de330d97d..aee99320a1 100644 --- a/source/ps/scripting/JSInterface_VFS.cpp +++ b/source/ps/scripting/JSInterface_VFS.cpp @@ -20,6 +20,7 @@ #include "JSInterface_VFS.h" #include "lib/file/vfs/vfs_util.h" +#include "lib/sysdep/filesystem.h" #include "ps/CLogger.h" #include "ps/CStr.h" #include "ps/Filesystem.h" diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp index 6584770c2d..5890ac1773 100644 --- a/source/simulation2/Simulation2.cpp +++ b/source/simulation2/Simulation2.cpp @@ -21,8 +21,9 @@ #include "graphics/MapReader.h" #include "graphics/Terrain.h" -#include "lib/timer.h" #include "lib/file/vfs/vfs_util.h" +#include "lib/sysdep/filesystem.h" +#include "lib/timer.h" #include "maths/MathUtil.h" #include "ps/CLogger.h" #include "ps/ConfigDB.h"