Repository navigation
build(warnings): enable -Wstrict-prototypes, -Wold-style-definition and -Wnested-externs - #959
Open
mohdTahaRafi wants to merge 2 commits into
Open
mohdTahaRafi wants to merge 2 commits into
mohdTahaRafi wants to merge 2 commits into
Conversation
Enable -Wstrict-prototypes, -Wold-style-definition and -Wnested-externs for C files. The code already builds without these warnings, so this only stops new ones from being added. Part of metacall#561
This branch has not been deployed
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.
Description
This PR is a first step for #561. It enables three warnings from the commented-out list in
cmake/Warnings.cmake. They only apply to C, and the code already has none of them, so they don't add any warnings now. They just stop new code from adding them.-Wstrict-prototypes: a declaration likeint f();instead ofint f(void);-Wold-style-definition: old K&R style function definitions-Wnested-externs: anexterndeclaration inside a functionChanges:
CMAKE_C_FLAGS) with these three flags.-Wold-style-definitionthere from theadd_compile_options()list, because that list is also used for C++ files, and GCC doesn't accept this flag for C++.-Wmissing-prototypescommented on its own line. It still gives 9 warnings, so I'll fix those in a separate PR.Testing: Full Debug builds with GCC 13 and Clang 18 (node, py, file, mock and ext loaders, the CLI, the sandbox plugins and the tests) give no new warnings, and the full
ctestpasses 108/108 with both compilers. The only warnings left are ones that were already there (Clang: the #560 warnings that #954 fixes; GCC: one-Wstrict-overflowin a C++ file).Information:
This PR also has the same
CONTRIBUTORScommit as #954, because the pre-commit hook asks for it on a new branch. It's the same line, so it won't change anything when the second PR is merged.No new dependencies.
Part of #561
Type of change
Checklist:
make testorctest -VV -R <test-name>). (fullctest, 108/108 with GCC and Clang)./docker-compose.sh test &> outputand attached the output. (not significant or breaking)OPTION_BUILD_ADDRESS_SANITIZERor./docker-compose.sh test-address-sanitizer &> outputandOPTION_TEST_MEMORYCHECK. (only compiler warning flags change, no code)OPTION_BUILD_THREAD_SANITIZERor./docker-compose.sh test-thread-sanitizer &> output. (only compiler warning flags change, no code)Helgrindin case my code works with threading. (no threading)cmake --build build --target clang-format(orcmake -DMODE=fix -P cmake/Format.cmake) in order to format my code and my code follows the style guidelines. (no C/C++ files changed)AI-ASSISTED: yes/no, model, human reviewer) and I own each line.AI-ASSISTED: yes, Claude Opus 5.5, Reviewed and tested by me.