system: Allow restricting the legacy tswap() 'native-endian' API

Guard the native endian APIs we want to remove by surrounding
them with TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API #ifdef'ry.

Once a target gets cleaned we'll set the definition in the
target config, then the target won't be able to use the legacy
API anymore.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20260109165058.59144-19-philmd@linaro.org>
This commit is contained in:
Philippe Mathieu-Daudé
2025-12-09 19:24:05 +01:00
parent 0fca27a4d5
commit f9e68a2c82

View File

@@ -21,6 +21,8 @@
#define target_needs_bswap() (HOST_BIG_ENDIAN != target_big_endian())
#endif /* COMPILING_PER_TARGET */
#if defined(CONFIG_USER_ONLY) \
|| !defined(TARGET_NOT_USING_LEGACY_NATIVE_ENDIAN_API)
static inline uint16_t tswap16(uint16_t s)
{
if (target_needs_bswap()) {
@@ -68,5 +70,6 @@ static inline void tswap64s(uint64_t *s)
*s = bswap64(*s);
}
}
#endif
#endif /* TSWAP_H */