From: Mikko Rasa Date: Fri, 30 Dec 2022 22:34:41 +0000 (+0200) Subject: Avoid observing the same header twice in ObjectFile X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=6fcd905aacf302540bbc3e84671dba9222e2d06b;p=builder.git Avoid observing the same header twice in ObjectFile This is a bit crude since the dependencies are not sorted, but still avoids a massive slowdown from updating dependencies many times when a header is generated. --- diff --git a/source/lib/objectfile.cpp b/source/lib/objectfile.cpp index 00fa679..65ad433 100644 --- a/source/lib/objectfile.cpp +++ b/source/lib/objectfile.cpp @@ -54,11 +54,12 @@ void ObjectFile::find_dependencies() vector headers; find_dependencies(source, headers); for(FileTarget *h: headers) - { - add_dependency(*h); - if(h->get_real_target()->is_buildable()) - h->signal_modified.connect(sigc::mem_fun(this, static_cast(&ObjectFile::find_dependencies))); - } + if(!any_equals(depends, static_cast(h))) + { + add_dependency(*h); + if(h->get_real_target()->is_buildable()) + h->signal_modified.connect(sigc::mem_fun(this, static_cast(&ObjectFile::find_dependencies))); + } } void ObjectFile::find_dependencies(FileTarget &tgt, vector &headers)