added slsWarnings and c++17 compiler option

This commit is contained in:
2026-07-06 22:28:16 +02:00
parent 474bda497e
commit 059b9c7177
8 changed files with 51 additions and 30 deletions
@@ -38,15 +38,24 @@ template <typename DerivedDetectorServer> class DetectorServer {
std::unique_ptr<DetectorServerImpl> impl;
auto *const getDerivedImpl() const {
return static_cast<typename DerivedDetectorServer::ImplType *const>(
auto *getDerivedImpl() {
return static_cast<typename DerivedDetectorServer::ImplType *>(
impl.get());
}
const auto *getDerivedImpl() const {
return static_cast<const typename DerivedDetectorServer::ImplType *>(
impl.get());
}
private:
/// @brief get derived class
DerivedDetectorServer *const getDerived() {
return static_cast<DerivedDetectorServer *const>(this);
DerivedDetectorServer *getDerived() {
return static_cast<DerivedDetectorServer *>(this);
}
const DerivedDetectorServer *getDerived() const {
return static_cast<const DerivedDetectorServer *>(this);
}
ProcessedResult processFunction(const detFuncs function_id,
@@ -423,7 +432,8 @@ ProcessedResult DetectorServer<DerivedDetectorServer>::get_version(
->get_server_version(); // TODO: get Impl from derived server
char version_cstr[MAX_STR_LENGTH]{};
strncpy(version_cstr, version.c_str(), version.size());
std::snprintf(version_cstr, sizeof(version_cstr), "%s",
version.c_str()); // ensures temination
LOG(TLogLevel::logDEBUG) << "Server Version: " << version;
return ProcessedResult{static_cast<ReturnCode>(socket.sendResult(
version_cstr))}; // TODO: check what would be possible return codes!!!
@@ -35,7 +35,7 @@ template <typename T>
void setRegisterField(uint32_t &registervalue, const RegisterField &reg_field,
T field_value) {
if (field_value > reg_field.bitmask) {
if (field_value > static_cast<T>(reg_field.bitmask)) {
throw std::invalid_argument(
fmt::format("Value {} cannot fit in field with bitmask {}",
field_value, reg_field.bitmask));