CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   [Solved] Compiling OF with clang (https://www.cfd-online.com/Forums/openfoam-programming-development/103707-solved-compiling-clang.html)

BlueyTheDog June 24, 2012 12:45

[Solved] Compiling OF with clang
 
Hi all,
I have both OpenFOAM and clang on my linux box so I decided to see if I could compile OF. Lo & behold, there is an option in the build config file for clang, so I set it and kicked off the compile. Has anyone managed to get the build process to fully compile OF? I get the build failing after about an hour, in solidEquilibriumDisplacementFoam, and also get lots and lots of warnings, along the lines of:

Code:

/home/agl/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:553:34: warning: equality comparison result unused
      [-Wunused-comparison]
        this->operator[](patchI) == t;
        ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/home/agl/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/GeometricField.C:1180:21: note: in instantiation of member function
      'Foam::GeometricField<Foam::Vector<double>, fvPatchField, Foam::volMesh>::GeometricBoundaryField::operator==' requested here
    boundaryField() == dt.value();
                    ^
./kineticEnergyLimiter.H:17:15: note: in instantiation of member function 'Foam::GeometricField<Foam::Vector<double>, fvPatchField,
      Foam::volMesh>::operator==' requested here
        Dcorr == dimensionedVector("0", Dcorr.dimensions(), vector::zero);
              ^
/home/agl/OpenFOAM/OpenFOAM-2.1.1/src/OpenFOAM/lnInclude/GeometricBoundaryField.C:553:34: note: use '=' to turn this equality comparison into an
      assignment
        this->operator[](patchI) == t;
                                ^~
                                =

On my first reading of this, this is an incorrect usage of ==, but, in my experience of the coding style/techniques of OF, there are a lot of different techniques used, so I'm going to have to do some reading to understand the above as to whether it's a bug/feature/technique. Anyone care to make a guess as to it's status? Has someone been too heavy on the ='s button or do I have some new stuff to learn?

Any thoughts greatly appreciated,
Andrew

wyldckat June 24, 2012 14:32

Greetings Andrew,

This was asked/reported some time ago: http://www.openfoam.org/mantisbt/view.php?id=510

Best regards,
Bruno

BlueyTheDog June 24, 2012 14:52

Bruno,
Thanks for that, didn't even think to look in the bugs db. Had a search in the forum and nothing came up hence the post.

I do agree with the comment in the bug about the error reporting in clang - it is spectacular in comparison to gcc/VC/etc. Even if clang is slower, and I have a feeling by the end of the year it will be as fast as gcc, it's worth keeping for the error reporting alone. My unscientific view at the moment is that it also compiles code much quicker than gcc.


Andrew


All times are GMT -4. The time now is 05:32.