summaryrefslogtreecommitdiff
path: root/upb
AgeCommit message (Collapse)Author
2016-05-12Added UPB_ASSERT() that helps avoid unused var warnings.Joshua Haberman
* Added UPB_ASSERT() that helps avoid unused var warnings. * Addressed PR comments. * Fixed assert in the JIT.
2016-04-25Updated URL to Tarjan set union paper.Josh Haberman
2016-04-22Fixed small omission: upb_env_init2(). (#61)Joshua Haberman
2016-04-21Put oneofs in the same table as fields. (#60)Joshua Haberman
* Put oneofs in the same table as fields. Oneofs and fields are not allowed to have names that conflict, so we might as well put them all in the same table. This also allows an efficient operation that looks for both fields and oneofs in a single lookup. Added support for OneofDef to Lua to allow testing of this. * Addressed PR comments.
2016-04-19Changed schema for JSON test to be defined in a .proto file. (#54)Joshua Haberman
* Changed schema for JSON test to be defined in a .proto file. Before we had lots of code to build these schemas manually, but this was verbose and made it difficult to add to the schema easily. Now we can just write a .proto file and adding fields is easy. To avoid making the tests depend on upbc (and thus Lua) we check in the generated schema. * Made protobuf-compiler a dependency of "make genfiles." * For genfiles download recent protoc that can handle proto3. * Only use new protoc for genfiles.
2016-04-19Split upb::Arena/upb::Allocator from upb::Environment. (#58)Joshua Haberman
* Split upb::Arena/upb::Allocator from upb::Environment. This will allow arenas and allocators to be used independently of environments, which will be important for an upcoming change (a message representation). Overall this design feels cleaner that the previous Environment/SeededAllocator design. As part of this change, moved all allocations in upb to use a global allocator instead of hard-coding malloc/free. This will allow injecting OOM faults for more robust testing. One place that doesn't use the global allocator is the tracked ref code. Instead of its previous approach of CHECK_OOM() after every malloc() or table insert, it simply uses an allocator that does this automatically. I moved Allocator/Arena/Environment into upb.h. This seems principled since these are the only types in upb whose size is directly exposed to users, since they form the basis of memory allocation strategy. * Cleaned up some header includes and fixed more malloc -> upb_gmalloc(). * Changes from PR review. * Don't use UINTPTR_MAX or UINT64_MAX. * Punt on adding line/file for now. * We actually can't store (uint64_t)-1, update comment and test.
2016-04-15Also regenerate JSON parser.Josh Haberman
2016-04-15Fix for JSON error reporting. (#57)Joshua Haberman
Clearly upb needs more tests in its repository. Running the protobuf conformance tests against upb would be a great start...
2016-04-14JSON parser: always accept both name variants, flag controls which we generate.Joshua Haberman
* JSON parser: always accept both name variants, flag controls which we generate. My previous commit was based on wrong information about the proto3 JSON spec. It turns out we need to accept both field name formats all the time, and a runtime flag should control which we generate. * Documented the preserve_proto_fieldnames option. * Fix bugs in PR.
2016-04-14Added migration flag for users using old JSON format.Josh Haberman
2016-04-06Refactored upb_def_freeze() a bit per PR comments.Josh Haberman
2016-04-06Changes for PR comments.Josh Haberman
2016-04-05Added upb::FileDef, which represents the file defs are declared in.Josh Haberman
It is entirely optional: MessageDef/EnumDef can still exist on their own. But this can represent a def's file when it is desirable to do so (eg. for code generators). This approach will require that we change the way we handle extensions. But I think it will be a good change overall. Specifically, we previously handled extensions by duplicating the extended message and then adding the extension as a regular field to the duplicated message. This required also duplicating any messages that could reach the extended message. In the new world we will need a way of declaring and looking up extensions separately from the message being extended. This change also involves some notable changes to the generated code: - files are now called foo.upbdefs.h instead of foo.upb.h. This reflects the fact that we might possibly generate several different output files for a .proto file, and this one is just for defs. - we no longer generate selectors in the .h file. - the upbdefs.c no longer vends a SymbolTable. Now it vends the individual messages (and possibly a FileDef later). I think this will compose better once we can generate files where one generated files imports another. We also make the descriptor reader vend a list of FileDefs now. This is the best conceptual match for parsing a FileDescriptorSet.
2016-03-08Make OneofDef stop deriving from Def.Josh Haberman
It is clear now that oneofs are different form other defs in one important way: they are not top-level constructs that can stand on their own in a SymbolTable, for example. If you are iterating over a list of Defs in a SymbolTable, there is no chance you will run into a oneof. To reflect this reality, OneofDef no longer derives from Def, and the UPB_DEF_ONEOF is no longer an enum value that needs to be handled.
2016-02-21Add missing FieldDef::index() definitionMattia Barbon
2016-02-18Fixed const correctness of json_nice_escape().Josh Haberman
2016-02-18Merge pull request #48 from jackdoe/masterJoshua Haberman
make googlepb compile with gcc < 4.5.1
2016-02-18indent according to google-style-guideborislav nikolov
https://google.github.io/styleguide/cppguide.html#Constructor_Initializer_Lists ``` // If the signature and initializer list are not all on one line, // you must wrap before the colon and indent 4 spaces: MyClass::MyClass(int var) : some_var_(var), some_other_var_(var + 1) { DoSomething(); } ``` and ``` // As with any other code block, the close curly can be on the same // line as the open curly, if it fits. MyClass::MyClass(int var) : some_var_(var) {} ```
2016-02-17Added assertions for getjsonname() return.Josh Haberman
2016-02-17Addressed code review comments.Josh Haberman
2016-02-17Changed JSON parser/printer to correctly camelCase names.Josh Haberman
2016-02-17make it compile with gcc < 4.5.1borislav nikolov
$ make Q= googlepb g++ -O3 -std=c++98 -pedantic -Wno-long-long -Wall -Wextra -Wpointer-arith -Wno-unused-private-field -I. -DNDEBUG -c -o obj/upb/bindings/googlepb/bridge.o upb/bindings/googlepb/bridge.cc In file included from ./upb/handlers.h:22, from ./upb/bindings/googlepb/bridge.h:42, from upb/bindings/googlepb/bridge.cc:8: ./upb/def.h: In constructor ‘upb::Pointer<upb::Def>::Pointer(upb::Def*)’: ./upb/def.h:39: error: class ‘upb::Pointer<upb::Def>’ does not have any field named ‘PointerBase’ ./upb/def.h:39: error: no matching function for call to ‘upb::PointerBase<upb::Def, upb::RefCounted>::PointerBase()’ ./upb/upb.h:246: note: candidates are: upb::PointerBase<T, Base>::PointerBase(T*) [with T = upb::Def, Base = upb::RefCounted] ./upb/upb.h:244: note: upb::PointerBase<upb::Def, upb::RefCounted>::PointerBase(const upb::PointerBase<upb::Def, upb::RefCounted>&) ... the generated code looks like: template <> class Pointer<upb::Def> : public PointerBase<upb::Def, upb::RefCounted> { public: explicit Pointer(upb::Def* ptr) : PointerBase(ptr) {} }; .. which falls into https://gcc.gnu.org/bugzilla/show_bug.cgi?id=189 (http://stackoverflow.com/questions/8887864/template-base-constructor-call-in-member-initialization-list-error) changing the generated code to: template <> class Pointer<upb::Def> : public PointerBase<upb::Def, upb::RefCounted> { public: explicit Pointer(upb::Def* ptr) : PointerBase<upb::Def, upb::RefCounted>(ptr) {} }; makes it compile at least on 4.4.7 that we are testing with: $ gcc -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC)
2016-01-26Added small explanatory comment.Josh Haberman
2016-01-19Optimized upb_inttable_compact(): it shrinks inttables more now.Josh Haberman
2016-01-06Merge pull request #45 from mbarbon/fix-status-initJoshua Haberman
Make sure upb_pbdecoder.status is initialized
2015-12-30Make sure upb_pbdecoder.status is initializedMattia Barbon
Otherwhise the end message callback is passed a garbage value.
2015-12-30Add missing upb_fielddef_fullname implementationMattia Barbon
2015-10-21Addressed PR comments.Josh Haberman
2015-10-15Properly populate field presence flag on messages according to syntax flag.Josh Haberman
2015-10-14Add flag to MessageDef for whether fields have presence.Josh Haberman
2015-08-19Refer to a shared definition for max buffered bytes.Josh Haberman
2015-08-14Added lots of decoder tests and fixed lots of bugs.Josh Haberman
2015-08-11More decoder fixes, and slightly changed parse call semantics.Josh Haberman
Prior to this change, if an error was returned, it would be guaranteed to always return a short byte count. Now the two concepts are a bit more orthogonal. There are cases where the entire input is consumed even though an error was encountered.
2015-07-31Decoder fix: skipped data at end of submessage.Josh Haberman
2015-07-30Fixed PR for JIT-enabled builds.Josh Haberman
2015-07-30Changed parser semantics around skipping.Josh Haberman
Prior to this change: parse(buf, len) -> len + N ...would indicate that the next N bytes of the input are not needed, *and* would advance the decoding position by this much. After this change: parse(buf, len) -> len + N parse(NULL, N) -> N ...can be used to achieve the same thing. But skipping the N bytes is not explicitly performed by the user. A user that doesn't want/need to skip can just say: parsed = parse(buf, len); if (parsed < len) { // Handle suspend, advance stream by "parsed". } else { // Stream was advanced by "len" (even if parsed > len). } Updated unit tests to test this new behavior, and refactored test utility code a bit to support it.
2015-07-15Clear JSON parser status in reset.Josh Haberman
2015-07-15Updated JSON parser size.Josh Haberman
2015-07-15Fixed JSON parser error reporting.Josh Haberman
This was previously broken -- it would try to set the status object on the parser, but the pointer was never initialized. Also it didn't report errors properly to the environment object.
2015-07-07Also remove license headers from Lua.Josh Haberman
2015-07-07Updated license headers for Ragel source also.Josh Haberman
2015-07-07Brought into compliance with Google open-source policies.Josh Haberman
- removed myself from Author headers in source files. - removed copyright notices from source file headers. - added CONTRIBUTING.md
2015-07-07Moved DynASM to third_party to comply with Google policy.Josh Haberman
2015-06-22Merge pull request #30 from haberman/encoderfixJoshua Haberman
Fixed some bad bugs in upb_env.
2015-06-22Fixed some bad bugs in upb_env.Josh Haberman
Also added a unit test for upb_encoder that demonstrates the bugs and the fix.
2015-06-15Addressed code review comment and clarified comments.Josh Haberman
2015-06-12Fix for stack overflow for cyclic defs.Josh Haberman
Fixes this bug that came up in the Ruby extension: https://github.com/google/protobuf/issues/425
2015-06-12Fix amalgamation by changing include style for structdef.int.h.Josh Haberman
2015-06-06Fix for va_copy.Josh Haberman
2015-06-04Fixes from Google-internal.Josh Haberman
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback