Skip to content

Commit 7e4e265

Browse files
author
nobody
committed
wip
1 parent 872389f commit 7e4e265

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

include/class_loader/class_loader.h

-4
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,11 @@ std::string systemLibraryFormat(const std::string & library_name);
7575
class ClassLoader
7676
{
7777
public:
78-
#if __cplusplus >= 201103L
7978
template<typename Base>
8079
using DeleterType = std::function<void (Base *)>;
8180

8281
template<typename Base>
8382
using UniquePtr = std::unique_ptr<Base, DeleterType<Base>>;
84-
#endif
8583

8684
/**
8785
* @brief Constructor for ClassLoader
@@ -125,7 +123,6 @@ class ClassLoader
125123
);
126124
}
127125

128-
#if __cplusplus >= 201103L
129126
/// Generates an instance of loadable classes (i.e. class_loader).
130127
/**
131128
* It is not necessary for the user to call loadLibrary() as it will be
@@ -148,7 +145,6 @@ class ClassLoader
148145
std::bind(&ClassLoader::onPluginDeletion<Base>, this, std::placeholders::_1)
149146
);
150147
}
151-
#endif
152148

153149
/// Generates an instance of loadable classes (i.e. class_loader).
154150
/**

test/CMakeLists.txt

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ add_library(${PROJECT_NAME}_TestPlugins1 EXCLUDE_FROM_ALL SHARED plugins1.cpp)
66
target_include_directories(${PROJECT_NAME}_TestPlugins1
77
PUBLIC "../include" ${console_bridge_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS})
88
target_link_libraries(${PROJECT_NAME}_TestPlugins1 ${PROJECT_NAME})
9-
class_loader_hide_library_symbols(${PROJECT_NAME}_TestPlugins1)
10-
9+
# class_loader_hide_library_symbols(${PROJECT_NAME}_TestPlugins1)
10+
target_compile_definitions(${PROJECT_NAME}_TestPlugins1 PRIVATE "CLASS_LOADER_BUILDING_DLL")
11+
class_loader_hide_library_symbols(${PROJECT_NAME}_TestPlugins2)
1112
add_library(${PROJECT_NAME}_TestPlugins2 EXCLUDE_FROM_ALL SHARED plugins2.cpp)
1213
target_include_directories(${PROJECT_NAME}_TestPlugins2
1314
PUBLIC "../include" ${console_bridge_INCLUDE_DIRS} ${Poco_INCLUDE_DIRS})
1415
target_link_libraries(${PROJECT_NAME}_TestPlugins2 ${PROJECT_NAME})
16+
target_compile_definitions(${PROJECT_NAME}_TestPlugins2 PRIVATE "CLASS_LOADER_BUILDING_DLL")
1517
class_loader_hide_library_symbols(${PROJECT_NAME}_TestPlugins2)
1618

1719
set(append_library_dirs "${CMAKE_CURRENT_BINARY_DIR}")
@@ -20,6 +22,7 @@ if(WIN32)
2022
set(append_library_dirs "${append_library_dirs}/$<CONFIG>")
2123
endif()
2224

25+
message(WARNING "append_library_dirs: ${append_library_dirs}")
2326
ament_add_gtest(${PROJECT_NAME}_utest utest.cpp
2427
APPEND_LIBRARY_DIRS "${append_library_dirs}"
2528
)
@@ -40,8 +43,8 @@ endif()
4043

4144
include(CheckCXXCompilerFlag)
4245
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
43-
if(false)
44-
# if(COMPILER_SUPPORTS_CXX11)
46+
# if(false)
47+
if(COMPILER_SUPPORTS_CXX11)
4548
find_package(Boost REQUIRED COMPONENTS thread)
4649
ament_add_gtest(${PROJECT_NAME}_unique_ptr_test unique_ptr_test.cpp)
4750
if(TARGET ${PROJECT_NAME}_unique_ptr_test)

test/utest.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEST(ClassLoaderTest, nonExistentPlugin)
7474
}
7575

7676
obj->saySomething();
77-
} catch (const class_loader::CreateClassException & e) {
77+
} catch (const class_loader::CreateClassException &) {
7878
SUCCEED();
7979
return;
8080
} catch (...) {
@@ -88,7 +88,7 @@ TEST(ClassLoaderTest, nonExistentLibrary)
8888
{
8989
try {
9090
class_loader::ClassLoader loader1("libDoesNotExist.so", false);
91-
} catch (const class_loader::LibraryLoadException & e) {
91+
} catch (const class_loader::LibraryLoadException &) {
9292
SUCCEED();
9393
return;
9494
} catch (...) {
@@ -115,7 +115,7 @@ TEST(ClassLoaderTest, invalidBase)
115115
} else {
116116
FAIL() << "Class not available for correct base class.";
117117
}
118-
} catch (const class_loader::LibraryLoadException & e) {
118+
} catch (const class_loader::LibraryLoadException &) {
119119
FAIL() << "Unexpected exception";
120120
} catch (...) {
121121
FAIL() << "Unexpected and unknown exception caught.\n";
@@ -161,7 +161,7 @@ TEST(ClassLoaderTest, threadSafety)
161161
loader1.unloadLibrary();
162162
ASSERT_FALSE(loader1.isLibraryLoaded());
163163

164-
} catch (const class_loader::ClassLoaderException & ex) {
164+
} catch (const class_loader::ClassLoaderException &) {
165165
FAIL() << "Unexpected ClassLoaderException.";
166166
} catch (...) {
167167
FAIL() << "Unknown exception.";
@@ -194,7 +194,7 @@ TEST(ClassLoaderTest, loadRefCountingNonLazy)
194194
ASSERT_TRUE(loader1.isLibraryLoaded());
195195

196196
return;
197-
} catch (const class_loader::ClassLoaderException & e) {
197+
} catch (const class_loader::ClassLoaderException &) {
198198
FAIL() << "Unexpected exception.\n";
199199
} catch (...) {
200200
FAIL() << "Unknown exception caught.\n";
@@ -235,7 +235,7 @@ TEST(ClassLoaderTest, loadRefCountingLazy)
235235
ASSERT_TRUE(loader1.isLibraryLoaded());
236236

237237
return;
238-
} catch (const class_loader::ClassLoaderException & e) {
238+
} catch (const class_loader::ClassLoaderException &) {
239239
FAIL() << "Unexpected exception.\n";
240240
} catch (...) {
241241
FAIL() << "Unknown exception caught.\n";

0 commit comments

Comments
 (0)