scope guard: ensure implicit lambdas are always inline

This commit is contained in:
Michael Scire 2020-01-17 14:17:18 -08:00
parent 9068e2071c
commit 11d4e74620
2 changed files with 4 additions and 2 deletions

View file

@ -13,7 +13,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "includes.hpp"
@ -40,6 +39,9 @@
#define CONST_FOLD(x) (__builtin_constant_p(x) ? (x) : (x))
#define WRAP_TEMPLATE_CONSTANT(...) ([] { using U = union { static constexpr auto GetValue() { return __VA_ARGS__; } }; return U{}; }())
#define UNWRAP_TEMPLATE_CONSTANT(tpnm) (tpnm::GetValue())
#define CONCATENATE_IMPL(S1, s2) s1##s2
#define CONCATENATE(s1, s2) CONCATENATE_IMPL(s1, s2)

View file

@ -54,5 +54,5 @@ namespace ams::util {
}
#define SCOPE_GUARD ::ams::util::impl::ScopeGuardOnExit() + [&]()
#define SCOPE_GUARD ::ams::util::impl::ScopeGuardOnExit() + [&]() ALWAYS_INLINE_LAMBDA
#define ON_SCOPE_EXIT auto ANONYMOUS_VARIABLE(SCOPE_EXIT_STATE_) = SCOPE_GUARD