mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Use musttail attribute to guarantee tail recursion (#1849)
This commit is contained in:
@@ -60,4 +60,13 @@
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user