Skip to content
Snippets Groups Projects
Commit 1691fac8 authored by Christoph Hasse's avatar Christoph Hasse :cartwheel_tone1:
Browse files

remove exception() indirection

parent 94dbc43e
No related branches found
No related tags found
1 merge request!2699FunctorFactory, replace CLING backend with native compiler
......@@ -119,8 +119,6 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
if ( msgLevel( MSG::DEBUG ) ) { debug() << m_all.size() << " functors were registered" << endmsg; }
auto exception = []( auto const& name ) { return GaudiException{name, "FunctorFactory", StatusCode::FAILURE}; };
std::string full_lib_code{"#if defined(__clang__)\n"};
full_lib_code += "#pragma clang diagnostic ignored \"-Wreturn-type-c-linkage\"\n";
full_lib_code += "#endif\n";
......@@ -198,7 +196,7 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
auto total_time =
std::chrono::duration_cast<std::chrono::seconds>( std::chrono::high_resolution_clock::now() - start_time );
info() << "Compilation of functor library took " << total_time.count() << " seconds" << endmsg;
if ( return_code != 0 ) { throw exception( "Non zero return code!\n" ); }
if ( return_code != 0 ) { throw GaudiException{"Non zero return code!", "FunctorFactory", StatusCode::FAILURE}; }
if ( msgLevel( MSG::VERBOSE ) ) {
verbose() << "Rename " << lib_tmp_full_path << " to " << lib_full_path << endmsg;
......@@ -208,7 +206,9 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
m_lib_handle = LibHandle{dlopen( lib_full_path.c_str(), RTLD_LOCAL | RTLD_LAZY ), lib_closer};
}
if ( m_lib_handle == nullptr ) { throw exception( std::string( "dlopen Error:\n" ) + dlerror() ); }
if ( m_lib_handle == nullptr ) {
throw GaudiException{std::string( "dlopen Error:\n" ) + dlerror(), "FunctorFactory", StatusCode::FAILURE};
}
// at this point we have compiled the functors so now it is time to make
// sure that we initialize each algorithm's functors
......@@ -217,7 +217,9 @@ struct FunctorFactory : public extends<Service, Functors::IFactory> {
auto function_name = Functors::Cache::hashToFuncName( entry.first );
auto factory_function =
reinterpret_cast<factory_function_ptr>( dlsym( m_lib_handle.get(), function_name.c_str() ) );
if ( factory_function == nullptr ) { throw exception( std::string( "dlsym Error:\n" ) + dlerror() ); }
if ( factory_function == nullptr ) {
throw GaudiException{std::string( "dlsym Error:\n" ) + dlerror(), "FunctorFactory", StatusCode::FAILURE};
}
for ( auto const& copy_func : entry.second.first ) {
auto functor = factory_function();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment