Repository navigation
Conversation
A `define may expand to an `include directive whose file name is
passed as a macro argument (1800-2017 22.4), e.g.
`define DO_INCLUDE(FN) `include FN
`DO_INCLUDE("file.svh")
Substitute macro arguments when reading the `include file name, and
make the enclosing line directive refer to the nearest enclosing file
rather than the macro-expansion context, via a new
topmost_file_context() helper.
kroening
force-pushed
the
kroening/include-via-define
branch
from
November 5, 2026 00:09
a8e34bd to
5e87252
Compare
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.
A
`definemay expand to an`includedirective whose file name is passed as a macro argument (1800-2017 section 22.4), e.g.Previously this failed: the file name token (
FN) was read literally when scanning the`includeargument, producing "expecting either " or < after `include". When the include did resolve, exiting it aborted with an invariant violation because the exit line directive assumed the enclosing context was a file rather than a macro expansion.Changes:
`includefile name.emit_line_directiverefer to the nearest enclosing file context (newtopmost_file_context()helper) so an include triggered from inside a macro expansion emits a correct line directive instead of trippingPRECONDITION(context().is_file()).Adds a regression test covering multiple expansions on one line and an expansion suppressed inside a false
`ifdef. This is the sv-tests22.4--include_via_definecase.