Fix Cygwin Newlib signal handler (Issue 315)
parent
7ce3922b97
commit
5596f73371
|
|
@ -690,7 +690,9 @@ NAMESPACE_END
|
||||||
# define THREADS_AVAILABLE
|
# define THREADS_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) || defined(__CYGWIN__)
|
// Newlib on Cygwin is a problem. __NEWLIB__ is not defined yet; use __CYGWIN__ as a proxy
|
||||||
|
// Also see https://github.com/weidai11/cryptopp/issues/315
|
||||||
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) && !defined(__CYGWIN__)
|
||||||
# define UNIX_SIGNALS_AVAILABLE 1
|
# define UNIX_SIGNALS_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
4
config.h
4
config.h
|
|
@ -690,7 +690,9 @@ NAMESPACE_END
|
||||||
# define THREADS_AVAILABLE
|
# define THREADS_AVAILABLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE) || defined(__CYGWIN__)
|
// Newlib on Cygwin is a problem. __NEWLIB__ is not defined yet; use __CYGWIN__ as a proxy
|
||||||
|
// Also see https://github.com/weidai11/cryptopp/issues/315
|
||||||
|
#if defined(CRYPTOPP_UNIX_AVAILABLE) && !defined(__CYGWIN__)
|
||||||
# define UNIX_SIGNALS_AVAILABLE 1
|
# define UNIX_SIGNALS_AVAILABLE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
2
test.cpp
2
test.cpp
|
|
@ -126,7 +126,7 @@ RandomNumberGenerator & GlobalRNG()
|
||||||
}
|
}
|
||||||
|
|
||||||
// See misc.h and trap.h for comments and usage
|
// See misc.h and trap.h for comments and usage
|
||||||
#if CRYPTOPP_DEBUG && (defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE))
|
#if CRYPTOPP_DEBUG && defined(UNIX_SIGNALS_AVAILABLE)
|
||||||
static const SignalHandler<SIGTRAP, false> s_dummyHandler;
|
static const SignalHandler<SIGTRAP, false> s_dummyHandler;
|
||||||
// static const DebugTrapHandler s_dummyHandler;
|
// static const DebugTrapHandler s_dummyHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
10
trap.h
10
trap.h
|
|
@ -21,9 +21,9 @@
|
||||||
#if CRYPTOPP_DEBUG
|
#if CRYPTOPP_DEBUG
|
||||||
# include <iostream>
|
# include <iostream>
|
||||||
# include <sstream>
|
# include <sstream>
|
||||||
# if defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE)
|
# if defined(UNIX_SIGNALS_AVAILABLE)
|
||||||
# include "ossig.h"
|
# include "ossig.h"
|
||||||
# elif defined(CRYPTOPP_WIN32_AVAILABLE)
|
# elif defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(__CYGWIN__)
|
||||||
# if (_MSC_VER >= 1400)
|
# if (_MSC_VER >= 1400)
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
@ -62,7 +62,7 @@
|
||||||
# define CRYPTOPP_ASSERT(exp) { ... }
|
# define CRYPTOPP_ASSERT(exp) { ... }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if CRYPTOPP_DEBUG && (defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE))
|
#if CRYPTOPP_DEBUG && defined(UNIX_SIGNALS_AVAILABLE)
|
||||||
# define CRYPTOPP_ASSERT(exp) { \
|
# define CRYPTOPP_ASSERT(exp) { \
|
||||||
if (!(exp)) { \
|
if (!(exp)) { \
|
||||||
std::ostringstream oss; \
|
std::ostringstream oss; \
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
raise(SIGTRAP); \
|
raise(SIGTRAP); \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
#elif CRYPTOPP_DEBUG && defined(CRYPTOPP_WIN32_AVAILABLE)
|
#elif CRYPTOPP_DEBUG && defined(CRYPTOPP_WIN32_AVAILABLE) && !defined(__CYGWIN__)
|
||||||
# define CRYPTOPP_ASSERT(exp) { \
|
# define CRYPTOPP_ASSERT(exp) { \
|
||||||
if (!(exp)) { \
|
if (!(exp)) { \
|
||||||
std::ostringstream oss; \
|
std::ostringstream oss; \
|
||||||
|
|
@ -96,7 +96,7 @@ NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
// ************** SIGTRAP handler ***************
|
// ************** SIGTRAP handler ***************
|
||||||
|
|
||||||
#if (CRYPTOPP_DEBUG && (defined(CRYPTOPP_BSD_AVAILABLE) || defined(CRYPTOPP_UNIX_AVAILABLE))) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
#if (CRYPTOPP_DEBUG && defined(UNIX_SIGNALS_AVAILABLE)) || defined(CRYPTOPP_DOXYGEN_PROCESSING)
|
||||||
//! \brief Default SIGTRAP handler
|
//! \brief Default SIGTRAP handler
|
||||||
//! \details DebugTrapHandler() can be used by a program to install an empty SIGTRAP handler. If present,
|
//! \details DebugTrapHandler() can be used by a program to install an empty SIGTRAP handler. If present,
|
||||||
//! the handler ensures there is a signal handler in place for <tt>SIGTRAP</tt> raised by
|
//! the handler ensures there is a signal handler in place for <tt>SIGTRAP</tt> raised by
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue