On 2014-03-21 19:39 +0100, Johan Engelen wrote:
Hi all, I'd like people to check what compiler errors are reported for trunk on their system (Windows I can do myself), with these flags:
-Wall -Wformat -Werror=format-security -W -Wpointer-arith -Wcast-align -Wsign-compare -Woverloaded-virtual -Werror=switch -Werror=return-type -Werror -Wno-error=pointer-sign -Wno-error=unused-parameter -Wno-error=unused-but-set-variable -Wno-error=strict-overflow -Wno-error=write-strings -Wno-error=format -Wno-error=format-extra-args
Please no comments about whether you like these flags or not, just what build *errors* you get. (don't send me the warnings please!)
System: OS X 10.7.5, Xcode 4.3.2
$ llvm-gcc-4.2 --version i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
$ clang --version Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
1a) llvm-gcc-4.2: fails during configure:
checking whether the C++ compiler works... no
config.log: cc1plus: error: -Werror=unused-but-set-variable: No option -Wunused-but-set-variable
1b) if '-Werror=unused-but-set-variable' is removed from $CPPFLAGS, build fails here:
CXX gc.o cc1plus: warnings being treated as errors ../../src/gc.cpp: In function ‘void Inkscape::GC::<unnamed>::do_init()’: ../../src/gc.cpp:31: warning: ‘GC_no_dls’ is deprecated (declared at /Volumes/magenta/mp-trunk/quartz/include/gc/gc.h:257) ../../src/gc.cpp:32: warning: ‘GC_all_interior_pointers’ is deprecated (declared at /Volumes/magenta/mp-trunk/quartz/include/gc/gc.h:143) ../../src/gc.cpp:33: warning: ‘GC_finalize_on_demand’ is deprecated (declared at /Volumes/magenta/mp-trunk/quartz/include/gc/gc.h:159) make[1]: *** [gc.o] Error 1
1c) Running 'make -k' (not a reliable check, I know) to continue:
- All C files produces new warnings: CC libcroco/cr-utils.o cc1: warning: command line option "-Woverloaded-virtual" is valid for C++/ObjC++ but not for C
- Don't see this error with regular builds, why now? In file included from /Volumes/magenta/mp-trunk/quartz/include/glibmm-2.4/glibmm.h:89, from /Volumes/magenta/mp-trunk/quartz/include/gdkmm-2.4/gdkmm/pixbuf.h:9, from ../../src/libdepixelize/kopftracer2011.h:32, from ../../src/libdepixelize/kopftracer2011.cpp:36: /Volumes/magenta/mp-trunk/quartz/include/glibmm-2.4/glibmm/threads.h:201: error: field ‘gobject_’ has incomplete type /Volumes/magenta/mp-trunk/quartz/include/glibmm-2.4/glibmm/threads.h: In member function ‘GThread* Glib::Threads::Thread::gobj()’: /Volumes/magenta/mp-trunk/quartz/include/glibmm-2.4/glibmm/threads.h:197: error: ‘gobject_’ was not declared in this scope /Volumes/magenta/mp-trunk/quartz/include/glibmm-2.4/glibmm/threads.h: In member function ‘const GThread* Glib::Threads::Thread::gobj() const’: /Volumes/magenta/mp-trunk/quartz/include/glibmm-2.4/glibmm/threads.h:198: error: ‘gobject_’ was not declared in this scope make[3]: *** [libdepixelize/kopftracer2011.o] Error 1
- another warning treated as error: cc1plus: warnings being treated as errors ../../src/display/nr-filter-gaussian.cpp: In function ‘void Inkscape::Filters::filter2D_IIR(PT*, int, int, const PT*, int, int, int, int, const IIRValue*, const double*, IIRValue* const*, int) [with PT = unsigned char, unsigned int PC = 1u, bool PREMULTIPLIED_ALPHA = false]’: ../../src/display/nr-filter-gaussian.cpp:503: instantiated from here ../../src/display/nr-filter-gaussian.cpp:342: warning: comparison of unsigned expression < 0 is always false ../../src/display/nr-filter-gaussian.cpp:503: instantiated from here ../../src/display/nr-filter-gaussian.cpp:357: warning: comparison of unsigned expression < 0 is always false make[3]: *** [display/nr-filter-gaussian.o] Error 1
2a) clang: boost warning during configure:
checking boost/unordered_set.hpp presence... yes configure: WARNING: boost/unordered_set.hpp: present but cannot be compiled <snip> checking for boost/unordered_set.hpp... no
2b) default build on OS X with lcms1: clang errors out here:
In file included from ../../src/color-profile.cpp:36: /Volumes/magenta/mp-trunk/quartz/include/lcms.h:1418:14: error: comparison of unsigned expression < 0 is always false [-Werror,-Wtautological-compare] if (size < 0) return NULL; // Prevent signed size_t exploits ~~~~ ^ ~
2c) if configured to use lcms2 to avoid above error, clang errors out a couple of files later:
../../src/libcroco/cr-enc-handler.c:92:32: error: cast from 'enum CREncoding *' to 'CREncHandler *' (aka 'struct _CREncHandler *') increases required alignment from 4 to 8 [-Werror,-Wcast-align] return (CREncHandler *) ^~~~~~~~~~~~~~~~
There are tons of cast-align warnings with clang and current boost 1.55, like these (from regular clang build):
In file included from ../../src/display/drawing.h:21: In file included from ../../src/display/drawing-item.h:19: In file included from /Volumes/magenta/mp-trunk/quartz/include/boost/intrusive/list.hpp:20: In file included from /Volumes/magenta/mp-trunk/quartz/include/boost/intrusive/list_hook.hpp:19: In file included from /Volumes/magenta/mp-trunk/quartz/include/boost/intrusive/detail/utilities.hpp:33: In file included from /Volumes/magenta/mp-trunk/quartz/include/boost/functional/hash.hpp:6: In file included from /Volumes/magenta/mp-trunk/quartz/include/boost/functional/hash/hash.hpp:15: /Volumes/magenta/mp-trunk/quartz/include/boost/functional/hash/detail/hash_float.hpp:71:25: warning: cast from 'char *' to 'std::size_t *' (aka 'unsigned long *') increases required alignment from 1 to 8 [-Wcast-align] seed = *(std::size_t*) ptr; ^~~~~~~~~~~~~~~~~~
... so even fixing all cast-align warnings from Inkscape (lots of them with clang e.g. from src/extension/internal/emf* src/extension/internal/wmf* ) would not help.
It seems that this older version of clang doesn't interpret the order or type of the flags as expected - AFAIU cast-align warnings are not meant to be treated as errors?
Regards, V
P.S. I am aware that I use an outdated version of of clang from an outdated version of Xcode (4.3.2) on an outdated version of OS X (10.7.5) and that sooner or later Inkscape (trunk) will no longer support building on system like these.