Small fix for LLVM

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Small fix for LLVM

Postby pHySiQuE » Sun Nov 10, 2013 12:33 pm

In dgGraph.h, change this:
Code: Select all
template<class dgNodeData, class dgEdgeData>
typename dgGraph<dgNodeData, dgEdgeData>::dgListNode* dgGraph<dgNodeData, dgEdgeData>::GetNodeFromNodeData(dgNodeData* const nodeData)
{
   dgInt32 size1 = sizeof (*nodeData);
   dgInt32 size0 = sizeof (dgGraphNode<dgNodeData, dgEdgeData>);
   void* const ptr = ((char*)nodeData) - (size0 - size1);
   dgGraphNode<dgNodeData, dgEdgeData>* const nodeInfo = (dgGraphNode<dgNodeData, dgEdgeData>*) ptr;
   return GetNodeFromInfo(*nodeInfo);
}


To this:
Code: Select all
template<class dgNodeData, class dgEdgeData>
typename dgGraph<dgNodeData, dgEdgeData>::dgListNode* dgGraph<dgNodeData, dgEdgeData>::GetNodeFromNodeData(dgNodeData* const nodeData)
{
   dgInt32 size1 = sizeof (*nodeData);
   dgInt32 size0 = sizeof (dgGraphNode<dgNodeData, dgEdgeData>);
   void* const ptr = ((char*)nodeData) - (size0 - size1);
   dgGraphNode<dgNodeData, dgEdgeData>* const nodeInfo = (dgGraphNode<dgNodeData, dgEdgeData>*) ptr;
//= OLD ==============================================
   //return GetNodeFromInfo(*nodeInfo);
//= NEW ==============================================
   return this->GetNodeFromInfo(*nodeInfo);
//====================================================
}


This will allow Newton to compile with the LLVM compiler.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Small fix for LLVM

Postby Julio Jerez » Sun Nov 10, 2013 2:12 pm

why? those two line are identical.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Small fix for LLVM

Postby pHySiQuE » Sun Nov 10, 2013 5:18 pm

THis is what Xcode tells me:
Code: Select all
../../Source/Libraries/NewtonDynamics/coreLibrary_300/source/core/dgGraph.h:128:9: error: use of undeclared identifier 'GetNodeFromInfo'
        return GetNodeFromInfo(*nodeInfo);
               ^
               this->
/Applications/Leadwerks/Engine/Projects/iOS/../../Source/Libraries/NewtonDynamics/coreLibrary_300/source/meshUtil/dgMeshEffect3.cpp:619:69: note: in instantiation of member function 'dgGraph<dgHACDCluster, dgHACDEdge>::GetNodeFromNodeData' requested here
                                                dgHACDClusterGraph::dgListNode* const clusterNodeB = m_graph->GetNodeFromNodeData (clusterB);
                                                                                                              ^
../../Source/Libraries/NewtonDynamics/coreLibrary_300/source/core/dgList.h:228:14: note: must qualify identifier to find this declaration in dependent base class
        dgListNode *GetNodeFromInfo (T &m_info) const;
                    ^
1 error generated.


This might tell you more:
http://blog.llvm.org/2009/12/dreaded-tw ... ookup.html
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Small fix for LLVM

Postby Julio Jerez » Sun Nov 10, 2013 6:22 pm

Ok I will check on xcode.
But that have to be a bug in LLVM, the operator this is implicit to the class. there is not need to using implicitly
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Small fix for LLVM

Postby Julio Jerez » Mon Nov 11, 2013 1:38 pm

I did not have time to test in xcode, but I made the change anyway.
I still believe this is a bug on the LLVM compiler, regearless how the explained it.
but since the code are equievalent, I suppose there is not harm on change it.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Small fix for LLVM

Postby pHySiQuE » Thu Nov 14, 2013 3:40 am

I don't doubt that, but it's easier to work around small compiler bugs. Thank you.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Small fix for LLVM

Postby Julio Jerez » Thu Nov 14, 2013 11:28 am

Ok I update the osx build.
I added the missing files and now it all build and run fine

you are correct when I change the compile for LLVM CGG 4.2 to Apple LLVM 4.1
I go the same error, some how that LLVM parser can not resolve that container indirection, but that is a Bug IN their parcel, all other compile can resolve fine

Intel compile, visual studio all version, GCC all version and CGG LLVM. the only failing is Apple LLVM 4.1
any way I leave the this-> because it makes no difference. Everything should work now

Thank for the tip
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests

cron