Skip to content

Conversation

@hanno-becker
Copy link
Contributor

This commit unifies the listing of functions called by contract to the format

USED_FUNCTIONS = foo
USED_FUNCTIONS += bar0
USED_FUNCTIONS += bar1
...
USE_FUNCTION_CONTRACTS=$(addprefix $(NAMESPACE_PREFIX),$(USED_FUNCTIONS))

This makes it easier to

  • see what is being used,
  • add/remove functions
  • change the namespace prefix

@hanno-becker hanno-becker marked this pull request as ready for review January 10, 2026 14:48
@hanno-becker hanno-becker requested a review from a team as a code owner January 10, 2026 14:48
Copy link
Contributor

@mkannwischer mkannwischer left a comment

Choose a reason for hiding this comment

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

Thanks for cleaning this up - I appreciate switching everything to USED_FUNCTIONS +=.
However, I think the indirect addition of mlk_ is unnecessary. I'd like to be able to copy&past function names. Do you mind removing that again?

@hanno-becker
Copy link
Contributor Author

hanno-becker commented Jan 11, 2026

@mkannwischer

I'd like to be able to copy&past function names...

This is only possible because mlk is the namespace prefix in the CBMC config file. Which can be convenient, but isn't always: For example, if the function names before/after preprocessing are the same, you have no way to force the one after preprocessing. I noticed this in #1467 where I wanted to call the functions post-preprocessing (which do not have a context parameter), but couldn't, because their C name was overlayed by a macro of the same name, for which the context parameter was mandatory.

Note that the convenience you seek could be retained by using mlk_ in USED_FUNCTIONS, but stripping that when moving to USE_FUNCTION_CONTRACTs; so, USED_FUNCTIONS would be in terms of the source names, and USE_FUNCTION_CONTRACTS would be (and must be) in terms of the symbols.

This commit unifies the listing of functions called by contract
to the format

```
USED_FUNCTIONS = foo
USED_FUNCTIONS += bar0
USED_FUNCTIONS += bar1
...
USE_FUNCTION_CONTRACTS=$(addprefix $(NAMESPACE_PREFIX),$(USED_FUNCTIONS))
```

This makes it easier to
- see what is being used,
- add/remove functions
- change the namespace prefix

Signed-off-by: Hanno Becker <[email protected]>
@hanno-becker hanno-becker marked this pull request as draft January 11, 2026 07:54
Signed-off-by: Hanno Becker <[email protected]>
@hanno-becker
Copy link
Contributor Author

I marked this as Draft while experimenting how close this PR actually brings us to being able to change the symbol namespace.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants