CLang 3.3 prerelease confused by use of alloca in vtkVRML
This issue was created automatically from an original Mantis Issue. Further discussion may take place here.
This is a problem I detected using the CLang trunk revision (Version 3.3 pre-release), though the fix I'm suggesting will work with any CLang version. The problem stems from CLang's impersonation of GCC -- in other words CLang defines GNUC even though it diverges from GNUC behavior in several ways.
The compile error is this, and is followed by a patch that allows compilation to complete.
/usr/include/alloca.h:36:7: error: declaration of '__builtin_alloca' has a different language linkage void alloca(size_t); / built-in for gcc */ ^ /Volumes/scratch/kent/BRAINSStandalone/clangbuild/VTK/Hybrid/vtkVRMLImporter.cxx:14:16: note: expanded from macro 'alloca' #define alloca __builtin_alloca ^ /usr/include/alloca.h:36:7: note: previous implicit declaration is here /Volumes/scratch/kent/BRAINSStandalone/clangbuild/VTK/Hybrid/vtkVRMLImporter.cxx:14:16: note: expanded from macro 'alloca' #define alloca __builtin_alloca ^ 1 error generated.
diff --git a/Hybrid/vtkVRMLImporter.cxx b/Hybrid/vtkVRMLImporter.cxx index ae6f239..2fd15a4 100644 --- a/Hybrid/vtkVRMLImporter.cxx +++ b/Hybrid/vtkVRMLImporter.cxx @@ -10,8 +10,10 @@
#ifdef GNUC +#ifndef clang #undef alloca #define alloca __builtin_alloca +#endif #else /* not GNUC */ #if HAVE_ALLOCA_H #include <alloca.h>