diff --git a/Intern/rayx-core/src/Data/DatFile.cpp b/Intern/rayx-core/src/Data/DatFile.cpp index 352000fd..d98dd1cb 100644 --- a/Intern/rayx-core/src/Data/DatFile.cpp +++ b/Intern/rayx-core/src/Data/DatFile.cpp @@ -24,6 +24,7 @@ bool DatFile::load(const std::filesystem::path& filename, DatFile* out) { if (sscanf(line.c_str(), "%u %le %le %le", &out->m_lineCount, &out->m_start, &out->m_end, &out->m_step) != 4) { #endif RAYX_EXIT << "Failed to parse DatFile \"" << filename << "\", at line 2: \"" << line << "\""; + return false; } out->m_Lines.reserve(out->m_lineCount); @@ -41,6 +42,7 @@ bool DatFile::load(const std::filesystem::path& filename, DatFile* out) { if (sscanf(line.c_str(), "%le %le", &e.m_energy, &e.m_weight) != 2) { #endif RAYX_EXIT << "Failed to parse DatFile \"" << filename << "\", at line " << lineidx << ": \"" << line << "\""; + return false; } out->m_Lines.push_back(e); out->m_weightSum += e.m_weight; diff --git a/Intern/rayx-core/src/Data/Strings.cpp b/Intern/rayx-core/src/Data/Strings.cpp index 33db4695..00eda202 100644 --- a/Intern/rayx-core/src/Data/Strings.cpp +++ b/Intern/rayx-core/src/Data/Strings.cpp @@ -37,6 +37,7 @@ ElementType findElementString(const std::string& name) { } else { RAYX_LOG << "Could not find element with name: " << name; RAYX_EXIT << "Error in findElementString(const std::string&): Element not found"; + return ElementType::ImagePlane; // or some other default/fallback value } } } // namespace RAYX diff --git a/Intern/rayx-core/src/Data/xml.cpp b/Intern/rayx-core/src/Data/xml.cpp index b72cad7a..37f89902 100644 --- a/Intern/rayx-core/src/Data/xml.cpp +++ b/Intern/rayx-core/src/Data/xml.cpp @@ -375,6 +375,7 @@ bool paramEnergyDistribution(const rapidxml::xml_node<>* node, const std::filesy RAYX_EXIT << "paramEnergyDistribution is not implemented for " "energyDistributionType" << static_cast(energyDistributionType) << "!"; + return false; } } @@ -568,6 +569,7 @@ Cutout Parser::parseCutout(DesignPlane plane, std::string type) const { return parseTotalLength(); } else { RAYX_EXIT << "parseCutout encountered an invalid design plane!"; + return 0.0; } }; @@ -590,6 +592,7 @@ Cutout Parser::parseCutout(DesignPlane plane, std::string type) const { return serializeTrapezoid(trapezoid); } else { RAYX_EXIT << "invalid geometrical shape!"; + return {0, {0.0, 0.0, 0.0}}; } } diff --git a/Intern/rayx-core/src/Element/Behaviour.cpp b/Intern/rayx-core/src/Element/Behaviour.cpp index b7b45597..1d9f3323 100644 --- a/Intern/rayx-core/src/Element/Behaviour.cpp +++ b/Intern/rayx-core/src/Element/Behaviour.cpp @@ -48,6 +48,7 @@ Cutout mkOpeningCutout(const DesignElement& dele) { }); } else { RAYX_EXIT << "unsupported opening type!"; + return {}; } } @@ -71,6 +72,7 @@ Cutout mkBeamstopCutout(const DesignElement& dele) { }); } else { RAYX_EXIT << "unsupported CentralBeamstop type!"; + return {}; } } diff --git a/Intern/rayx-core/src/Material/Material.cpp b/Intern/rayx-core/src/Material/Material.cpp index 3505634a..20d28e39 100644 --- a/Intern/rayx-core/src/Material/Material.cpp +++ b/Intern/rayx-core/src/Material/Material.cpp @@ -30,6 +30,7 @@ const char* getMaterialName(Material m) { #undef X } RAYX_EXIT << "unknown material in getMaterialName()!"; + return nullptr; } // std::vector over all materials @@ -50,6 +51,7 @@ bool materialFromString(const char* matname, Material* out) { } } RAYX_EXIT << "materialFromString(): material \"" << matname << "\" not found"; + return false; } MaterialTables loadMaterialTables(std::array relevantMaterials) { diff --git a/Intern/rayx-core/src/Tracer/Tracer.cpp b/Intern/rayx-core/src/Tracer/Tracer.cpp index 9cae5605..a5fc18f3 100644 --- a/Intern/rayx-core/src/Tracer/Tracer.cpp +++ b/Intern/rayx-core/src/Tracer/Tracer.cpp @@ -29,6 +29,7 @@ inline std::shared_ptr createDeviceTracer(DeviceType deviceT return std::make_shared>(deviceIndex); #else RAYX_EXIT << "Failed to create Tracer with Hip device. Hip was disabled during build."; + return nullptr; #endif default: // case DeviceType::Cpu using CpuAcc = RAYX::DefaultCpuAcc; diff --git a/Intern/rayx-core/src/Writer/Writer.cpp b/Intern/rayx-core/src/Writer/Writer.cpp index efe84f30..fb2254ad 100644 --- a/Intern/rayx-core/src/Writer/Writer.cpp +++ b/Intern/rayx-core/src/Writer/Writer.cpp @@ -23,6 +23,7 @@ FormatComponent componentFromString(const std::string& comp) { } RAYX_WARN << "Cannot evaluate format component \"" << comp << "\"!"; RAYX_EXIT << "A valid format would be \"" << defaultFormatString() << "\""; + return {}; } Format formatFromString(const std::string& s) { diff --git a/Intern/rayx-core/tests/setupTests.cpp b/Intern/rayx-core/tests/setupTests.cpp index b96b181a..2a453689 100644 --- a/Intern/rayx-core/tests/setupTests.cpp +++ b/Intern/rayx-core/tests/setupTests.cpp @@ -16,6 +16,7 @@ double parseDouble(std::string s) { #endif RAYX_WARN << "parseDouble failed for string:"; RAYX_EXIT << s; + return false; } return d; }