Common attributes support
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 252
- Forks
- 90
- Avg merge
- 4d 1m
- Merged PRs (30d)
- 19
Description
I happened upon GCC's common function attributes and noticed many that we could (and should) support. For example to allow more flexible specifications for LibraryFunctions or malloc wrappers.
Clang also has corresponding documentation: https://clang.llvm.org/docs/AttributeReference.html.
It would be even more ideal if the standard library headers used these attributes and we could directly handle them without hard-coding everything into LibraryFunctions, but that doesn't seem to be the case yet for all of them.
They could also be used for declaring more stubs in C itself.
Attributes
-
accessforLibraryFunctionsinvalidation. -
alloc_sizefor blob sizes from custom alloc functions. -
mallocfor custom alloc functions, but also other classes of functions with similar trackable pointers. -
nonnullfor excludingNULLs. -
noreturnfor dead code (related issue #501). -
purefor avoiding invalidation. -
returns_nonnullfor excludingNULLs. -
warn_unused_resultandnodiscardfor emitting warnings. -
errorandwarningfor emitting warnings when not dead.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked GCC Common Function Attributes and Clang Attribute Reference, then inspect the existing LibraryFunctions handling. Use the unchecked attribute list as the scope, with completion marked by support for each requested behavior, including invalidation, nullability, allocation sizes, and warnings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, ocaml
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100