Soften same-named file disambiguation to resolve-by-search-path-order with a NOTICE - #1212
Merged
mkarlesky merged 2 commits intoAug 16, 2026
Merged
Conversation
…er with a NOTICE Previously, any query (a bare #include, a TEST_SOURCE_FILE() argument, a mock reference, etc.) that matched more than one same-named project file hard-failed the build, naming every candidate and refusing to guess. Since Ceedling's own :paths configuration already produces file collections ordered identically to the search paths a compiler would use, an ambiguous query now resolves to the first candidate in that order instead, logging an informational notice naming what else matched. A wrong guess still surfaces as an ordinary downstream compilation error rather than an upfront Ceedling failure. This applies uniformly across header #include resolution (plain and mocked, with a new per-test ordered header list that correctly ranks TEST_INCLUDE_PATH() directories ahead of :paths -> :include), source file resolution, and release builds. The one deliberate exception is `ceedling test:<name>` at the command line, which still hard-fails on an ambiguous name since there is no downstream compilation step to catch a wrong guess there.
A test file that both #includes a header and separately names a same-basename source via TEST_SOURCE_FILE() previously had both resolutions land independently in the compiled source list, risking a duplicate-symbol link error if they defined the same functions. TEST_SOURCE_FILE() is now authoritative: when its own resolved source shares a basename with what the implicit #include-driven convention would separately resolve, the directive's own file wins outright and the implicit convention's resolution for that basename is skipped entirely. This holds unconditionally, even when the implicit resolution would already have been unambiguous on its own. Header validation itself is unaffected -- only which source file compiles for a shared basename is decided differently.
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.
Summary
#include,TEST_SOURCE_FILE(), mock resolution, release builds) no longer hard-fail the build. They resolve to the first candidate by search-path order — the same order the compiler's own search paths would consult — logging an informational notice naming what else matched. A wrong guess still surfaces as an ordinary downstream compilation error.#includeresolution now uses a per-test ordered header list that correctly ranksTEST_INCLUDE_PATH()directories ahead of:paths↳:include, rather than the previous project-wide, incorrectly-ordered collection.ceedling test:<name>at the command line still hard-fails on an ambiguous name, since there's no downstream compilation step to catch a wrong guess there.TEST_SOURCE_FILE()is now authoritative over the implicit#include-driven header/source correspondence convention: when a directive's own resolved source shares a basename with what the implicit convention would separately resolve, the directive wins outright and the implicit convention's resolution is skipped — avoiding a duplicate-symbol link error from both landing in the source list.Test plan
TEST_INCLUDE_PATH()vs:includeranking,TEST_SOURCE_FILE()override, CLItest:task regression guard) green in Dockerdocs/ceedlingvendoring gap reproduced independently of this change)conventions.md,Changelog.md)