Skip to content

Conversation

@pqwy
Copy link
Contributor

@pqwy pqwy commented Jun 26, 2025

Increase the C compiler strictness for libcn, to mirror the Linux build environment more closely. Then fix the obvious fallout. In particular:

  • Add additional flags to runtime/libcn/lib/compile.sh;
  • Fix -Werror=strict-prototypes tree-wide;
  • Fix -Wimplicit-fallthrough in Fulminate.

This helps avoid a few C foot guns, and keeps the C sources in a good shape to build as part of Linux/pKVM. There are no downsides to adhering to a slightly stricter programming discipline, either.

One functional change I made is not making warnings conditional on CI. Having them pop out during development helps fixing things early; and conversely, having the CI stricter than the normal workflow is bound to cause frustration.

@pqwy
Copy link
Contributor Author

pqwy commented Jun 26, 2025

(The branch is based on #220, which should be merged before.)

@pqwy pqwy requested review from ZippeyKeys12 and rbanerjee20 June 26, 2025 18:36
#!/bin/bash

FLAGS="-O2 "
if [[ -n "${GITHUB_ACTIONS+isset}" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

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

Without this, if you have a newer version of a compiler, builds can break locally, but pass CI. See #85.

So I would not remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that there is no -Werror, and only hand-picked warning are promoted to errors.

I can re-add -Werror for the CI. But the additional warnings should be local, otherwise they go unfixed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Or, we can use dune-idiomatic thing and add it for dev profile only.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Removing -Werror weakens CI, no? I'd rather not...

Copy link
Contributor

Choose a reason for hiding this comment

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

I can re-add -Werror for the CI. But the additional warnings should be local, otherwise they go unfixed.

Perhaps we do this then?

Copy link
Contributor

Choose a reason for hiding this comment

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

@pqwy Zain seems to be happy with re-adding -Werror for the CI and making additional warnings local, so once you update the branch I'm happy to merge

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.

3 participants