Update to C17 and remove SOFT_ASSERT#506
Draft
skizzerz wants to merge 1 commit intosolanum-ircd:mainfrom
Draft
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.