Skip to content

add an error for stack allocations in naked functions#21082

Merged
andrewrk merged 2 commits intoziglang:masterfrom
Rexicon226:naked-stack
Aug 16, 2024
Merged

add an error for stack allocations in naked functions#21082
andrewrk merged 2 commits intoziglang:masterfrom
Rexicon226:naked-stack

Conversation

@Rexicon226
Copy link
Copy Markdown
Contributor

closes #72

Copy link
Copy Markdown
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message shouldn't mention the stack, only the language rule. Pointing at the type is a bit weird. Pointing at the keyword or name is OK.

@zeroZshadow
Copy link
Copy Markdown

Will this error also trigger for usage of var in an inline function that is called inside a .Naked function?

@andrewrk
Copy link
Copy Markdown
Member

A good question that should be answered with a few more lines in the test case.

i make the assumption that all these added checks will stop us from reaching further sites where `alloc` is emitted
@Rexicon226 Rexicon226 requested a review from andrewrk August 16, 2024 02:45
@Rexicon226 Rexicon226 force-pushed the naked-stack branch 3 times, most recently from d0c5b69 to 121c9ce Compare August 16, 2024 05:10
@andrewrk
Copy link
Copy Markdown
Member

Thanks!

@andrewrk andrewrk merged commit f1eed99 into ziglang:master Aug 16, 2024
@Rexicon226 Rexicon226 deleted the naked-stack branch August 16, 2024 16:44
richerfu pushed a commit to richerfu/zig that referenced this pull request Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add error for stack allocation in naked functions

3 participants