aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Sean Lu <luyixiang@gmail.com>2017-01-19 11:56:08 -0800
committerGravatar GitHub <noreply@github.com>2017-01-19 11:56:08 -0800
commite41b667da50d582ac8e38cfea4af4e78261f2ad3 (patch)
treee7bd30c96cf47d6e2003779dc14573ce5614d1a7
parent047575f20cbdee8fb2f88d78a317ffe6133b93e6 (diff)
Undef TYPE_BOOL to avoid conflict with iOS.
TYPE_BOOL is defined as a macro in <ConditionalMacros.h>, which gets implicitly included in almost all iOS source files. This fixes complaints like http://go/soverflow/15759559 For some context, here is how TYPE_BOOL is defined in ConditionalMacros.h #ifdef __cplusplus #define TYPE_BOOL 1 #else #define TYPE_BOOL 0 #endif
-rw-r--r--src/google/protobuf/wire_format_lite.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index cfd1688c..3aa66e8f 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -45,6 +45,16 @@
#include <google/protobuf/message_lite.h>
#include <google/protobuf/io/coded_stream.h> // for CodedOutputStream::Varint32Size
+// Avoid conflict with iOS where <ConditionalMacros.h> #defines TYPE_BOOL.
+//
+// If some one needs the macro TYPE_BOOL in a file that includes this header, it's
+// possible to bring it back using push/pop_macro as follows.
+//
+// #pragma push_macro("TYPE_BOOL")
+// #include this header and/or all headers that need the macro to be undefined.
+// #pragma pop_macro("TYPE_BOOL")
+#undef TYPE_BOOL
+
namespace google {
namespace protobuf {