From 7ef033f8765ef5c2c5b43c0b49cfa049424252fb Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Tue, 19 Jul 2022 11:23:27 +0100 Subject: [PATCH] Ensure generated Makefile for hierarchical build is stable. Avoid iterating unordered_map. Iterate sorted blocks instead. --- src/V3EmitMk.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index 800cf589c..188047c3c 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -369,13 +369,13 @@ class EmitMkHierVerilation final { // Rules to process hierarchical blocks of.puts("\n# Verilate hierarchical blocks\n"); - for (V3HierBlockPlan::const_iterator it = m_planp->begin(); it != m_planp->end(); ++it) { - const string prefix = it->second->hierPrefix(); - const string argsFile = it->second->commandArgsFileName(false); - of.puts(it->second->hierGenerated(true)); + for (const V3HierBlock* const blockp : m_planp->hierBlocksSorted()) { + const string prefix = blockp->hierPrefix(); + const string argsFile = blockp->commandArgsFileName(false); + of.puts(blockp->hierGenerated(true)); of.puts(": $(VM_HIER_INPUT_FILES) $(VM_HIER_VERILOG_LIBS) "); of.puts(V3Os::filenameNonDir(argsFile) + " "); - const V3HierBlock::HierBlockSet& children = it->second->children(); + const V3HierBlock::HierBlockSet& children = blockp->children(); for (V3HierBlock::HierBlockSet::const_iterator child = children.begin(); child != children.end(); ++child) { of.puts((*child)->hierWrapper(true) + " "); @@ -384,16 +384,16 @@ class EmitMkHierVerilation final { emitLaunchVerilator(of, argsFile); // Rule to build lib*.a - of.puts(it->second->hierLib(true)); + of.puts(blockp->hierLib(true)); of.puts(": "); - of.puts(it->second->hierMk(true)); + of.puts(blockp->hierMk(true)); of.puts(" "); for (V3HierBlock::HierBlockSet::const_iterator child = children.begin(); child != children.end(); ++child) { of.puts((*child)->hierLib(true)); of.puts(" "); } - of.puts("\n\t$(MAKE) -f " + it->second->hierMk(false) + " -C " + prefix); + of.puts("\n\t$(MAKE) -f " + blockp->hierMk(false) + " -C " + prefix); of.puts(" VM_PREFIX=" + prefix); of.puts("\n\n"); }