[Cmake-commits] [cmake-commits] king committed cmComputeLinkDepends.cxx 1.15 1.16 cmComputeLinkDepends.h 1.7 1.8

cmake-commits at cmake.org cmake-commits at cmake.org
Wed Apr 23 00:40:21 EDT 2008


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv18320/Source

Modified Files:
	cmComputeLinkDepends.cxx cmComputeLinkDepends.h 
Log Message:
BUG: Fix preservation of static libraries on original link lines.


Index: cmComputeLinkDepends.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C 2 -d -r1.7 -r1.8
*** cmComputeLinkDepends.h	31 Mar 2008 16:47:31 -0000	1.7
--- cmComputeLinkDepends.h	23 Apr 2008 04:40:19 -0000	1.8
***************
*** 129,132 ****
--- 129,133 ----
    void OrderLinkEntires();
    std::vector<char> ComponentVisited;
+   std::vector<int> FinalLinkOrder;
    void DisplayComponents(cmComputeComponentGraph const& ccg);
    void VisitComponent(cmComputeComponentGraph const& ccg, unsigned int i);
***************
*** 134,137 ****
--- 135,142 ----
    void DisplayFinalEntries();
  
+   // Preservation of original link line.
+   std::vector<int> OriginalEntries;
+   void PreserveOriginalEntries();
+ 
    // Compatibility help.
    bool OldLinkDirMode;

Index: cmComputeLinkDepends.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmComputeLinkDepends.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -C 2 -d -r1.15 -r1.16
*** cmComputeLinkDepends.cxx	23 Apr 2008 04:40:12 -0000	1.15
--- cmComputeLinkDepends.cxx	23 Apr 2008 04:40:19 -0000	1.16
***************
*** 144,149 ****
  edges are sorted by this index.
  
! This preserves the original link
! order as much as possible subject to the dependencies.
  
  After the initial exploration of the link interface tree, any
--- 144,152 ----
  edges are sorted by this index.
  
! This preserves the original link order as much as possible subject to
! the dependencies.  We then further preserve the original link line by
! appending items to make sure all those that might be static libraries
! appear in the order and multiplicity that they do in the original
! line.
  
  After the initial exploration of the link interface tree, any
***************
*** 238,243 ****
      }
  
!   // Compute the final set of link entries.
    this->OrderLinkEntires();
  
    // Display the final set.
--- 241,254 ----
      }
  
!   // Compute the final ordering.
    this->OrderLinkEntires();
+   this->PreserveOriginalEntries();
+ 
+   // Compute the final set of link entries.
+   for(std::vector<int>::const_iterator li = this->FinalLinkOrder.begin();
+       li != this->FinalLinkOrder.end(); ++li)
+     {
+     this->FinalLinkEntries.push_back(this->EntryList[*li]);
+     }
  
    // Display the final set.
***************
*** 547,550 ****
--- 558,566 ----
        this->EntryConstraintGraph[dependee_index].push_back(depender_index);
        }
+     else
+       {
+       // This is a direct dependency of the target being linked.
+       this->OriginalEntries.push_back(dependee_index);
+       }
  
      // Update the inferred dependencies for earlier items.
***************
*** 790,794 ****
    if(nl.size() == 1)
      {
!     this->FinalLinkEntries.push_back(this->EntryList[nl[0]]);
      return;
      }
--- 806,810 ----
    if(nl.size() == 1)
      {
!     this->FinalLinkOrder.push_back(nl[0]);
      return;
      }
***************
*** 808,816 ****
    for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
      {
!     this->FinalLinkEntries.push_back(this->EntryList[*ni]);
      }
    for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
      {
!     this->FinalLinkEntries.push_back(this->EntryList[*ni]);
      }
  }
--- 824,832 ----
    for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
      {
!     this->FinalLinkOrder.push_back(*ni);
      }
    for(NodeList::const_iterator ni = nl.begin(); ni != nl.end(); ++ni)
      {
!     this->FinalLinkOrder.push_back(*ni);
      }
  }
***************
*** 855,856 ****
--- 871,918 ----
      }
  }
+ 
+ //----------------------------------------------------------------------------
+ void cmComputeLinkDepends::PreserveOriginalEntries()
+ {
+   // Skip the part of the input sequence that already appears in the
+   // output.
+   std::vector<int>::const_iterator in = this->OriginalEntries.begin();
+   std::vector<int>::const_iterator out = this->FinalLinkOrder.begin();
+   while(in != this->OriginalEntries.end() &&
+         out != this->FinalLinkOrder.end())
+     {
+     cmTarget* tgt = this->EntryList[*in].Target;
+     if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
+       {
+       // Skip input items known to not be static libraries.
+       ++in;
+       }
+     else if(*in == *out)
+       {
+       // The input and output items match.  Move on to the next items.
+       ++in;
+       ++out;
+       }
+     else
+       {
+       // The output item does not match the next input item.  Skip it.
+       ++out;
+       }
+     }
+ 
+   // Append the part of the input sequence that does not already
+   // appear in the output.
+   while(in != this->OriginalEntries.end())
+     {
+     cmTarget* tgt = this->EntryList[*in].Target;
+     if(tgt && tgt->GetType() != cmTarget::STATIC_LIBRARY)
+       {
+       // Skip input items known to not be static libraries.
+       ++in;
+       }
+     else
+       {
+       this->FinalLinkOrder.push_back(*in++);
+       }
+     }
+ }



More information about the Cmake-commits mailing list