Commit Graph

2134 Commits

Author SHA1 Message Date
kenton@google.com
d0580eafd3 Fixed alignment issue that caused bus errors on platforms like sparc which
require all memory reads to be aligned.  Specifically, it turns out that
sizeof(RepeatedField<bool>) is 20 on 64-bit sparc with GCC 3.4.6.  This is
strange, since one of RepeatedField's members is a pointer, which I thought
meant that it had to be 64-bit aligned, which means its size should be a
multiple of 64 bits.  But, 20 is not a multiple of 8.  I don't understand why
this is the case, but if this is possible, then DynamicMessage's strategy of
sorting fields in descending order by size and then tightly packing doesn't
work.  To fix this, I got rid of the sort step and instead added code that
aligns each field's offset appropriately based on the field's size.

Also in this revision:  Fix an error message that named a flag incorrectly.
2008-11-07 02:07:18 +00:00
kenton@google.com
de75437573 Simplify some template usage so that older compilers can handle it. (Users
report that MSVC 2003 in particular needs this change.)
2008-11-06 21:36:28 +00:00
kenton@google.com
3e91fcdd87 Work around GCC 4.3.0 x86_64 compiler bug (seen on Fedora 9).
Details:

For each message type, protoc generates an array of byte offsets of each of
the fields within the message class.  These offsets are later used by the
reflection implementation.  Prior to this revision, the offset arrays were
allocated as global variables.  Since they were just arrays of ints, they
should have been initialized at compile time.  Unfortunately, GCC 4.3.0
incorrectly decides that they cannot be initialized at compile time because
the values used to initialize the array have type ptrdiff_t, and GCC 4.3.0
does not recognize that it can convert ptrdiff_t to int at compile time.  This
bug did not seem to exist in previous versions of GCC.  Google's compiler
team has submitted a fix for this bug back to the GCC project, but we will
have to work around it anyway since Fedora 9 shipped with GCC 4.3.0.
2008-11-06 04:37:30 +00:00
Jon Skeet
60c059b8f0 Replaced copyright notice 2008-10-23 21:17:56 +01:00
Jon Skeet
20bfd9bf50 Fix bug in GeneratedBuilder.MergeFrom 2008-10-23 21:05:58 +01:00
Jon Skeet
b8c2fc57fc Fixed bug in GeneratedBuilder.MergeFrom - only fields already set in builder would be merged. 2008-10-22 14:19:05 +01:00
Jon Skeet
52a035a4af A few tweaks 2008-10-22 14:11:30 +01:00
Jon Skeet
87d6a3b8f7 Ignore solution cache files 2008-10-22 14:01:37 +01:00
Jon Skeet
6803686bc0 First cut at new layout 2008-10-22 13:30:34 +01:00
Jon Skeet
f0589506c9 Wiping slate clean to start again with new layout. 2008-10-22 13:18:49 +01:00
Jon Skeet
e60ce8bfaf Final commit before changing layout 2008-10-22 07:11:17 +01:00
kenton@google.com
580cf3c47c Update MSVC installation instructions for static linking change. 2008-10-21 17:18:26 +00:00
The Android Open Source Project
35be73bfeb Initial Contribution 2008-10-21 07:00:00 -07:00
kenton@google.com
3bdc135653 Avoid an "unused parameter" warning when using high warning levels. 2008-10-16 23:00:34 +00:00
kenton@google.com
7b29a2695c Update version number to 2.0.3-SNAPSHOT. 2008-10-16 22:56:18 +00:00
kenton@google.com
16b31d2a94 Make Python example output identical to C++ and Java by removing redundant
spaces.
2008-10-07 02:38:12 +00:00
kenton@google.com
a41a9dd532 * Fixed template specialization syntax that MSVC 2005 didn't like. Not sure if
it was valid or not.
* Moved UTF-8 coding directive to the right place in reflection_test.py.
2008-10-03 17:27:48 +00:00
Jon Skeet
7f90d8ee57 Made things a bit more public for the sake of ProtoGen 2008-10-02 21:46:17 +01:00
kenton@google.com
c76caaccb8 Improvements to configure.ac from Jeff Bailey. 2008-09-30 22:11:21 +00:00
kenton@google.com
cf3f638c92 Pass -Wall,no-obsolete to autoreconf. 2008-09-30 22:01:45 +00:00
kenton@google.com
7516a69050 Improve autogen.sh. 2008-09-30 20:55:25 +00:00
kenton@google.com
c7f06b2ad5 Added clarification to license that generated code is owned by the owner of the
input file.
2008-09-30 18:30:23 +00:00
kenton@google.com
9b10f5845a * Fix build on MSVC.
* Switch to statically-linked libraries instead of DLLs on MSVC.
2008-09-30 00:09:40 +00:00
kenton@google.com
0b3023fa65 Add file missing from rev 50. 2008-09-24 20:32:37 +00:00
kenton@google.com
24bf56fb3a Integrate changes from internal Google-internal branch.
General
  * License changed from Apache 2.0 to New BSD.
  * It is now possible to define custom "options", which are basically
    annotations which may be placed on definitions in a .proto file.
    For example, you might define a field option called "foo" like so:
      import "google/protobuf/descriptor.proto"
      extend google.protobuf.FieldOptions {
        optional string foo = 12345;
      }
    Then you annotate a field using the "foo" option:
      message MyMessage {
        optional int32 some_field = 1 [(foo) = "bar"]
      }
    The value of this option is then visible via the message's
    Descriptor:
      const FieldDescriptor* field =
        MyMessage::descriptor()->FindFieldByName("some_field");
      assert(field->options().GetExtension(foo) == "bar");
    This feature has been implemented and tested in C++ and Java.
    Other languages may or may not need to do extra work to support
    custom options, depending on how they construct descriptors.

  C++
  * Fixed some GCC warnings that only occur when using -pedantic.
  * Improved static initialization code, making ordering more
    predictable among other things.
  * TextFormat will no longer accept messages which contain multiple
    instances of a singular field.  Previously, the latter instance
    would overwrite the former.
  * Now works on systems that don't have hash_map.

  Python
  * Strings now use the "unicode" type rather than the "str" type.
    String fields may still be assigned ASCII "str" values; they will
    automatically be converted.
  * Adding a property to an object representing a repeated field now
    raises an exception.  For example:
      # No longer works (and never should have).
      message.some_repeated_field.foo = 1
