mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
GPU: Shader Tool: Add recursive include guard
This commit is contained in:
parent
0c19163be1
commit
6bfaa61a64
1 changed files with 4 additions and 0 deletions
|
|
@ -478,6 +478,7 @@ static std::string_view str_view_exclusive(Token tok)
|
|||
|
||||
void SourceProcessor::parse_includes(Parser &parser)
|
||||
{
|
||||
const string filename = filepath_.substr(filepath_.find_last_of('/') + 1);
|
||||
parser().foreach_match<true>("#A\"", [&](const vector<Token> &tokens) {
|
||||
if (tokens[1].str() != "include") {
|
||||
return;
|
||||
|
|
@ -510,6 +511,9 @@ void SourceProcessor::parse_includes(Parser &parser)
|
|||
dependency_name = dependency_name.substr(6);
|
||||
}
|
||||
|
||||
if (dependency_name == filename) {
|
||||
report_error(tokens[2], "Recursive include");
|
||||
}
|
||||
metadata_.dependencies.emplace_back(dependency_name);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue