Repository navigation
fix(tests): include assert.h in test_net.c, which master no longer builds - #112
Closed
Kartikey1306 wants to merge 1 commit into
Closed
Kartikey1306 wants to merge 1 commit into
Kartikey1306 wants to merge 1 commit into
Conversation
…ilds
master does not compile:
tests/test_net.c:212:5: error: call to undeclared function 'assert';
ISO C99 and later do not support implicit function declarations
test_net.c makes ten assert() calls and includes stdio, stdlib and string
but never assert.h. It built while every test target was compiled with
NDEBUG, and embeddedos-org#104 removed that from test targets so the assertions in
these suites are real again -- which is what turned the missing include
into an error.
The include is what the file always needed; nothing else changes. Swept
the rest of tests/*.c and this is the only file that calls assert()
without including the header.
Restores the build: 34/34, and the assertions are live in the binary
rather than compiled away.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
Author
Contributor
Author
|
Closing in favour of #113, which contains this commit ( This PR cannot go green on its own: it fixes |
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.
master does not compile
test_net.cmakes tenassert()calls and includesstdio.h,stdlib.handstring.h— but neverassert.h.It built while every test target was compiled with
NDEBUG. #104 removed that from test targets so the assertions in these suites are real again, and that is what turned the missing include into a hard error. The omission was always there; #104 made the compiler care.Fix
Add the include. Nothing else changes.
I swept the rest of
tests/*.c— this is the only file that callsassert()without including the header:Verified
and the assertions are genuinely live rather than compiled away — the binary still carries its
test_net.cassertion strings, which is the guarantee #104 exists to provide.