Use loops instead of tail calls and musttail

gcc 15.2.1 20250813 complains "address of automatic variable can
escape to `musttail` call" from `-Wmaybe-musttail-local-addr`,
and guaranteeing tail-call optimization cross-platform is more
trouble than it's worth.
This commit is contained in:
Rangi42
2025-10-27 12:05:27 -04:00
parent 2519d1e698
commit df5162edca
3 changed files with 112 additions and 124 deletions

View File

@@ -60,13 +60,4 @@
#define _POSIX_C_SOURCE 200809L
#endif
// gcc and clang have their own `musttail` attributes for tail recursion
#if defined(__clang__) && __has_cpp_attribute(clang::musttail)
#define MUSTTAIL [[clang::musttail]]
#elif defined(__GNUC__) && __has_cpp_attribute(gnu::musttail)
#define MUSTTAIL [[gnu::musttail]]
#else
#define MUSTTAIL
#endif
#endif // RGBDS_PLATFORM_HPP