[Cmake-commits] CMake branch, next, updated. v2.8.12-4252-g7eee6d4

Stephen Kelly steveire at gmail.com
Tue Oct 22 04:43:33 EDT 2013


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  7eee6d4893605718e2f22214613e07f1f3098dfb (commit)
       via  0c97897b971387a72c6731428a71638ad6cde509 (commit)
       via  f804bf73c149c6b6ea1590c653a29625d4f5c0b9 (commit)
       via  df62331861ebecc107de00e31a2183df7dbacea7 (commit)
      from  1b496d75a6c8d4737f5116913bcdd56106a80a35 (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=7eee6d4893605718e2f22214613e07f1f3098dfb
commit 7eee6d4893605718e2f22214613e07f1f3098dfb
Merge: 1b496d7 0c97897
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 04:43:28 2013 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Oct 22 04:43:28 2013 -0400

    Merge topic 'cmarray-templates' into next
    
    0c97897 Genex: Use cmArraySize for targetPolicyWhitelist
    f804bf7 Genex: Remove use of TransitiveWhitelistCompare
    df62331 Add some templates for cleaner array iteration.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0c97897b971387a72c6731428a71638ad6cde509
commit 0c97897b971387a72c6731428a71638ad6cde509
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 01:14:03 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 22 10:43:16 2013 +0200

    Genex: Use cmArraySize for targetPolicyWhitelist
    
    For better readability.

diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index bc873e0..d13d0dd 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -1101,10 +1101,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
 
     context->HadContextSensitiveCondition = true;
 
-    for (size_t i = 1;
-         i < (sizeof(targetPolicyWhitelist) /
-              sizeof(*targetPolicyWhitelist));
-         ++i)
+    for (size_t i = 1; i < cmArraySize(targetPolicyWhitelist); ++i)
       {
       const char *policy = targetPolicyWhitelist[i];
       if (parameters.front() == policy)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f804bf73c149c6b6ea1590c653a29625d4f5c0b9
commit f804bf73c149c6b6ea1590c653a29625d4f5c0b9
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 01:12:24 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 22 10:43:16 2013 +0200

    Genex: Remove use of TransitiveWhitelistCompare
    
    Replace with generic solution based on cmArray* for better
    readability.

diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 7fd0fdc..bc873e0 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -704,17 +704,6 @@ std::string getLinkedTargetsContent(const std::vector<std::string> &libraries,
 }
 
 //----------------------------------------------------------------------------
-struct TransitiveWhitelistCompare
-{
-  explicit TransitiveWhitelistCompare(const std::string &needle)
-    : Needle(needle) {}
-  bool operator() (const char *item)
-  { return strcmp(item, this->Needle.c_str()) == 0; }
-private:
-  std::string Needle;
-};
-
-//----------------------------------------------------------------------------
 static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 {
   TargetPropertyNode() {}
@@ -864,8 +853,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
       return std::string();
     case cmGeneratorExpressionDAGChecker::ALREADY_SEEN:
       for (size_t i = 1;
-          i < (sizeof(targetPropertyTransitiveWhitelist) /
-                sizeof(*targetPropertyTransitiveWhitelist));
+          i < cmArraySize(targetPropertyTransitiveWhitelist);
           ++i)
         {
         if (targetPropertyTransitiveWhitelist[i] == propertyName)
@@ -928,12 +916,13 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 
     cmTarget *headTarget = context->HeadTarget ? context->HeadTarget : target;
 
-    const char **transBegin = targetPropertyTransitiveWhitelist + 1;
-    const char **transEnd = targetPropertyTransitiveWhitelist
-              + (sizeof(targetPropertyTransitiveWhitelist) /
-              sizeof(*targetPropertyTransitiveWhitelist));
+    const char * const *transBegin =
+                        cmArrayBegin(targetPropertyTransitiveWhitelist) + 1;
+    const char * const *transEnd =
+                        cmArrayEnd(targetPropertyTransitiveWhitelist);
+
     if (std::find_if(transBegin, transEnd,
-              TransitiveWhitelistCompare(propertyName)) != transEnd)
+                     cmStrCmp(propertyName)) != transEnd)
       {
 
       std::vector<std::string> libs;
@@ -949,7 +938,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
         }
       }
     else if (std::find_if(transBegin, transEnd,
-              TransitiveWhitelistCompare(interfacePropertyName)) != transEnd)
+                          cmStrCmp(interfacePropertyName)) != transEnd)
       {
       const cmTarget::LinkImplementation *impl = target->GetLinkImplementation(
                                                     context->Config,
@@ -996,8 +985,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
       }
 
     for (size_t i = 1;
-         i < (sizeof(targetPropertyTransitiveWhitelist) /
-              sizeof(*targetPropertyTransitiveWhitelist));
+         i < cmArraySize(targetPropertyTransitiveWhitelist);
          ++i)
       {
       if (targetPropertyTransitiveWhitelist[i] == interfacePropertyName)

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=df62331861ebecc107de00e31a2183df7dbacea7
commit df62331861ebecc107de00e31a2183df7dbacea7
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Oct 22 01:02:49 2013 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Oct 22 10:43:16 2013 +0200

    Add some templates for cleaner array iteration.

diff --git a/Source/cmStandardIncludes.h b/Source/cmStandardIncludes.h
index d09b304..5ef3b1f 100644
--- a/Source/cmStandardIncludes.h
+++ b/Source/cmStandardIncludes.h
@@ -377,6 +377,35 @@ static thisClass* SafeDownCast(cmObject *c) \
   return 0;\
 }
 
+#if 1
+// defined(_MSC_VER) && _MSC_VER < 1300
 
+#define cmArrayBegin(a) a
+#define cmArraySize(a) (sizeof(a)/sizeof(*a))
+#define cmArrayEnd(a) a + cmArraySize(a)
+
+#else
+
+template<typename T, size_t N>
+const T* cmArrayBegin(const T (&a)[N]) { return a; }
+template<typename T, size_t N>
+const T* cmArrayEnd(const T (&a)[N]) { return a + N; }
+template<typename T, size_t N>
+size_t cmArraySize(const T (&)[N]) { return N; }
+
+#endif
+
+struct cmStrCmp {
+  cmStrCmp(const char *test) : m_test(test) {}
+  cmStrCmp(std::string &test) : m_test(test.c_str()) {}
+
+  bool operator()(const char * input)
+  {
+    return strcmp(input, m_test) == 0;
+  }
+
+private:
+  const char *m_test;
+};
 
 #endif

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

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list