Building SimpleWallet
fails with 3 different errors related to GCC -Werror
checks.
-Werror=unused-const-variable
-Werror=terminate
(see also #1)-Werror=logical-op
System:
# cat /etc/redhat-release
Fedora release 25 (Twenty Five)
# uname -r
4.12.8-200.fc25.x86_64
# gcc --version
gcc (GCC) 6.4.1 20170727 (Red Hat 6.4.1-1)
[...]
# cmake --version
cmake version 3.9.1
[...]
Building via
mkdir build
cd build
cmake ..
make SimpleWallet
Expected behavior
make SimpleWallet
runs through without errors
Actual behavior
3 different compile errors due to warnings treated as errors via -Werror
:
[ 24%] Building C object src/CMakeFiles/Crypto.dir/crypto/oaes_lib.c.o
/root/tmpfs/dinastycoin/src/crypto/oaes_lib.c:30:19: error: ‘_NR’ defined but not used [-Werror=unused-const-variable=]
static const char _NR[] = {
^~~
/root/tmpfs/dinastycoin/src/crypto/slow-hash.cpp: In destructor ‘Crypto::cn_context::~cn_context()’:
/root/tmpfs/dinastycoin/src/crypto/slow-hash.cpp:70:23: error: throw will always call terminate() [-Werror=terminate]
throw bad_alloc();
/root/tmpfs/dinastycoin/src/Platform/Linux/System/TcpConnection.cpp: In member function ‘size_t System::TcpConnection::read(uint8_t*, size_t)’:
/root/tmpfs/dinastycoin/src/Platform/Linux/System/TcpConnection.cpp:84:26: error: logical ‘and’ of equal expressions [-Werror=logical-op]
if (errno != EAGAIN && errno != EWOULDBLOCK) {
Workaround:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 290f843..52851d1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -53,7 +53,7 @@ else()
else()
set(ARCH_FLAG "-march=${ARCH}")
endif()
- set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result")
+ set(WARNINGS "-Wall -Wextra -Wpointer-arith -Wundef -Wvla -Wwrite-strings -Werror -Wno-error=extra -Wno-error=unused-function -Wno-error=deprecated-declarations -Wno-error=sign-compare -Wno-error=strict-aliasing -Wno-error=type-limits -Wno-unused-parameter -Wno-error=unused-variable -Wno-error=undef -Wno-error=uninitialized -Wno-error=unused-result -Wno-error=unused-const-variable -Wno-error=terminate -Wno-error=misleading-indentation -Wno-error=logical-op")
if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(WARNINGS "${WARNINGS} -Wno-error=mismatched-tags -Wno-error=null-conversion -Wno-overloaded-shift-op-parentheses -Wno-error=shift-count-overflow -Wno-error=tautological-constant-out-of-range-compare -Wno-error=unused-private-field -Wno-error=unneeded-internal-declaration -Wno-error=unused-function -Wno-error=missing-braces")
else()
Appying these changes makes SimpleWallet
compile. This is clearly a
workaround and no fix since the original errors found by the compiler
are simply masked for error checking.
Posted on Utopian.io - Rewarding Open Source Contributors
Thank you for the contribution. It has been approved.
Consider using the latest gcc and g++ :P 7.2.0
You can contact us on Discord.
[utopian-moderator]
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Hey @stmdev I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit