Thank you for your patch and explanation. I queued this up with all the patches I hope to apply for vtk 5.8.1.<br><br><div class="gmail_quote">On Fri, Dec 30, 2011 at 10:30 AM, kent williams <span dir="ltr"><<a href="mailto:nkwmailinglists@gmail.com">nkwmailinglists@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I've been trying to build VTK & ITK with CLang as part of another<br>
project, and run into a collision between two things CLang has a<br>
problem with:<br>
<br>
1. vnl_math.h has a large number of warnings because of in-class<br>
definitions of static const float members.<br>
2. vtkYoungsMaterialInterface.cxx has a macro ALLOC_LOCAL_ARRAY that<br>
uses a Gnu C extenstion to define arrays with variable length.<br>
<br>
To try and address #1, I add -Werror=gnu to the CLang compiler flags.<br>
If this is set, the compiler test for in-line static const float<br>
members fails, which gets rid of the gazillion warnings everywhere<br>
vnl_math.h is included.<br>
<br>
But this causes another problem (see #2) because<br>
vtkYoungsMaterialInterface.cxx no longer compiles, as -Werror=gnu<br>
makes all gnu extensions an error.<br>
<br>
The real problem is that CLang defines __GNUC__ -- I would think that<br>
if you make all the GNUC extensions errors, it would be a good idea of<br>
CLang no longer defined __GNUC__.<br>
<br>
Looking at the ALLOC_LOCAL_ARRAY macros, it looks like a simple patch<br>
would fix things:<br>
<br>
diff --git a/Graphics/vtkYoungsMaterialInterface.cxx<br>
b/Graphics/vtkYoungsMaterialInterface.cxx<br>
index a509a2b..407a83c 100644<br>
--- a/Graphics/vtkYoungsMaterialInterface.cxx<br>
+++ b/Graphics/vtkYoungsMaterialInterface.cxx<br>
@@ -2049,7 +2049,7 @@ namespace vtkYoungsMaterialInterfaceCellCutInternals<br>
   sdata += ROUND_SIZE( sizeof(type)*(n) )<br>
 #define FREE_LOCAL_ARRAY(name,type,n) sdata -= ROUND_SIZE( sizeof(type)*(n) )<br>
<br>
-#elif defined(__GNUC__) // Warning, this is a gcc extension, not all<br>
compiler accept it<br>
+#elif defined(__GNUC__) && !defined(__clang__) // Warning, this is a<br>
gcc extension, not all compiler accept it<br>
 #define ALLOC_LOCAL_ARRAY(name,type,n) type name[(n)]<br>
 #define FREE_LOCAL_ARRAY(name,type,n)<br>
 #else<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
</blockquote></div><br>