From d600d0898c3410a903351cefa58fc32287b12257 Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Wed, 30 Jul 2025 10:38:37 +0200 Subject: [PATCH] Fix regression, not permitting macro parameters inlined into naked functions. --- src/compiler/sema_asm.c | 2 +- src/compiler/sema_expr.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/sema_asm.c b/src/compiler/sema_asm.c index 01e83171e..ee21e7515 100644 --- a/src/compiler/sema_asm.c +++ b/src/compiler/sema_asm.c @@ -75,7 +75,7 @@ static inline Decl *sema_resolve_external_symbol(SemaContext *context, Expr *exp SEMA_ERROR(expr, "Optional variables are not allowed in asm."); return NULL; } - if (decl->var.kind == VARDECL_PARAM && context->call_env.is_naked_fn) + if (decl->var.kind == VARDECL_PARAM && context->call_env.is_naked_fn && !(context->active_scope.flags & SCOPE_MACRO)) { SEMA_ERROR(expr, "Function parameters in '@naked' functions may not be directly referenced."); return NULL; diff --git a/src/compiler/sema_expr.c b/src/compiler/sema_expr.c index 3edf94457..a92ff9a88 100644 --- a/src/compiler/sema_expr.c +++ b/src/compiler/sema_expr.c @@ -1263,7 +1263,7 @@ static inline bool sema_expr_analyse_identifier(SemaContext *context, Type *to, } break; case VARDECL_PARAM: - if (context->call_env.is_naked_fn) + if (context->call_env.is_naked_fn && !(context->active_scope.flags & SCOPE_MACRO)) { RETURN_SEMA_ERROR(expr, "Parameters may not be directly accessed in '@naked' functions."); }