Use musttail attribute to guarantee tail recursion (#1849)

This commit is contained in:
Rangi
2025-10-20 15:56:22 -04:00
committed by GitHub
parent 1badba03d8
commit 2873e0b8c8
3 changed files with 25 additions and 9 deletions

View File

@@ -15,6 +15,7 @@
#include "helpers.hpp"
#include "itertools.hpp"
#include "linkdefs.hpp"
#include "platform.hpp" // MUSTTAIL
#include "verbosity.hpp"
#include "link/main.hpp"
@@ -203,7 +204,7 @@ static std::optional<size_t> getPlacement(Section const &section, MemoryLocation
return std::nullopt;
}
return getPlacement(section, location); // Tail recursion
MUSTTAIL return getPlacement(section, location);
}
static std::string getSectionDescription(Section const &section) {