mirror of
https://github.com/OPM/opm-simulators.git
synced 2024-12-28 02:00:59 -06:00
Catch exceptions by const reference to prevent warnings.
e.g. gcc issued: "warning: catching polymorphic type ‘class cl::Error’ by value [-Wcatch-value=]"
This commit is contained in:
parent
faaee51d09
commit
efd3aeb290
@ -514,13 +514,13 @@ void openclSolverBackend<block_size>::initialize(int N_, int nnz_, int dim, doub
|
||||
|
||||
prec->setKernels(ILU_apply1_k.get(), ILU_apply2_k.get());
|
||||
|
||||
} catch (cl::Error error) {
|
||||
} catch (const cl::Error& error) {
|
||||
std::ostringstream oss;
|
||||
oss << "OpenCL Error: " << error.what() << "(" << error.err() << ")\n";
|
||||
oss << getErrorString(error.err());
|
||||
// rethrow exception
|
||||
OPM_THROW(std::logic_error, oss.str());
|
||||
} catch (std::logic_error error) {
|
||||
} catch (const std::logic_error& error) {
|
||||
// rethrow exception by OPM_THROW in the try{}, without this, a segfault occurs
|
||||
throw error;
|
||||
}
|
||||
@ -665,13 +665,13 @@ void openclSolverBackend<block_size>::solve_system(WellContributions& wellContri
|
||||
// actually solve
|
||||
try {
|
||||
gpu_pbicgstab(wellContribs, res);
|
||||
} catch (cl::Error error) {
|
||||
} catch (const cl::Error& error) {
|
||||
std::ostringstream oss;
|
||||
oss << "openclSolverBackend::solve_system error: " << error.what() << "(" << error.err() << ")\n";
|
||||
oss << getErrorString(error.err());
|
||||
// rethrow exception
|
||||
OPM_THROW(std::logic_error, oss.str());
|
||||
} catch (std::logic_error error) {
|
||||
} catch (const std::logic_error& error) {
|
||||
// rethrow exception by OPM_THROW in the try{}, without this, a segfault occurs
|
||||
throw error;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user