This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  ea7b519b76b90199f3ba918dc86ef83d3d292c5f (commit)
       via  f447db7f102519e09258f0bd06668a9ae572ec68 (commit)
       via  c482dd8c976847ac89ed5e8752924a2c0ed386fa (commit)
       via  2b5459cd1a4f39ceeecd895583423ce737beb919 (commit)
      from  153a6aa18909b68b3beb507b438934e298764616 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ea7b519b76b90199f3ba918dc86ef83d3d292c5f
commit ea7b519b76b90199f3ba918dc86ef83d3d292c5f
Merge: 153a6aa f447db7
Author:     Robert Maynard <robert.mayn...@kitware.com>
AuthorDate: Fri Jan 18 11:57:28 2013 -0500
Commit:     CMake Topic Stage <kwro...@kitware.com>
CommitDate: Fri Jan 18 11:57:28 2013 -0500

    Merge topic 'xcode-duplicate-flags-13354' into next
    
    f447db7 XCode generator won't infinitely parse compiler flags (bug #13354).
    c482dd8 CMake Nightly Date Stamp
    2b5459c CMake Nightly Date Stamp


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f447db7f102519e09258f0bd06668a9ae572ec68
commit f447db7f102519e09258f0bd06668a9ae572ec68
Author:     Robert Maynard <robert.mayn...@kitware.com>
AuthorDate: Fri Jan 18 11:29:22 2013 -0500
Commit:     Robert Maynard <robert.mayn...@kitware.com>
CommitDate: Fri Jan 18 11:55:50 2013 -0500

    XCode generator won't infinitely parse compiler flags (bug #13354).
    
    When parsing the compiler flag list we reduce the search space on
    each iteration to be the subset of the string we hadn't searched
    before.

diff --git a/Source/cmGlobalXCodeGenerator.cxx 
b/Source/cmGlobalXCodeGenerator.cxx
index 2cfe4da..0681ce5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1367,16 +1367,18 @@ void 
cmGlobalXCodeGenerator::CreateCustomCommands(cmXCodeObject* buildPhases,
 }
 
 //----------------------------------------------------------------------------
-// This function removes each occurence of the flag and returns the last one
+// This function removes each occurrence of the flag and returns the last one
 // (i.e., the dominant flag in GCC)
 std::string cmGlobalXCodeGenerator::ExtractFlag(const char* flag,
                                                 std::string& flags)
 {
   std::string retFlag;
-  std::string::size_type pos = flags.rfind(flag);
+  std::string::size_type lastOccurancePos = flags.rfind(flag);
   bool saved = false;
-  while(pos != flags.npos)
+  while(lastOccurancePos != flags.npos)
     {
+    //increment pos, we use lastOccurancePos to reduce search space on next inc
+    std::string::size_type pos = lastOccurancePos;
     if(pos == 0 || flags[pos-1]==' ')
       {
       while(pos < flags.size() && flags[pos] != ' ')
@@ -1388,9 +1390,12 @@ std::string cmGlobalXCodeGenerator::ExtractFlag(const 
char* flag,
         flags[pos] = ' ';
         pos++;
         }
-      }
       saved = true;
-      pos = flags.rfind(flag);
+      }
+    //decrement lastOccurancePos while making sure we don't loop around
+    //and become a very large positive number since size_type is unsigned
+    lastOccurancePos = lastOccurancePos == 0 ? 0 : lastOccurancePos-1;
+    lastOccurancePos = flags.rfind(flag,lastOccurancePos);
     }
   return retFlag;
 }

-----------------------------------------------------------------------

Summary of changes:
 Source/CMakeVersion.cmake         |    2 +-
 Source/cmGlobalXCodeGenerator.cxx |   15 ++++++++++-----
 2 files changed, 11 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
CMake
_______________________________________________
Cmake-commits mailing list
Cmake-commits@cmake.org
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-commits

Reply via email to