diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-14 23:12:52 +0000 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2017-03-14 23:41:54 +0000 |
commit | 416f90939d4de58fe1a4e2489120010313183291 (patch) | |
tree | 4c879e5f8255c7d8ffbec69954042331cf1eee09 /src/google/protobuf/compiler/cpp/cpp_file.h | |
parent | 43f2db776c265a9b22500e7a67af583b2b4ce85f (diff) | |
download | protobuf-416f90939d4de58fe1a4e2489120010313183291.tar.gz protobuf-416f90939d4de58fe1a4e2489120010313183291.tar.bz2 protobuf-416f90939d4de58fe1a4e2489120010313183291.zip |
Fix freebsd build.
It turns out system headers included by generated plugin.pb.h file already contains
major/minor macro definitions when built on FreeBSD and we need to add #undefs to
the generated header file.
This change also fixes another compile error regarding EXPECT_DEATH on FreeBSD.
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_file.h')
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_file.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.h b/src/google/protobuf/compiler/cpp/cpp_file.h index 25d6eabf..e3fbb96d 100644 --- a/src/google/protobuf/compiler/cpp/cpp_file.h +++ b/src/google/protobuf/compiler/cpp/cpp_file.h @@ -133,6 +133,15 @@ class FileGenerator { void GenerateProto2NamespaceEnumSpecializations(io::Printer* printer); + // Sometimes the names we use in a .proto file happen to be defined as macros + // on some platforms (e.g., macro/minor used in plugin.proto are defined as + // macros in sys/types.h on FreeBSD and a few other platforms). To make the + // generated code compile on these platforms, we either have to undef the + // macro for these few platforms, or rename the field name for all platforms. + // Since these names are part of protobuf public API, renaming is generally + // a breaking change so we prefer the #undef approach. + void GenerateMacroUndefs(io::Printer* printer); + const FileDescriptor* file_; const Options options_; |