Skip to content

Update to C17 and remove SOFT_ASSERT#506

Draft
skizzerz wants to merge 1 commit intosolanum-ircd:mainfrom
skizzerz:fix-warnings
Draft

Update to C17 and remove SOFT_ASSERT#506
skizzerz wants to merge 1 commit intosolanum-ircd:mainfrom
skizzerz:fix-warnings

Conversation

@skizzerz
Copy link
Copy Markdown
Contributor

The overall goal of this branch is to fix all compiler warnings so that the meson build can run with -Wall -Wextra -pedantic -Werror and compile cleanly (corresponds to --warnlevel 3 --werror in meson flags). I did need to turn off warnings about unused parameters in meson.build as part of this because [[maybe_unused]] and/or unnamed function parameters in definitions is a C23 feature which is unfortunately still a bit too new of a C standard for GCC as shipped by supported OSes. Other categories of warnings were disabled because they are fully-conformant standard C but GCC just doesn't like them: missing field initializers (standard C will zero-init any missing fields which is what we want in every case we're doing this), empty format strings (needed in a small handful of cases), and "overlong strings" in test code.

C17 is supported by GCC shipped by all modern OSes (Debian 12+, Ubuntu 24.02+, and Alma/Rocky 9+), and buys us some neat features like anonymous structs/unions that later changes may use. Specifically, meson was changed to use the gnu17 variant since we make use of a handful of GNU extensions (and unconditionally define _GNU_SOURCE). Using gnu17 instead of c17 shuts up some pedantic warnings about strict compliance to the C99 standard which are not possible to shut up in a standards-compliant way until C23.

SOFT_ASSERT support was removed because it was not supported by the meson build system anyway, and cleaning up that code resolved some warnings about unused values due to the comma operator in the case it was not defined. As was discussed on IRC, if a soft assertion fails the ircd would almost certainly core in short order anyway due to the violation of preconditions.

The overall goal of this branch is to fix all compiler warnings so that
the meson build can run with -Wall -Wextra -pedantic -Werror and compile
cleanly (corresponds to --warnlevel 3 --werror in meson flags). I did
need to turn off warnings about unused parameters in meson.build as part
of this because [[maybe_unused]] and/or unnamed function parameters in
definitions is a C23 feature which is unfortunately still a bit *too*
new of a C standard for GCC as shipped by supported OSes. Other
categories of warnings were disabled because they are fully-conformant
standard C but GCC just doesn't like them: missing field initializers
(standard C will zero-init any missing fields which is what we want in
every case we're doing this), empty format strings (needed in a small
handful of cases), and "overlong strings" in test code.

C17 is supported by GCC shipped by all modern OSes (Debian 12+, Ubuntu
24.02+, and Alma/Rocky 9+), and buys us some neat features like
anonymous structs/unions that later changes may use. Specifically, meson
was changed to use the gnu17 variant since we make use of a handful of
GNU extensions (and unconditionally define _GNU_SOURCE). Using gnu17
instead of c17 shuts up some pedantic warnings about strict compliance
to the C99 standard which are not possible to shut up in a
standards-compliant way until C23.

SOFT_ASSERT support was removed because it was not supported by the
meson build system anyway, and cleaning up that code resolved some
warnings about unused values due to the comma operator in the case it
was not defined. As was discussed on IRC, if a soft assertion fails the
ircd would almost certainly core in short order anyway due to the
violation of preconditions.
@skizzerz skizzerz marked this pull request as draft April 9, 2026 17:52
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.

1 participant