Dmod_VerifyAllApisSignatures: treat already-connected outputs as valid#289
Dmod_VerifyAllApisSignatures: treat already-connected outputs as valid#289JohnAmadis merged 3 commits intodevelopfrom
Conversation
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
JohnAmadis
left a comment
There was a problem hiding this comment.
@copilot popraw to - przerób tę funkcję tak, aby zwracała string z sygnaturą i użyj jej w logach
src/system/public/dmod_dmf_api.c
Outdated
| { | ||
| if( Dmod_BuiltinInputApi.InputSection->Entries[i].Function == Pointer ) | ||
| { | ||
| return true; |
There was a problem hiding this comment.
@copilot zamiast zwracac po prostu true/false przerob te funkcje tak, aby zwracala sygnature jesli cos znajdzie
There was a problem hiding this comment.
Done in dc13b3c. Renamed to FindConnectedFunctionSignature — now returns const char* (the matched signature) or NULL if nothing is found.
src/system/public/dmod_dmf_api.c
Outdated
| result = false; | ||
| if( IsPointerAConnectedFunction( Context->Outputs.OutputSection->Entries[i] ) ) | ||
| { | ||
| DMOD_LOG_WARN("Output API at index %zu is already connected (function: %p)\n", i, Context->Outputs.OutputSection->Entries[i]); |
There was a problem hiding this comment.
tutaj bys mogl drukowac sygnature tej funkcji, ktora jest podlaczona uzywajac wynikow tego przeszukiwania, bo samo drukowanie informacji, ze ten pointer jest funkcja niewiele pomaga. Ponadto to nie powinien byc warning, tylko zwykle info/verbose, bo to nie jest nic zlego
There was a problem hiding this comment.
Fixed in dc13b3c. The log now prints the actual signature returned by FindConnectedFunctionSignature, and the level is DMOD_LOG_VERBOSE.
…VERBOSE Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Dmod_VerifyAllApisSignaturesreported an error for any output entry that wasn't a valid signature string — including entries that had already been connected (i.e., replaced with a live function pointer byDmod_ConnectApi). This caused false negatives when verifying a partially- or fully-connected module.Changes
src/system/public/dmod_dmf_api.cFindConnectedFunctionSignature(void*)that searches for a pointer in the system builtin inputs (Dmod_BuiltinInputApi) and all loaded module inputs (Dmod_Contexts[i]->Inputs), returning the matched entry's signature string (orNULLif not found).Dmod_VerifyAllApisSignatures: an entry that failsDmod_ApiSignature_IsValidis now passed to the helper before being treated as an error.VERBOSElog with the actual signature of the connected function;resultstaystrue.ERRORpath,result = false.tests/system/public/tests_dmod_verify_apis.cpp(new)Eight unit tests covering: null context, empty sections, valid signatures, output already connected via builtin inputs, output already connected via loaded-module inputs, unknown pointer (must fail), invalid input signature (must fail), valid input signature.
tests/system/public/CMakeLists.txtRegistered the new test file.
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.