From: Mikko Rasa Date: Thu, 5 Jan 2023 09:36:41 +0000 (+0200) Subject: Avoid spurious dependency loop errors from side effects X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b0438fd2d85d6937b67db38c6138b0783962d8b2;p=builder.git Avoid spurious dependency loop errors from side effects If the primary target depends on its own side effect (such as a generated source file including a header generated by the same command), this could cause the side effect's prepare() to be entered recursively. --- diff --git a/source/lib/target.cpp b/source/lib/target.cpp index f99b0bc..d1aaf73 100644 --- a/source/lib/target.cpp +++ b/source/lib/target.cpp @@ -111,6 +111,9 @@ void Target::mark_rebuild(const string &reason) void Target::prepare() { + if(primary_target && primary_target->stateprepare(); + if(state>PREPARING) return; if(state==PREPARING) @@ -122,8 +125,6 @@ void Target::prepare() } state = PREPARING; - if(primary_target) - primary_target->prepare(); /* Prepare existing dependencies early, because their information may be needed to find other dependencies. */ for(Target *d: depends)