diff options
author | liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2012-12-04 22:06:04 +0000 |
---|---|---|
committer | liujisi@google.com <liujisi@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2012-12-04 22:06:04 +0000 |
commit | e7194890617095d1857314ef06217a43554a1211 (patch) | |
tree | 91d29d6d8adb7049cef369324c3f82c9bc1decf6 /src/google | |
parent | caa66db018a89a64b3912bcee0c4e1653ce5875e (diff) | |
download | protobuf-e7194890617095d1857314ef06217a43554a1211.tar.gz protobuf-e7194890617095d1857314ef06217a43554a1211.tar.bz2 protobuf-e7194890617095d1857314ef06217a43554a1211.zip |
Make PROTOBUF_USE_EXCEPTIONS configurable from CPPFLAGS.
Diffstat (limited to 'src/google')
-rw-r--r-- | src/google/protobuf/stubs/common.cc | 4 | ||||
-rw-r--r-- | src/google/protobuf/stubs/common.h | 13 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc index f4bb92dc..0112d992 100644 --- a/src/google/protobuf/stubs/common.cc +++ b/src/google/protobuf/stubs/common.cc @@ -191,7 +191,7 @@ void LogMessage::Finish() { } if (level_ == LOGLEVEL_FATAL) { -#ifdef PROTOBUF_USE_EXCEPTIONS +#if PROTOBUF_USE_EXCEPTIONS throw FatalException(filename_, line_, message_); #else abort(); @@ -383,7 +383,7 @@ void ShutdownProtobufLibrary() { internal::shutdown_functions_mutex = NULL; } -#ifdef PROTOBUF_USE_EXCEPTIONS +#if PROTOBUF_USE_EXCEPTIONS FatalException::~FatalException() throw() {} const char* FatalException::what() const throw() { diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index e8916b05..f287ddfb 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -48,12 +48,17 @@ #include <stdint.h> #endif +#ifndef PROTOBUF_USE_EXCEPTIONS #if defined(_MSC_VER) && defined(_CPPUNWIND) - #define PROTOBUF_USE_EXCEPTIONS + #define PROTOBUF_USE_EXCEPTIONS 1 #elif defined(__EXCEPTIONS) - #define PROTOBUF_USE_EXCEPTIONS + #define PROTOBUF_USE_EXCEPTIONS 1 +#else + #define PROTOBUF_USE_EXCEPTIONS 0 +#endif #endif -#ifdef PROTOBUF_USE_EXCEPTIONS + +#if PROTOBUF_USE_EXCEPTIONS #include <exception> #endif @@ -1188,7 +1193,7 @@ LIBPROTOBUF_EXPORT void OnShutdown(void (*func)()); } // namespace internal -#ifdef PROTOBUF_USE_EXCEPTIONS +#if PROTOBUF_USE_EXCEPTIONS class FatalException : public std::exception { public: FatalException(const char* filename, int line, const std::string& message) |