sst-core
sst-core copied to clipboard
Fix GCC-10 warnings
When compiling with GCC-10 (10.2.1 and 10.3 on two different systems) I encountered a number of minor warnings, all fixed by this patch. This is based on v11.0.0_FINAL 0001-Fix-GCC10-compilation-warnings.patch.txt .
I'll take a look. I do see references to c++17, and we are still only allowing c++11 in the core code base at this point due to some older compilers we still support (I'm prepping a PR now that will add a lot more information to the CONTRIBUTING to expose more of the "tribal knowledge" from the internal team). We've been having internal discussions on how to handle this. We will likely go back to specifying c++11 explicitly.
Ahh, ok on C++ version. In ns-3 we've had the same discussions. We recently moved to C++-17 when it was pointed out all our supported platform/compiler combinations now support C++-17, so it was safe to set that explicitly.
Just following up on some of the changes in the patch above:
Language standard: as of 2022-02-23 the build issues -std=c++1y
, the pre-final label for C++-14. The code also uses alignas
in a few places, and newer GCC complains that requires -faligned-new
(or higher language standard). So there is some sort of conflict there.
Incidentally, configure puts any user-provided CXXFLAGS before the built ins, so it's not easy to change the language standard and see what happens.
// fallthrough
is a GNU extension, so not portable. [[fallthrough]]
from C++17 is portable
Presumably fixing the mismatched types in serialize_X are not problematic?
Here is an additional patch to fix type and width mismatches. (It also a few [[fallthrough]]
and [[maybe_unused]]
you can ignore.)
Revised and broken out by issue:
Rebased
I am no longer seeing compiler warnings with (Apple) Clang 14.0.3 or (Homebrew) GCC 13.1.0, but all the patches from https://github.com/sstsimulator/sst-core/issues/736#issuecomment-1125512738 are applied in #960 except for the fallthrough case, which is no longer relevant.
Done in #960.