goblint / goblint/analyzer

Common attributes support

Open
#698 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature good first issue student-job usability
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
  • access for LibraryFunctions invalidation.
  • alloc_size for blob sizes from custom alloc functions.
  • malloc for custom alloc functions, but also other classes of functions with similar trackable pointers.
  • nonnull for excluding NULLs.
  • noreturn for dead code (related issue #501).
  • pure for avoiding invalidation.
  • returns_nonnull for excluding NULLs.
  • warn_unused_result and nodiscard for emitting warnings.
  • error and warning for emitting warnings when not dead.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.