Skip to content

Don't generate C code for extern functions that are never called - #1440

Merged
Alasdair merged 1 commit into
rems-project:sail2from
Timmmm:user/timh/dont_codegen_extern_c
Sep 9, 2025
Merged

Don't generate C code for extern functions that are never called#1440
Alasdair merged 1 commit into
rems-project:sail2from
Timmmm:user/timh/dont_codegen_extern_c

Conversation

@Timmmm

@Timmmm Timmmm commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

If you have a function that is extern with a fallback, like this:

val print_step = pure {c: "print_step"} : unit -> unit
function print_step() = ()

Then Sail will generate C code for the Sail version of the function, but then never call it. This hopefully avoids that.

If you have a function that is `extern` with a fallback, like this:

```
val print_step = pure {c: "print_step"} : unit -> unit
function print_step() = ()
```

Then Sail will generate C code for the Sail version of the function, but then never call it. This hopefully avoids that.
@github-actions

github-actions Bot commented Sep 9, 2025

Copy link
Copy Markdown

Test Results

   15 files     33 suites   0s ⏱️
  957 tests   954 ✅  3 💤 0 ❌
4 695 runs  4 658 ✅ 37 💤 0 ❌

Results for commit a2efc7c.

@Alasdair
Alasdair merged commit a4ff3af into rems-project:sail2 Sep 9, 2025
9 checks passed
@Alasdair

Alasdair commented Sep 9, 2025

Copy link
Copy Markdown
Collaborator

Yes, seems better to avoid doing this. Especially with the --c-no-mangle option it could easily lead to unintended name collisions.

@Timmmm
Timmmm deleted the user/timh/dont_codegen_extern_c branch October 30, 2025 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants