build: Remove -Werror from release build (and possibly default to release)
Over the years, I have suggested to start using release as our default profile for ns-3-allinone (possibly also for ns-3-dev) and to remove -Werror from that profile. This has met with some resistance in the past (I'm not exactly sure why-- I do not remember the details) so I'll try again now that it has been a few years (see https://www.nsnam.org/bugzilla/show_bug.cgi?id=2938 for most recent discussion) and because we are making the CMake transition now.
The reason that I think it is important is that compilers evolve and become more pedantic, and then future users have a bad experience with old code that they find and try to use. They then post on ns-3-users (or perhaps walk away in frustration). On ns-3-users, I will point them to use --disable-werror (if it is available) or instruct on how to use CXXFLAGS to work around this.
Our default debug profile generates, for example:
/usr/bin/c++ -DHAVE_BOOST -DHAVE_BOOST_UNITS -DHAVE_GSL -DHAVE_LIBXML2 -DNS3_ASSERT_ENABLE
-DNS3_BUILD_PROFILE_DEBUG -DNS3_LOG_ENABLE -DPROJECT_SOURCE_PATH=\"/home/tomh/temp/ns-3-dev\"
-D__LINUX__ -I/home/tomh/temp/ns-3-dev/build/include -g -fPIC -fno-semantic-interposition
-Wall -Werror -std=gnu++17 -o CMakeFiles/libcore-obj.dir/model/realtime-simulator-impl.cc.o -c
/home/tomh/temp/ns-3-dev/src/core/model/realtime-simulator-impl.cc
Our release profile generates:
/usr/bin/c++ -DHAVE_BOOST -DHAVE_BOOST_UNITS -DHAVE_GSL -DHAVE_LIBXML2
-DNS3_BUILD_PROFILE_OPTIMIZED -DPROJECT_SOURCE_PATH=\"/home/tomh/temp/ns-3-dev\" -D__LINUX__
-I/home/tomh/temp/ns-3-dev/build/include -O3 -DNDEBUG -fPIC -fno-semantic-interposition -Wall
-Werror -std=gnu++17 -o CMakeFiles/libcore-obj.dir/model/realtime-simulator-impl.cc.o -c
/home/tomh/temp/ns-3-dev/src/core/model/realtime-simulator-impl.cc
(this may be a small bug to include -DNS3_BUILD_PROFILE_OPTIMIZED here)
Our optimized profile generates:
/usr/bin/c++ -DHAVE_BOOST -DHAVE_BOOST_UNITS -DHAVE_GSL -DHAVE_LIBXML2
-DNS3_BUILD_PROFILE_OPTIMIZED -DPROJECT_SOURCE_PATH=\"/home/tomh/temp/ns-3-dev\" -D__LINUX__
-I/home/tomh/temp/ns-3-dev/build/include -O3 -DNDEBUG -fPIC -fno-semantic-interposition -Wall
-Werror -march=native -mtune=native -std=gnu++17 -o CMakeFiles/libcore-obj.dir/model/realtime-
simulator-impl.cc.o -c /home/tomh/temp/ns-3-dev/src/core/model/realtime-simulator-impl.cc
I might prefer defaulting to a release build that had some level of optimization for improved execution time (we could profile a bit to find a sweet spot, both for g++ and clang++), and enabled logs and asserts, and did not include -Werror.
Comments?