Skip to content
This repository was archived by the owner on May 16, 2024. It is now read-only.

Commit 606383c

Browse files
metsmamrts
authored andcommitted
Use default compiler parameters and don't throw in destructor
WE2-404 Signed-off-by: Raul Metsma <[email protected]>
1 parent c2dbbd9 commit 606383c

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ target_link_libraries(${PROJECT_NAME} PRIVATE
4545
$<$<CXX_COMPILER_ID:MSVC>:Ws2_32>
4646
)
4747

48-
# Common compile options.
49-
50-
set(CMAKE_CXX_EXTENSIONS OFF)
51-
5248
# PC/SC API dependencies.
5349

5450
add_library(pcsc INTERFACE)

include/pcsc-cpp/pcsc-cpp.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ class SmartCard
209209
{
210210
public:
211211
TransactionGuard(const CardImpl& CardImpl, bool& inProgress);
212-
~TransactionGuard() noexcept(false);
212+
~TransactionGuard();
213213

214214
// The rule of five (C++ Core guidelines C.21).
215215
TransactionGuard(const TransactionGuard&) = delete;

src/SmartCard.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,14 @@ SmartCard::TransactionGuard::TransactionGuard(const CardImpl& card, bool& inProg
242242
inProgress = true;
243243
}
244244

245-
SmartCard::TransactionGuard::~TransactionGuard() noexcept(false)
245+
SmartCard::TransactionGuard::~TransactionGuard()
246246
{
247247
inProgress = false;
248-
// endTransaction() may throw, should be OK as TransactionGuard does not own resources.
249-
// TODO: Log in case endTransaction() throws.
250-
card.endTransaction();
248+
try {
249+
card.endTransaction();
250+
} catch (...) {
251+
// Ignore exceptions in destructor.
252+
}
251253
}
252254

253255
SmartCard::SmartCard(const ContextPtr& contex, const string_t& readerName, byte_vector atr) :

tests/lib/libpcsc-mock

0 commit comments

Comments
 (0)