openscad / openscad

OpenSCAD - The Programmers Solid 3D CAD Modeller
https://www.openscad.org
Other
6.95k stars 1.2k forks source link

Linux compile warnings #757

Closed tim-caper closed 10 years ago

tim-caper commented 10 years ago

Compilation under (Fedora) Linux issues enormous amount of warning messages about Boost, which makes the whole warnings system practically useless, so it looks like a good idea to add -Wno-unused-local-typedefs flag (similar to mingw build):

diff --git a/openscad.pro b/openscad.pro
index 0912fa3..f0c3b4d 100644
--- a/openscad.pro
+++ b/openscad.pro
@@ -127,6 +127,7 @@ netbsd* {
 # See Dec 2011 OpenSCAD mailing list, re: CGAL/GCC bugs.
 *g++* {
   QMAKE_CXXFLAGS *= -fno-strict-aliasing
+  QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-local-typedefs # ignored before 4.8
 }

 *clang* {

As far as I read the flag would be ignored by gcc versions earlier than 4.8 (I have no way to test this). WDYT?

donbright commented 10 years ago

are the warnings about boost or are they about CGAL?

tim-caper commented 10 years ago

Other parts of code may trigger this warnings too, I am not sure about CGAL, Boost is just most noticeable. I put SMALL sample below:

g++ -c -pipe -fno-strict-aliasing -frounding-math -DEIGEN_DONT_ALIGN -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -O2 -D_REENTRANT -Wall -W -DOPENSCAD_VERSION=2014.04.14 -DOPENSCAD_YEAR=2014.0 -DOPENSCAD_MONTH=04.0 -DOPENSCAD_DAY=14.0 -DDEBUG -DUSE_PROGRESSWIDGET -DENABLE_CGAL -DENABLE_OPENCSG -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../openscad_deps/include/eigen3 -I../openscad_deps/include -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include/QtOpenGL -I/usr/include -Isrc -I/usr/X11R6/include -Iobjects -Iobjects -I../openscad_deps/include -o objects/linalg.o src/linalg.cc
In file included from ../openscad_deps/include/eigen3/Eigen/Core:248:0,
                 from src/linalg.h:4,
                 from src/linalg.cc:1:
../openscad_deps/include/eigen3/Eigen/src/Core/util/Memory.h: In function ‘Index Eigen::internal::first_aligned(const Scalar*, Index)’:
../openscad_deps/include/eigen3/Eigen/src/Core/util/Memory.h:449:48: warning: typedef ‘Packet’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename packet_traits<Scalar>::type Packet;
                                                ^
In file included from ../openscad_deps/include/eigen3/Eigen/Core:324:0,
                 from src/linalg.h:4,
                 from src/linalg.cc:1:
../openscad_deps/include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h: In static member function ‘static void Eigen::internal::selfadjoint_matrix_vector_product<Scalar, Index, StorageOrder, UpLo, ConjugateLhs, ConjugateRhs, Version>::run(Index, const Scalar*, Index, const Scalar*, Index, Scalar*, Scalar)’:
../openscad_deps/include/eigen3/Eigen/src/Core/products/SelfadjointMatrixVector.h:38:44: warning: typedef ‘RealScalar’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename NumTraits<Scalar>::Real RealScalar;
                                            ^
In file included from ../openscad_deps/include/eigen3/Eigen/QR:26:0,
                 from ../openscad_deps/include/eigen3/Eigen/SVD:4,
                 from ../openscad_deps/include/eigen3/Eigen/Geometry:8,
                 from src/linalg.h:5,
                 from src/linalg.cc:1:
../openscad_deps/include/eigen3/Eigen/src/QR/HouseholderQR.h: In function ‘void Eigen::internal::householder_qr_inplace_blocked(MatrixQR&, HCoeffs&, typename MatrixQR::Index, typename MatrixQR::Scalar*)’:
../openscad_deps/include/eigen3/Eigen/src/QR/HouseholderQR.h:235:41: warning: typedef ‘RealScalar’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename MatrixQR::RealScalar RealScalar;
                                         ^
In file included from ../openscad_deps/include/eigen3/Eigen/Eigenvalues:28:0,
                 from ../openscad_deps/include/eigen3/Eigen/Dense:7,
                 from src/linalg.h:6,
                 from src/linalg.cc:1:
../openscad_deps/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h: In function ‘void Eigen::internal::tridiagonalization_inplace(MatrixType&, DiagonalType&, SubDiagonalType&, bool)’:
../openscad_deps/include/eigen3/Eigen/src/Eigenvalues/Tridiagonalization.h:428:38: warning: typedef ‘Index’ locally defined but not used [-Wunused-local-typedefs]
   typedef typename MatrixType::Index Index;
                                      ^
In file included from ../openscad_deps/include/eigen3/Eigen/Eigenvalues:34:0,
                 from ../openscad_deps/include/eigen3/Eigen/Dense:7,
                 from src/linalg.h:6,
                 from src/linalg.cc:1:
../openscad_deps/include/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h: In static member function ‘static void Eigen::internal::complex_schur_reduce_to_hessenberg<MatrixType, false>::run(Eigen::ComplexSchur<MatrixType>&, const MatrixType&, bool)’:
../openscad_deps/include/eigen3/Eigen/src/Eigenvalues/ComplexSchur.h:312:66: warning: typedef ‘ComplexMatrixType’ locally defined but not used [-Wunused-local-typedefs]
     typedef typename ComplexSchur<MatrixType>::ComplexMatrixType ComplexMatrixType;
                                                                  ^
In file included from ../openscad_deps/include/boost/config.hpp:57:0,
                 from ../openscad_deps/include/boost/limits.hpp:14,
                 from ../openscad_deps/include/boost/math/special_functions/fpclassify.hpp:16,
                 from src/linalg.cc:2:
../openscad_deps/include/boost/math/policies/policy.hpp: In function ‘int boost::math::policies::detail::digits_imp(const true_&)’:
../openscad_deps/include/boost/static_assert.hpp:125:21: warning: typedef ‘boost_static_assert_typedef_822’ locally defined but not used [-Wunused-local-typedefs]
          BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
                     ^
../openscad_deps/include/boost/math/policies/policy.hpp:822:4: note: in expansion of macro ‘BOOST_STATIC_ASSERT’
    BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
    ^
../openscad_deps/include/boost/math/policies/policy.hpp: In function ‘T boost::math::policies::detail::get_epsilon_imp(const true_&)’:
../openscad_deps/include/boost/static_assert.hpp:125:21: warning: typedef ‘boost_static_assert_typedef_900’ locally defined but not used [-Wunused-local-typedefs]
          BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
                     ^
../openscad_deps/include/boost/math/policies/policy.hpp:900:4: note: in expansion of macro ‘BOOST_STATIC_ASSERT’
    BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized);
    ^
../openscad_deps/include/boost/static_assert.hpp:125:21: warning: typedef ‘boost_static_assert_typedef_901’ locally defined but not used [-Wunused-local-typedefs]
          BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
                     ^
../openscad_deps/include/boost/math/policies/policy.hpp:901:4: note: in expansion of macro ‘BOOST_STATIC_ASSERT’
    BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::radix == 2);
    ^
