Skip to content

Commit

Permalink
C#: fix warnings in generated code; add new CLI options (#981)
Browse files Browse the repository at this point in the history
This adds two new options to the C# codegen CLI:

- `--internal`: make symbols `internal` rather than `public` by default
- `--skip-support-files`: skip generating the `cabi_realloc`, component type and similar files

Those are both useful for generating code that we plan to ship as part of the
.NET runtime.  In that case, we don't want any of the generated code to be
exposed as part of the public API, and we leave it to the application to supply
`cabi_realloc` and the component type.

The other changes address warnings and lints encountered when adding generated
code to the .NET runtime codebase, e.g. XML validation in doc comments, trailing
whitespace, redundant function signature modifiers, etc.

Signed-off-by: Joel Dice <[email protected]>
  • Loading branch information
dicej authored Jun 20, 2024
1 parent 61e1c3e commit 266d638
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 168 deletions.
4 changes: 2 additions & 2 deletions crates/csharp/src/RepTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ internal int Add(T v) {
if (firstVacant.HasValue) {
rep = firstVacant.Value;
firstVacant = ((Vacant) list[rep]).next;
list[rep] = v;
list[rep] = v!;
} else {
rep = list.Count;
list.Add(v);
list.Add(v!);
}
return rep;
}
Expand Down
Loading

0 comments on commit 266d638

Please sign in to comment.