analyzer
analyzer copied to clipboard
Common attributes support
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.