Commit Graph

1378 Commits

Author SHA1 Message Date
Wouter van Oortmerssen 3694ae0817 Disallow defaults on structs.
Change-Id: Ia098126c92ea6f8abe94561bd9c09b29ac8f61f5
Context: https://github.com/google/flatbuffers/issues/4591
Tested: on Linux.
2018-01-18 11:41:43 -08:00
Wouter van Oortmerssen 2265129e14 Removed date/time from generated code, causing commit polution.
Change-Id: I79724416110a3d2241d7eeecf0e12aa6d5b760a0
2018-01-18 11:21:10 -08:00
Wouter van Oortmerssen 4bddc6cc0c Added missing generated code.
Change-Id: I9420bf01d2bdb6ccfe3703c835297be73457c0d7
2018-01-18 11:20:58 -08:00
vglavnyy e162366b3f Removed internal variable with name "data" inside a generated method _nested_root(). Local variable with name "data" violates [-Werror=shadow]. (#4587) 2018-01-18 11:15:31 -08:00
Wouter van Oortmerssen fee9afd80b Use CreateVectorOfStructs when creating a vector of structs.
(mirrored from cl/180944741)

Change-Id: Ib9f1613ccc355528c5c495fd953a9b3944ecb4ce
2018-01-18 11:07:37 -08:00
Daniel Lin 98f681deb0 Author: Daniel Lin <danielin@umich.edi> (#4595)
Date:   Mon Jan 15 11:38:20 2018 -0200

Compilation failure with grpc.h

If cmake run with flag FLATBUFFERS_BUILD_GRPCTEST=ON
compilation fails.

Fix :
	-Fix argument list for overriden function in grpc.
	-Fix member function name called by FlatBufferBuilder from
	buf() to scratch_data()
2018-01-18 08:51:57 -08:00
Wouter van Oortmerssen 5cee340ad3 Cleaned up FlatBufferBuilder clearing.
Change-Id: I81cf4d268670bdd11d1d56ca9f2de78c120df842
Tested: on Linux.
2018-01-16 10:17:20 -08:00
Uilian Ries f0769b60ab #4522 Conan package support (#4590)
- Added Conan recipe to build Flatbuffers
- Added Travis job to create Conan package

Signed-off-by: Uilian Ries <uilianries@gmail.com>
2018-01-12 08:18:20 -08:00
Wouter van Oortmerssen 79b80f84df Reduced FlatBufferBuilder from 3 buffers to 1
Previously, FlatBufferBuilder used 3 resizable buffers:
- serialization (vector_downward)
- field offsets (std::vector)
- vtable offsets (std::vector)

Since the serialization buffer grows downwards, the bottom part of
it can be used as a "scratchpad" storage for the other two. Since
field offsets are only accumulated during table construction, and
vtable offsets only after table construction, the two can trivially
share the same storage.

Not only does this reduce the amount of allocation, it also removes
the bulk of std::vector usage from FlatBufferBuilder which was
the #1 cause of slow-down in debug mode, see e.g.:
https://stackoverflow.com/questions/36085285/any-way-to-improve-flatbuffer-performance-in-debug-c-msvc

Change-Id: I0224cf2f2a863d2d7ef762bc9163b52fdc149522
Tested: on Linux.
2018-01-11 11:13:23 -08:00
Andrew Gunnerson dfe68566e4 Add char * overload for FlatBufferBuilder::CreateString() (#4583)
Without this change, the compiler tries to select the following overload
when CreateString is passed a `char *`:

    template<typename T>
    Offset<String> CreateString(const T &str) {
      return CreateString(str.c_str(), str.length());
    }

which is not valid since char pointers don't have methods.

(Fixes #4579)

Signed-off-by: Andrew Gunnerson <chenxiaolong@cxl.epac.to>
2018-01-08 08:26:19 -08:00
brianhall77 0aa36101f4 Portable range check for *cursor_ value. (#4582)
Avoids the following compile error when char is unsigned:

error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-unsigned-zero-compare]
2018-01-04 16:03:03 -08:00
vglavnyy 70f345012d GenerateText generate a text string for default identifier of enum and float scalar. An enum identifier printed as the strictly quoted string. (#4527) 2018-01-04 10:12:18 -08:00
Andrei Polushin a056402f56 Remove unused declarations (#4578) 2018-01-04 10:01:41 -08:00
Darío Hereñú d7b1d418ee Update URL (#4576) 2018-01-04 09:10:03 -08:00
Bastien Brunnenstein 9dae3eac60 Fix error in ConCatPathFileName (#4575) 2018-01-04 09:09:09 -08:00
Yuri Finkelstein 99a8a68a80 new maven jar called flatbuffers-java-grpc which contains utility … (#4558)
* new maven jar called flatbuffers-java-grpc which contains utility class supporting generated code for grpc over flatbuffers; grpc java unit test based on maven and junit (maven is used only for simplicity of testing); removed straneous namespace_test/NamespaceA/TableInC.java which is not longer used in the test and no longer generated but contains complilation errors if java compiler picks it up

* moved java grpc tests files according to review request

* Added missing generated code for Java gRPC.

Change-Id: Iada090fe2e99b80a4b7c2f8e39c838a992a1feae

* added missing name and url
2017-12-28 15:26:29 -08:00
Wouter van Oortmerssen 0c86929e39 Added missing nullptr check in vector of union verifiers.
Change-Id: Iec720991e68ad27580537135bfd8eb4159333921
Tested: on Linux.
2017-12-28 10:09:48 -08:00
Wouter van Oortmerssen b24f2016a1 Disabled python in travis.yml pending fix.
Change-Id: I6d2a9cc8b32c531d4a1e272ddf29974a0a1a2ee3
2017-12-28 09:56:57 -08:00
Josh Ventura 1d73b3b9fc Various build fixes; update checked-in codegen. (#4572) 2017-12-28 09:10:55 -08:00
Yuri Finkelstein a4dbe13486 fixed java codegen bug documented in #4563 (#4565)
* grpc bindings generator for Java and a few minor supporting changes in improvements

* restored formatting before my previous changes for ease of review

* Fixed grpc java code generation bug resulting in duplicate extractor declarations in case the same is used in more than a single RPC method

* fixed previous merge issue

* removed extra space

* restored extra space

* restored extra space

* fixed java codegen bug documented in https://github.com/google/flatbuffers/issues/4563
2017-12-21 13:32:34 -08:00
Wouter van Oortmerssen 89711c9c47 Made all C++ files clang-formatted.
Also added missing generated files.

Change-Id: Ifd22a643a08e3f2edfce92812ed57b87fc0e1875
2017-12-21 11:45:02 -08:00
Yuri Finkelstein 5d9930aa0d added config files for popular formatting tools (#4554)
* added config files for popular formatting tools

* edited and moved formatting files to root per review suggestion
2017-12-21 10:18:20 -08:00
Yuri Finkelstein 8518b3fb4e grpc bindings generator for Java and a few minor supporting changes i… (#4553)
* grpc bindings generator for Java and a few minor supporting changes in improvements

* restored formatting before my previous changes for ease of review

* Fixed grpc java code generation bug resulting in duplicate extractor declarations in case the same is used in more than a single RPC method
2017-12-21 09:55:57 -08:00
Yuri Finkelstein 61f4a46c43 synchronized grpc cpp_generator with latest version as of today: grpc-1.8.1. (#4556)
* updateed cpp_generator.cc to be compatible with the latest grpc version

* preserved the original license

* synchronized grpc cpp_generator with latest version as of today: GRPC 1.8.1. Regenerated test/monster_test.grpc.fb.* files and verified that grpctest is nicely passing

* fixed merge glitch
2017-12-21 08:49:00 -08:00
Yuri Finkelstein dd73b53e28 updated cpp_generator.cc to be compatible with the latest grpc version (#4551)
* updateed cpp_generator.cc to be compatible with the latest grpc version

* preserved the original license
2017-12-18 14:17:59 -08:00
xgdgsc c1901f2c01 update mutation status in doc (#4549) 2017-12-18 09:14:15 -08:00
Robert 4071b6f68b
Merge pull request #4516 from mikeholler/travis
Add support for Python lib continuous deployment.
2017-12-14 13:20:18 -08:00
Kamil Rojewski 142401f50a Fix for strictPropertyInitialization for TS (#4540)
* Eclipse ignore

* TypeScript support

* Prefixing enums

* Test results

* Merged JS and TS generators

* Fixed AppVeyor build problems

* Fixed more AppVeyor build problems

* Fixed more AppVeyor build problems

* Changed TS flag to options struct

* Storing options by value

* Removed unneeded const

* Re-export support for unions

* Uint support

* Casting bools to numbers for mutation

* TS shell tests

* Reverted generates js test file to original version

* Backing up js tests and properly generating test data

* Not importing flatbuffers for TS test generation

* Not overwriting generated js for tests

* AppVeyor test fixes

* Generating the most strict TS code possible

* Not returning null when creating vectors

* Not returning null from struct contructors

* Vector of unions for ts/js

* Sanity check for languages

* Indentation fix + output test files

* Vectors of unions for php

* Fixes to union vector handling + tests

* Fix for strictPropertyInitialization
2017-12-14 08:30:02 -08:00
Mike Holler 7799642270 Change mikeholler to PYPI_USERNAME 2017-12-13 15:14:01 -06:00
Wouter van Oortmerssen 67b29d4e43 Fixed CreateStruct not testing for nesting.
Change-Id: I16bf46682ad68c62b778ed1514b6b706c8cb8f6f
Tested: on Linux.
2017-12-07 11:16:19 -08:00
Bastien Brunnenstein 85b131a719 Replace the non standard M_PI with a constant (#4528) 2017-12-04 15:06:13 -08:00
Paul Taylor 0e8a21854c publish additional js/flatbuffers.mjs to npm to support ESModules in node (#4504) 2017-12-01 14:18:43 -08:00
rmawatson 53a897731e this is allow custom allocator for obj-api structs/tables. (#4520)
added "native_custom_alloc" attribute to tables/structs, eg.

table parent_table( native_custom_alloc:"custom_alloc_name" ) {
...
}

with a custom allocator defined as

template <typename T> class custom_alloc_name : public std::allocator<T> {
public:

 typedef T*       pointer;

 template <class U>
 struct rebind {
  typedef custom_alloc_name<U> other;
 };

 pointer allocate(const std::size_t n) {
      return ....;
 }

 void deallocate(T* ptr, std::size_t n) {
    ...
 }

 custom_alloc_name() throw() {}
 template <class U> custom_alloc_name(const custom_alloc_name<U>&) throw() {}
};
};
2017-12-01 09:15:41 -08:00
Bastien Brunnenstein ba08b0ec02 Add include directory to CMake install targets (#4510) 2017-11-30 08:45:58 -08:00
Mike Holler da0bda6be3 Fixed prod PyPI URL and deploy block list. 2017-11-27 16:10:43 -06:00
Mike Holler 617bbc9b0c Added all_branches to tags: true block 2017-11-27 13:59:01 -06:00
Michael Holler 0c8b4c7614 Add support for Python lib continuous deployment.
Use a combination of travis and twine to publish to PyPI. New
publications will be made:

* When `master` is updated. This will trigger the publication of a
  the Python artifact versioned an iso-compliant build datetime. In this
  way, the cutting edge version will always be available via PyPI.
* When a new git tag is pushed. Tag pushes trigger the publication of
  a python artifact with the same version as the git tag, with the
  leading `v` stripped if present (`v1.2.3` becomes `1.2.3`).

Publications rely on Travis having a PYPI_PASSWORD environment set in
the project settings. See the Travis CI documentation for information on
[setting environment variables which containing sensitive data][1]. Make
extra sure the "Display value in build log" switch is OFF.

In addition to setting the previously mentioned `PYPI_PASSWORD`
environment variable, the owner of the PyPI `flatbuffers` repository
should, after merging this commit into master, add his own commit to
change `mikeholler` in `.travis/deploy-python.sh` to his username. It's
also recommended that the owner of `flatbuffers` use a separate account
in the unlikely event that the environment variable somehow becomes
compromised. Again, this is very unlikely, since the environment
variable is only set for "safe" builds approved by maintainers (not on
random pull requests).

[1]: https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings
2017-11-27 13:14:33 -06:00
Wouter van Oortmerssen 34aea4361f Updated version numbers to 1.8.0
Change-Id: I9cf9fe1e2572d3f9c4066624a87249ca1e62a297
2017-11-20 09:46:03 -08:00
Wouter van Oortmerssen be1ad33910 Missing generated code files.
Change-Id: I8808b0b419981ba7d0699da4a1effb0b660a21cb
2017-11-20 09:19:35 -08:00
MikkelFJ 0cf04ad9d5 Document type aliases (#4499) 2017-11-17 08:57:01 -08:00
Dan Douglas fe483fa380 fix typo (#4495)
`Equipment` is a union, not an enum.
2017-11-16 16:03:16 -08:00
Wouter van Oortmerssen 8a8dc4e111 Fixed potential strict-aliasing violation in big-endian code.
Also added a test.

Tested on: Linux.

Change-Id: I7b3230f8f6043eec139d5e3e8c9cb45814124274
2017-11-16 14:21:11 -08:00
red1939 7e803c410c Add exports for all targets (#4491)
Each target that will be installed will also generate a target that will be
included by CMake config file.
2017-11-16 12:51:25 -08:00
Hong Wu 1336d26252 c++ Tutorial fix (#4494) 2017-11-16 10:09:48 -08:00
Louis-Paul CORDIER 853f7033e0 Remove copy constructor to make flatbuffers struct trivially copyable… (#4476)
* Remove copy constructor to make flatbuffers struct trivially copyable + add tests.

* Add support non c++11 compliant compilers.

* Fix std::trivially_copyiable test for non-C++11 compliant compilers.

* Fix trivially_copyable not part of glibc < 5 even with c++11 switch enabled.
2017-11-16 10:08:41 -08:00
David Komer e2c7196ea8 tutorial docs (#4492) 2017-11-16 08:51:35 -08:00
Angela Sheu 61fe2a4fac Fix valid params limit exceeded for generated table constructor (#4490) 2017-11-13 13:39:49 -08:00
Wouter van Oortmerssen d233b38008 Made stl_emulation.h usable by itself.
Change-Id: I1d9d301412fe0a036f12eb2cc82a3fbee5bb838d
2017-11-09 15:48:35 -08:00
Sergey Avseyev ca52bfefc0 Specify ABI version for shared library (#4479) 2017-11-09 14:39:32 -08:00
Sergey Avseyev 2edb1dcdda Use CMake install directories instead of hardcoded (#4481) 2017-11-06 10:38:53 -08:00