diff --git a/.travis.yml b/.travis.yml index c0cb07c..f7a7e4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -92,7 +92,7 @@ matrix: - ./scripts/publish.sh --toolset=${TOOLSET:-} --debug=$([ "${BUILDTYPE}" == 'debug' ] && echo "true" || echo "false") # g++ build (default builds all use clang++) - os: linux - env: BUILDTYPE=debug CXX="g++-6" CC="gcc-6" + env: BUILDTYPE=debug CXX="g++-6" CC="gcc-6" CXXFLAGS="-Weffc++" node_js: 4 addons: apt: diff --git a/Makefile b/Makefile index 58835c1..554a191 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,8 @@ MODULE_NAME := $(shell node -e "console.log(require('./package.json').binary.module_name)") +# Whether to turn compiler warnings into errors +export WERROR ?= true + default: release node_modules: @@ -8,11 +11,11 @@ node_modules: npm install --ignore-scripts release: node_modules - V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error + V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=$(WERROR) --loglevel=error @echo "run 'make clean' for full rebuild" debug: node_modules - V=1 ./node_modules/.bin/node-pre-gyp configure build --loglevel=error --debug + V=1 ./node_modules/.bin/node-pre-gyp configure build --error_on_warnings=$(WERROR) --loglevel=error --debug @echo "run 'make clean' for full rebuild" coverage: diff --git a/README.md b/README.md index 4efced1..5aa9e12 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,13 @@ make # build binaries make test ``` +Note: by default the build errors on compiler warnings. To disable this do: + +``` +WERROR=false make +``` + + # Code coverage Code coverage is critical for knowing how well your tests actually test all your code. To see code coverage you can view current results online at [![codecov](https://codecov.io/gh/mapbox/node-cpp-skel/branch/master/graph/badge.svg)](https://codecov.io/gh/mapbox/node-cpp-skel) or you can build in a customized way and display coverage locally like: diff --git a/binding.gyp b/binding.gyp index 4f79c28..6e04665 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,5 +1,14 @@ { 'includes': [ 'common.gypi' ], + 'variables': { + 'error_on_warnings%':'true', + # includes we don't want warnings for. + # As a variable to make easy to pass to + # cflags (linux) and xcode (mac) + 'system_includes': [ + "-isystem <(module_root_dir)/ cb; // callback function type std::string phrase;