Commit e7194890 authored by liujisi@google.com's avatar liujisi@google.com

Make PROTOBUF_USE_EXCEPTIONS configurable from CPPFLAGS.

parent caa66db0
...@@ -191,7 +191,7 @@ void LogMessage::Finish() { ...@@ -191,7 +191,7 @@ void LogMessage::Finish() {
} }
if (level_ == LOGLEVEL_FATAL) { if (level_ == LOGLEVEL_FATAL) {
#ifdef PROTOBUF_USE_EXCEPTIONS #if PROTOBUF_USE_EXCEPTIONS
throw FatalException(filename_, line_, message_); throw FatalException(filename_, line_, message_);
#else #else
abort(); abort();
...@@ -383,7 +383,7 @@ void ShutdownProtobufLibrary() { ...@@ -383,7 +383,7 @@ void ShutdownProtobufLibrary() {
internal::shutdown_functions_mutex = NULL; internal::shutdown_functions_mutex = NULL;
} }
#ifdef PROTOBUF_USE_EXCEPTIONS #if PROTOBUF_USE_EXCEPTIONS
FatalException::~FatalException() throw() {} FatalException::~FatalException() throw() {}
const char* FatalException::what() const throw() { const char* FatalException::what() const throw() {
......
...@@ -48,12 +48,17 @@ ...@@ -48,12 +48,17 @@
#include <stdint.h> #include <stdint.h>
#endif #endif
#ifndef PROTOBUF_USE_EXCEPTIONS
#if defined(_MSC_VER) && defined(_CPPUNWIND) #if defined(_MSC_VER) && defined(_CPPUNWIND)
#define PROTOBUF_USE_EXCEPTIONS #define PROTOBUF_USE_EXCEPTIONS 1
#elif defined(__EXCEPTIONS) #elif defined(__EXCEPTIONS)
#define PROTOBUF_USE_EXCEPTIONS #define PROTOBUF_USE_EXCEPTIONS 1
#else
#define PROTOBUF_USE_EXCEPTIONS 0
#endif
#endif #endif
#ifdef PROTOBUF_USE_EXCEPTIONS
#if PROTOBUF_USE_EXCEPTIONS
#include <exception> #include <exception>
#endif #endif
...@@ -1188,7 +1193,7 @@ LIBPROTOBUF_EXPORT void OnShutdown(void (*func)()); ...@@ -1188,7 +1193,7 @@ LIBPROTOBUF_EXPORT void OnShutdown(void (*func)());
} // namespace internal } // namespace internal
#ifdef PROTOBUF_USE_EXCEPTIONS #if PROTOBUF_USE_EXCEPTIONS
class FatalException : public std::exception { class FatalException : public std::exception {
public: public:
FatalException(const char* filename, int line, const std::string& message) FatalException(const char* filename, int line, const std::string& message)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment