gecko-dev/toolkit/components/protobuf
Nathan Froyd 5506155fa1 Bug 1186561 - add #include <vector> to a protobuf header to work around problems on Android; r=fitzgen
Compiling Gecko with libc++ and GCC 4.9 on Android runs into a problem.
The protobuf #includes and libc++ result in preprocessed code that looks
something like:

/* via <iterator> */

namespace std {
namespace __1 {
}
using namespace __1 __attribute__((__strong__));
}

namespace std { namespace __1 {
template <class _Iter>
class __wrap_iter
{
  ...
  template <class _Tp, class _Alloc> friend class vector;
  ...
};

} // namespace __1
} // namespace std

/* via <vector> */

namespace std { namespace __1 {

template <class _Tp, class _Alloc>
class _LIBCPP_TYPE_VIS_ONLY vector : ...
{ ... };

} // namespace __1
} // namespace std

and the problem is that GCC doesn't understand that the forward
declaration of vector inside __wrap_iter is forward-declaring the actual
vector class; it thinks it's declaring something else.

Hacking <iterator> to include _LIBCPP_TYPE_VIS_ONLY for the forward
declaration doesn't help.  What does help is including <vector> earlier
than <iterator>, so the __wrap_iter forward declaration picks up the
correct definition of std::vector, and makes everything happy.  It's
possible that there are other places that could get this same treatment,
but this one place was the only one I needed to modify to make things
go.
2015-07-22 15:10:03 -04:00
..
src/google/protobuf Bug 1186561 - add #include <vector> to a protobuf header to work around problems on Android; r=fitzgen 2015-07-22 15:10:03 -04:00
COPYING.txt Bug 812238 - Initial import of protobuf 2.4.1. r=khuey 2012-11-30 10:33:48 -08:00
README.txt Bug 1024774 - Part 0: Upgrade the protobuf library. r=mmc,glandium 2015-05-28 07:37:42 -07:00
m-c-changes.patch Bug 1186561 - add #include <vector> to a protobuf header to work around problems on Android; r=fitzgen 2015-07-22 15:10:03 -04:00
moz.build Bug 1024774 - Part 0: Upgrade the protobuf library. r=mmc,glandium 2015-05-28 07:37:42 -07:00
upgrade_protobuf.sh Bug 1024774 - Part 0: Upgrade the protobuf library. r=mmc,glandium 2015-05-28 07:37:42 -07:00

README.txt

Protocol Buffers (protobuf) source is available (via svn) at:

    svn checkout http://protobuf.googlecode.com/svn/trunk/ protobuf-read-only

Or via git at:

    https://github.com/google/protobuf

This code is covered under the BSD license (see COPYING.txt). Documentation is
available at http://code.google.com/p/protobuf.

The tree's current version of the protobuf library is 2.6.1.

We do not include the protobuf tests or the protoc compiler.

--------------------------------------------------------------------------------

# Upgrading the Protobuf Library

1. Get a new protobuf release from https://github.com/google/protobuf/releases

2. Run `$ ./toolkit/components/protobuf/upgrade_protobuf.sh ~/path/to/release/checkout/of/protobuf`.

3. Update the moz.build to export the new set of headers and add any new .cc
   files to the unified sources and remove old ones.