-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional -Werror flag #5
Conversation
CMakeLists.txt
Outdated
option(WERROR "Add -Werror flag to build (turns warnings into errors)" ON) | ||
|
||
# Note: -D_GLIBCXX_USE_CXX11_ABI=0 is needed to support mason packages that are precompiled libs | ||
# Currently we only depend on a header only library, but this will help avoid issues when more libs are added via mason | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wsign-compare -Wconversion -Wshadow") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks as if you grabbed the comments about -D_GLIBCXX_USE_CXX11_ABI=0
without the actual flag being added to the CMAKE_CXX_FLAGS
? Best to pull that over too.
@GretaCB just reviewed overall and have some suggestions to consider as you push tomorrow:
diff --git a/Makefile b/Makefile
index 179e1bb..75c578f 100644
--- a/Makefile
+++ b/Makefile
@@ -4,13 +4,16 @@ export WERROR ?= true
default: release
release:
- mkdir -p build && cd build && cmake ../ -DCMAKE_BUILD_TYPE=Release -DWERROR=$(WERROR) && VERBOSE=1 cmake --build .
+ mkdir -p build/Release && cd build/Release && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DWERROR=$(WERROR) && VERBOSE=1 cmake --build .
debug:
- mkdir -p build && cd build && cmake ../ -DCMAKE_BUILD_TYPE=Debug -DWERROR=$(WERROR) && VERBOSE=1 cmake --build .
+ mkdir -p build/Debug && cd build/Debug && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DWERROR=$(WERROR) && VERBOSE=1 cmake --build .
-test:
- @if [ -f ./build/unit-tests ]; then ./build/unit-tests; else echo "Please run 'make release' or 'make debug' first" && exit 1; fi
+test: release debug
+ @echo "Running tests for Debug mode"
+ ./build/Debug/unit-tests
+ @echo "Running tests for Release mode"
+ ./build/Release/unit-tests
tidy:
./scripts/clang-tidy.sh |
@springmeyer I just pushed updates per chat earlier:
|
Great.
Good call 👍
In the near term I think we should stop comparing lengths. Because there are legitimate reasons for the encoded string to be longer than the raw string. So we should do away with all these comparisons. That leaves the question of how to test. I think in the short term we could simply ensure round-tripping works. In the long germ I think we should move to having:
This way we can ensure the output is exactly as we expect. And we would pick up differences, say, between our results and another implementation like #7. |
Ok cool so:
Now just need to troubleshoot the compile errors in Travis |
Update
|
I don't think we need/want to have |
Makefile
Outdated
default: release | ||
|
||
release: | ||
mkdir -p build && cd build && cmake ../ -DCMAKE_BUILD_TYPE=Release && VERBOSE=1 cmake --build . | ||
mkdir -p build/Release && cd build/Release && cmake ../../ -DCMAKE_BUILD_TYPE=Release -DWERROR=$(WERROR) && VERBOSE=1 cmake --build . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@springmeyer I'm noticing this is much different than the bench and the hpp-skel master Makefiles. Curious if you have a preference. I also noticed that this conflicts with how clang-tidy runs (I have it setup locally, not in this branch). Perhaps it has something to do with the extra ../
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm noticing this is much different than the bench and the hpp-skel master Makefiles.
This was done so we could have make test
run both release and debug tests while developing. I think we should roll back to match hpp-skel
now that development is slowing down.
I also noticed that this conflicts with how clang-tidy runs (I have it setup locally, not in this branch).
Whoops, that was an oversight. So, hopefully rolling back to match hpp-skel
will help the clang-tidy scripts find things right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Syncing with master and I'll keep the WERROR flag in there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmmm, perhaps only for Debug build
Makefile
Outdated
mkdir -p build && cd build && cmake ../ -DCMAKE_BUILD_TYPE=Debug && VERBOSE=1 cmake --build . | ||
mkdir -p build/Debug && cd build/Debug && cmake ../../ -DCMAKE_BUILD_TYPE=Debug -DWERROR=$(WERROR) && VERBOSE=1 cmake --build . | ||
|
||
test: release debug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didnt merge the fancy if logic from master that checks for the existence of the unit-tests binary since we're compiling both debug and release during tests.
Makefile
Outdated
|
||
bench: | ||
@if [ -f ./build/bench-tests ]; then ./build/bench-tests; else echo "Please run 'make release' or 'make debug' first" && exit 1; fi | ||
|
||
test: default | ||
@if [ -f ./build/unit-tests ]; then ./build/unit-tests; else echo "Please run 'make release' or 'make debug' first" && exit 1; fi | ||
tidy: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing and will add in a separate branch
Makefile
Outdated
|
||
coverage: | ||
./scripts/coverage.sh | ||
|
||
clean: | ||
rm -rf build | ||
|
||
format: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing and will add in a separate branch
Shoot, after re-adding the tests, looks like a couple more errors popped up. Taking a peek. Also debugging the Dockerfile now that the make commands have changed. |
Looks like we've got a segfault in the tests. Trying to spin up the Docker image to try and recreate/troubleshoot, but the Dockerfile is failing when checking for the CXX compiler:
The same error occurs when I revert back to the Makefile we had earlier this week when we got the image compiling successfully. |
I'm not sure if docker ignores hidden directories in its COPY. If not then I wonder if the dockerfile problem is due to the |
@springmeyer 👍 That did the trick. Uncovered another leak, diving in 🏊♀️ |
Noticing the last commit failed only with clang++ and only with the release build. Very peculiar. It fails with:
https://travis-ci.org/mapbox/gzip-hpp/jobs/280809852#L638 Looks like that the Line 94 in e765e3d
Thoughts are:
|
Tried to replicate locally with the |
was able to extract a crashlog using
|
^^ was missing line numbers since
|
Amazing sleuthing @springmeyer , thank you for poking at this. Looks like it's crashing at
...wondering if it makes sense to end deflate here if deflate was never able to fully initiate. |
Removing gzip-hpp/include/gzip/decompress.hpp Line 20 in e3a946a
Overall, great work, stoked to see this 🍏! |
Great catch @springmeyer . Committed the changes, Travis is 🍏 , going to 🚢 . Next PR is for tidy/format. |
Noting here that this branch was a big lift because we had a number of aggressive warnings enabled which started error-ing when we added |
Per #2
Next Actions
std::string
functions and only allowchar *
(per Update Readme #1 (comment))Add tidy and format scriptscc @springmeyer @mapsam