Fix regression, not permitting macro parameters inlined into naked functions.

This commit is contained in:
Christoffer Lerno
2025-07-30 10:38:37 +02:00
parent 44f4efa5aa
commit d600d0898c
2 changed files with 2 additions and 2 deletions

View File

@@ -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;

View File

@@ -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.");
}