ibaned / gmodel

Gmsh model generation library
Other
13 stars 6 forks source link

clang complains on osx #9

Closed cwsmith closed 6 years ago

cwsmith commented 6 years ago

This PR silences some warnings from clang on my macbook running High Sierra (10.13.4 (17E202)).

clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ibaned commented 6 years ago

I think these ought to be fixed in the code instead of just silenced... can you send the output before silencing?

cwsmith commented 6 years ago

OK.

-Wzero-as-null-pointer-constant

[  5%] Building CXX object CMakeFiles/gmodel.dir/gmodel.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++     --std=c++11 -O2 -g -fno-omit-frame-pointer -ferror-limit=1 -Werror -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-float-equal -Wno-weak-template-vtables -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk   -o CMakeFiles/gmodel.dir/gmodel.cpp.o -c /Users/cwsmith/develop/gmodel/gmodel.cpp
/Users/cwsmith/develop/gmodel/gmodel.cpp:33:21: error: zero as null pointer constant [-Werror,-Wzero-as-null-pointer-constant]
    /* LOOP    = */ 0,
                    ^
                    nullptr
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.

-Wunused-template

[  5%] Building CXX object CMakeFiles/gmodel.dir/gmodel.cpp.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   --std=c++11 -O2 -g -fno-omit-frame-pointer -ferror-limit=1 -Werror -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-padded -Wno-float-equal -Wno-weak-template-vtables-Wno-zero-as-null-pointer-constant -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk   -o CMakeFiles/gmodel.dir/gmodel.cpp.o -c /Users/cwsmith/develop/gmodel/gmodel.cpp
/Users/cwsmith/develop/gmodel/gmodel.cpp:67:12: error: unused function template 'size'
      [-Werror,-Wunused-template]
static int size(std::vector<T> const& v) {
           ^
1 error generated.
ibaned commented 6 years ago

I just pushed a commit, let me know if it helps.

cwsmith commented 6 years ago

Using the nullptr in a few other spots results in a clean build and all tests passing (100% tests passed, 0 tests failed out of 7). I reset the CMakelists.txt changes and commited to this branch (osx-clang-warnings d3eefc3).