common/types: drop <cstring>, add explicit includes at the 41 callers

types.h carried <cstring> for transitive purposes only - the header
itself never references std::memcpy / std::memset / std::strlen
etc. 41 TUs across the tree used those C-string functions while
relying on types.h to supply the declaration.

Add an explicit '#include <cstring>' to each of those files and
drop it from types.h. The headers that also use cstring functions
(error.h, jit_code_buffer.h are not in the list because they
already include <cstring> directly, or use the C-namespace
<string.h> already in scope) are unaffected.

Files getting an explicit <cstring>:

  src/common:  cd_image.cpp, cd_image_ecm.cpp, cd_image_mds.cpp,
               cd_image_memory.cpp, cd_image_pbp.cpp,
               cd_image_ppf.cpp, cd_subchannel_replacement.cpp,
               cue_parser.cpp, d3d12/shader_cache.cpp,
               d3d12/staging_texture.cpp, d3d12/texture.cpp,
               d3d12/util.cpp, iso_reader.cpp, jit_code_buffer.cpp,
               md5_digest.cpp, vulkan/shader_cache.cpp,
               vulkan/staging_texture.cpp
  src/core:    bios.cpp, bios.h, bus.cpp, cdrom.cpp, cheats.cpp,
               cpu_code_cache.cpp, cpu_recompiler_code_generator.cpp,
               cpu_recompiler_register_cache.cpp, dma.cpp, gpu.cpp,
               gpu_hw.cpp, gpu_hw.h, gpu_hw_d3d11.cpp,
               gpu_hw_d3d12.cpp, gpu_hw_opengl.cpp,
               gpu_hw_vulkan.cpp, gpu_sw.cpp, gte.cpp, mdec.cpp,
               memory_card_image.cpp, pgxp.cpp, spu.cpp, system.cpp
  src/libretro: libretro_host_display.cpp

Most files get one '#include <cstring>' added into the existing
system-include block, sorted alphabetically. A handful of files
(system.cpp, memory_card_image.cpp, d3d12/shader_cache.cpp)
had pre-existing blank-line separations between the stdlib
include block and libretro third-party headers (<compat/strl.h>,
<file/file_path.h>); those separations are preserved.

Build: Makefile.libretro platform=unix - clean, no warnings.
swanstation_libretro.so size unchanged (8026128 bytes).
retro_* exports: 25 (unchanged).

types.h now only includes <cstddef>, <cstdint>, and <type_traits>
- the three headers it actually needs for its own contents.
This commit is contained in:
LibretroAdmin 2026-05-14 12:18:34 +00:00 • committed by U-DESKTOP-SPFP6AQ\twistedtechre
commit 778cb660d0
42 changed files with 42 additions and 18 deletions

View file

@ -6,9 +6,9 @@
#include "settings.h"
#include "system.h"
#include <cmath>
#include <cstring>
#include <sstream>
#include <tuple>
#define IS_POW2(value) (((value) & ((value) - 1)) == 0)
template<typename T>