In file included from src/linalg.cc:2:0:
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp: In function ‘bool boost::math::isfinite(T)’:
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp:330:55: warning: typedef ‘fp_tag’ locally defined but not used [-Wunused-local-typedefs]
    typedef typename boost::is_floating_point<T>::type fp_tag;
                                                       ^
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp: In function ‘bool boost::math::isnormal(T)’:
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp:401:55: warning: typedef ‘fp_tag’ locally defined but not used [-Wunused-local-typedefs]
    typedef typename boost::is_floating_point<T>::type fp_tag;
                                                       ^
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp: In function ‘bool boost::math::isinf(T)’:
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp:490:55: warning: typedef ‘fp_tag’ locally defined but not used [-Wunused-local-typedefs]
    typedef typename boost::is_floating_point<T>::type fp_tag;
                                                       ^
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp: In function ‘bool boost::math::isnan(T)’:
../openscad_deps/include/boost/math/special_functions/fpclassify.hpp:573:55: warning: typedef ‘fp_tag’ locally defined but not used [-Wunused-local-typedefs]
    typedef typename boost::is_floating_point<T>::type fp_tag;
                                                       ^
donbright commented 10 years ago

google for +"-Wunused-local-typedef" +boost , it returns dozens of people describing similar situations on other projects. apparently it is very common to disable this warning. Boost itself is even doing this here (but in a future release):

https://svn.boost.org/trac/boost/changeset/85747

i vote to agree with you and disable this warning for GCC >4.8 in our build system.