2008-09-24 20:31:01 +00:00
kenton@google.com
3121a56ab4 Add file that was mysteriously missing from SVN tree. 2008-09-23 21:05:07 +00:00
kenton@google.com
a69deb6477 Explicitly identify superclass in initializer lists for generated message
classes.  This avoids a warning when using GCC's -pedantic option.
2008-09-23 20:03:24 +00:00
kenton@google.com
4410396f11 Work around absence of hash_map.
Also, update version numbers to 2.0.2-SNAPSHOT.
2008-09-19 16:53:32 +00:00
temporal
4014b9f83f Add @Override annotation to generated Java code where appropriate.
Patch from Brian Atkinson <nairb774@gmail.com>.
2008-09-17 02:41:14 +00:00
temporal
bf86b546c3 Add code suggested by Michal Januszewski <michalj@gmail.com> to ensure that
Python tests run correctly even when a previous version of the library is
already installed.  I was unable to reproduce his problem on my machine but
the fix seems harmless enough.
2008-09-15 17:58:05 +00:00
Jon Skeet
7fd62ffd77 Initial setup of generator code. Little real functionality so far. 2008-09-04 15:13:21 +01:00
Jon Skeet
4658a3dd7e Doc fix 2008-09-04 14:44:03 +01:00
Jon Skeet
dd9703ba53 Reduce dependencies 2008-09-04 14:43:43 +01:00
Jon Skeet
881db010cb Fix initialization check when an optional field has required subfields 2008-09-04 14:43:17 +01:00
Jon Skeet
0dabc77f7f Renamed GeneratedRepeatException to GeneratedRepeatExtension 2008-09-04 14:41:09 +01:00
Jon Skeet
be432ca43c Added a doc TODO 2008-09-04 14:35:05 +01:00
Jon Skeet
57be03df65 Removed unnecessary delegate 2008-09-04 14:34:01 +01:00
temporal
742e40975a 2.0.1 release. 2008-08-27 19:25:48 +00:00
Jon Skeet
0bf2ad145d Implemented popsicle immutability for lists. Modified MessageStreamIterator to be singly generic. 2008-08-21 21:57:58 +01:00
Jon Skeet
ad6903fe33 Fix to constructor access for nested types, and first pass at streaming. 2008-08-19 21:24:21 +01:00
temporal
dd681ad786 More prep for 2.0.1:
* Fix version number test so that it accepts "2.0.1rc1".
* Add missing type_checkers.py to Makefile.am.
2008-08-18 22:55:31 +00:00
temporal
ea9d0d85fb Add missing module to setup.py. 2008-08-18 22:38:20 +00:00
Jon Skeet
f09fed217f Small tidying. 2008-08-16 21:23:40 +01:00
Jon Skeet
2cbd799b5e Comments. 2008-08-15 21:24:06 +01:00
Jon Skeet
984eb9c27a Just comments. 2008-08-15 21:15:41 +01:00
Jon Skeet
3fa72c5556 Just the solution file - can be ignored. 2008-08-15 21:15:33 +01:00
Jon Skeet
0b6d39acc4 Remove unused variable. 2008-08-15 21:14:41 +01:00
Jon Skeet
92b0aaa09e Use a nullable int for the memoizedSize, just because it's neater. 2008-08-15 21:12:55 +01:00
Jon Skeet
9deef9baec Add aliases into enums 2008-08-15 20:57:15 +01:00
Jon Skeet
10ad653ce5 Reflect Java source code. 2008-08-15 20:48:16 +01:00