[Cmake-commits] CMake branch, next, updated. v2.8.12.2-1569-ge1a66db

Stephen Kelly steveire at gmail.com
Thu Feb 20 15:06:23 EST 2014


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  e1a66db4d30643d374b16a0a0f15129a4afa516e (commit)
       via  d7f7b1f905285fd9390f5681a19c5694df4229d4 (commit)
      from  6f28c4881e26dcecbf5b90d44d5fe755302d6607 (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=e1a66db4d30643d374b16a0a0f15129a4afa516e
commit e1a66db4d30643d374b16a0a0f15129a4afa516e
Merge: 6f28c48 d7f7b1f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 20 15:06:23 2014 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 20 15:06:23 2014 -0500

    Merge topic 'target-SOURCES-refactor' into next
    
    d7f7b1f9 MSVC7 can't do template partial specialization.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d7f7b1f905285fd9390f5681a19c5694df4229d4
commit d7f7b1f905285fd9390f5681a19c5694df4229d4
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Feb 20 21:05:15 2014 +0100
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Feb 20 21:05:15 2014 +0100

    MSVC7 can't do template partial specialization.
    
    Maybe it can do full specialization and overloading.

diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 3092684..f98f079 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -70,39 +70,12 @@ struct IDLSourcesTag {};
 struct ResxTag {};
 struct ModuleDefinitionFileTag {};
 
-template<typename Tag, typename OtherTag>
-struct IsSameTag
-{
-  enum {
-    Result = false
-  };
-};
-
-template<typename Tag>
-struct IsSameTag<Tag, Tag>
-{
-  enum {
-    Result = true
-  };
-};
-
-template<bool, typename T>
-void doAccept(T&, cmSourceFile*)
-{
-}
-
-template<>
-void doAccept<true,
-              std::vector<cmSourceFile*> >(std::vector<cmSourceFile*>& files,
-                                           cmSourceFile* f)
+void doAccept(std::vector<cmSourceFile*>& files, cmSourceFile* f)
 {
   files.push_back(f);
 }
 
-template<>
-void doAccept<true,
-              cmGeneratorTarget::ResxData>(cmGeneratorTarget::ResxData& data,
-                                            cmSourceFile* f)
+void doAccept(cmGeneratorTarget::ResxData& data, cmSourceFile* f)
 {
   // Build and save the name of the corresponding .h file
   // This relationship will be used later when building the project files.
@@ -115,12 +88,33 @@ void doAccept<true,
   data.ResxSources.push_back(f);
 }
 
-template<>
-void doAccept<true, std::string>(std::string& data, cmSourceFile* f)
+void doAccept(std::string& data, cmSourceFile* f)
 {
   data = f->GetFullPath();
 }
 
+#define ACCEPT_OVERLOAD(DATATYPE, MATCH_TAG) \
+template<typename Data, typename Tag> \
+void acceptProxy(Data&, cmSourceFile*, Tag, MATCH_TAG) \
+{ \
+} \
+ \
+template<> \
+void acceptProxy(DATATYPE& data, cmSourceFile* f, \
+                 MATCH_TAG, MATCH_TAG) \
+{ \
+  doAccept(data, f); \
+}
+
+ACCEPT_OVERLOAD(std::vector<cmSourceFile*>, ObjectSourcesTag)
+ACCEPT_OVERLOAD(std::vector<cmSourceFile*>, CustomCommandsTag)
+ACCEPT_OVERLOAD(std::vector<cmSourceFile*>, ExtraSourcesTag)
+ACCEPT_OVERLOAD(std::vector<cmSourceFile*>, HeaderSourcesTag)
+ACCEPT_OVERLOAD(std::vector<cmSourceFile*>, ExternalObjectsTag)
+ACCEPT_OVERLOAD(std::vector<cmSourceFile*>, IDLSourcesTag)
+ACCEPT_OVERLOAD(cmGeneratorTarget::ResxData, ResxTag)
+ACCEPT_OVERLOAD(std::string, ModuleDefinitionFileTag)
+
 //----------------------------------------------------------------------------
 template<typename Tag, typename DataType = std::vector<cmSourceFile*> >
 struct TagVisitor
@@ -150,21 +144,26 @@ struct TagVisitor
   void Accept(cmSourceFile *sf)
   {
     std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
+    Tag tag;
     if(sf->GetCustomCommand())
       {
-      doAccept<IsSameTag<Tag, CustomCommandsTag>::Result>(this->Data, sf);
+      CustomCommandsTag customCommandsTag;
+      acceptProxy(this->Data, sf, tag, customCommandsTag);
       }
     else if(this->Target->GetType() == cmTarget::UTILITY)
       {
-      doAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>(this->Data, sf);
+      ExtraSourcesTag extraSourcesTag;
+      acceptProxy(this->Data, sf, tag, extraSourcesTag);
       }
     else if(sf->GetPropertyAsBool("HEADER_FILE_ONLY"))
       {
-      doAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>(this->Data, sf);
+      HeaderSourcesTag headerSourcesTag;
+      acceptProxy(this->Data, sf, tag, headerSourcesTag);
       }
     else if(sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
       {
-      doAccept<IsSameTag<Tag, ExternalObjectsTag>::Result>(this->Data, sf);
+      ExternalObjectsTag externalObjectsTag;
+      acceptProxy(this->Data, sf, tag, externalObjectsTag);
       if(this->IsObjLib)
         {
         this->BadObjLibFiles.push_back(sf);
@@ -172,12 +171,13 @@ struct TagVisitor
       }
     else if(sf->GetLanguage())
       {
-      doAccept<IsSameTag<Tag, ObjectSourcesTag>::Result>(this->Data, sf);
+      ObjectSourcesTag objectSourcesTag;
+      acceptProxy(this->Data, sf, tag, objectSourcesTag);
       }
     else if(ext == "def")
       {
-      doAccept<IsSameTag<Tag, ModuleDefinitionFileTag>::Result>(this->Data,
-                                                                sf);
+      ModuleDefinitionFileTag moduleDefinitionFileTag;
+      acceptProxy(this->Data, sf, tag, moduleDefinitionFileTag);
       if(this->IsObjLib)
         {
         this->BadObjLibFiles.push_back(sf);
@@ -185,7 +185,8 @@ struct TagVisitor
       }
     else if(ext == "idl")
       {
-      doAccept<IsSameTag<Tag, IDLSourcesTag>::Result>(this->Data, sf);
+      IDLSourcesTag idlSourcesTag;
+      acceptProxy(this->Data, sf, tag, idlSourcesTag);
       if(this->IsObjLib)
         {
         this->BadObjLibFiles.push_back(sf);
@@ -193,19 +194,23 @@ struct TagVisitor
       }
     else if(ext == "resx")
       {
-      doAccept<IsSameTag<Tag, ResxTag>::Result>(this->Data, sf);
+      ResxTag resxTag;
+      acceptProxy(this->Data, sf, tag, resxTag);
       }
     else if(this->Header.find(sf->GetFullPath().c_str()))
       {
-      doAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>(this->Data, sf);
+      HeaderSourcesTag headerSourcesTag;
+      acceptProxy(this->Data, sf, tag, headerSourcesTag);
       }
     else if(this->GlobalGenerator->IgnoreFile(sf->GetExtension().c_str()))
       {
-      doAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>(this->Data, sf);
+      ExtraSourcesTag extraSourcesTag;
+      acceptProxy(this->Data, sf, tag, extraSourcesTag);
       }
     else
       {
-      doAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>(this->Data, sf);
+      ExtraSourcesTag extraSourcesTag;
+      acceptProxy(this->Data, sf, tag, extraSourcesTag);
       if(this->IsObjLib && ext != "txt")
         {
         this->BadObjLibFiles.push_back(sf);

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

Summary of changes:
 Source/cmGeneratorTarget.cxx |   91 ++++++++++++++++++++++--------------------
 1 file changed, 48 insertions(+), 43 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list