Skip to content

Enable more build warnings for libc-bottom-half#755

Merged
alexcrichton merged 1 commit intoWebAssembly:mainfrom
alexcrichton:enable-warnings
Mar 3, 2026
Merged

Enable more build warnings for libc-bottom-half#755
alexcrichton merged 1 commit intoWebAssembly:mainfrom
alexcrichton:enable-warnings

Conversation

@alexcrichton
Copy link
Collaborator

While wasi-libc is compiled with -Wall -Wextra it ended up disabling a lot of warnings as well to handle third-party code. This commit reorganizes things by continuing to compile everything with -Wall -Wextra but disabling lints is done exclusively for third-party code rather than for all code in wasi-libc. In practice this means that everything in libc-bottom-half, code written exclusively for this repository, now has more lints firing. This additionally applies to test/src/*.c. Much of this commit is handling these lints then and adjusting a few patterns in places where necessary.

This commit additionally disables compiling with -Werror by default. CI still enables this by default, but it means that new lints/warnings won't be breaking for anyone else other than this repository's own CI which should have pinned versions of Clang being used in various places.

While wasi-libc is compiled with `-Wall -Wextra` it ended up disabling a
lot of warnings as well to handle third-party code. This commit
reorganizes things by continuing to compile everything with `-Wall
-Wextra` but disabling lints is done exclusively for third-party code
rather than for all code in wasi-libc. In practice this means that
everything in `libc-bottom-half`, code written exclusively for this
repository, now has more lints firing. This additionally applies to
`test/src/*.c`. Much of this commit is handling these lints then and
adjusting a few patterns in places where necessary.

This commit additionally disables compiling with `-Werror` by default.
CI still enables this by default, but it means that new lints/warnings
won't be breaking for anyone else other than this repository's own CI
which should have pinned versions of Clang being used in various places.
@alexcrichton alexcrichton requested a review from dicej March 3, 2026 19:50
Comment on lines +46 to 53
filesystem_path_flags_t flags = 0;
if ((flag & AT_SYMLINK_FOLLOW) != 0)
flags |= FILESYSTEM_PATH_FLAGS_SYMLINK_FOLLOW;
bool ok = filesystem_method_descriptor_link_at(file_handle1,
0,
flags,
&path1_wasi,
file_handle2,
&path2_wasi,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an example bug caught by the warnings, turns out wasip2 wasn't looking at flag-the-parameter

Comment on lines +924 to +927
if (optlen < sizeof(int)) {
errno = EINVAL;
return -1;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is also an example bug, optlen wasn't checked in this function anywhere else prior to this commit.

Copy link
Collaborator

@dicej dicej left a comment

Choose a reason for hiding this comment

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

Thanks so much for doing this!

@alexcrichton alexcrichton merged commit c2989f3 into WebAssembly:main Mar 3, 2026
29 checks passed
@alexcrichton alexcrichton deleted the enable-warnings branch March 3, 2026 20:09
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