Skip to content

[libc] Add returns_twice attribute to setjmp(3) #124370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libc/include/__llvm-libc-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@
#define __NOEXCEPT
#endif

#undef _Returns_twice
#define _Returns_twice __attribute__((returns_twice))

#endif // __cplusplus

#endif // LLVM_LIBC_COMMON_H
2 changes: 2 additions & 0 deletions libc/include/setjmp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,7 @@ functions:
standards:
- stdc
return_type: int
attributes:
- _Returns_twice
arguments:
- type: jmp_buf
2 changes: 1 addition & 1 deletion libc/src/setjmp/setjmp_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace LIBC_NAMESPACE_DECL {
#ifdef LIBC_COMPILER_IS_GCC
[[gnu::nothrow]]
#endif
int setjmp(jmp_buf buf);
__attribute__((returns_twice)) int setjmp(jmp_buf buf);

} // namespace LIBC_NAMESPACE_DECL

Expand Down