Commit Graph

1483 Commits

Author SHA1 Message Date
Felix Frank
ad8b1e5dbd [Python] Fast serialization of numpy vectors (#4829)
[Python] Fast serialization of numpy vectors (#4829)
2018-10-15 17:07:08 -07:00
kostya-sh
76d31e1b5e Go - Use Go bool type for bool fields (#4962)
* Use Go bool type for bool fields, and store non-default bool field to test data
2018-10-15 16:55:59 -07:00
Frank Benkstein
20396a1760 disallow c style casts (#4981)
Fixes #4857.
2018-10-15 15:11:31 -07:00
Frank Benkstein
a3d8391f7b don't use std::function in flatbuffers::Parser (#4995)
std::function makes code harder to debug because it requires stepping
through a separate destructor and call operator.  It's use unnecessary
in the Parser since the functions taking functors are private and are
only used within idl_parser.cpp.  Therefore the definitions can stay in
idl_parser.cpp as well.  Only care must be taken that the definitions
appear before use but that's already true and all compilers will
complain equally if it get's violated.  This change might also improve
performance since it might allow inlining where it wasn't possible
before but I haven't measured that.
2018-10-15 12:26:35 -07:00
iceboy
241e87d143 add :runtime_cc target (#4994) 2018-10-15 12:18:15 -07:00
Frank Benkstein
35f0b41fed fix missing newline in flatc help message (#4992) 2018-10-11 15:54:01 -07:00
Frank Benkstein
cb5422c398 fix #4974 (#4989) 2018-10-11 12:40:41 -07:00
Vladimir Glavnyy
4ed6fafdfa Refactoring of idl_parser (#4948)
* Refactoring of numbers parser

More accurate parse of float and double.
Hexadecimal floats.
Check "out-of-range" of uint64 fields.
Check correctness of default values and metadata.

* Remove locale-independent code strtod/strtof from PR #4948.

* small optimization

* Add is_(ascii) functions

* is_ascii cleanup

* Fix format conversation

* Refine number parser

* Make code compatible with Android build

* Remove unnecessary suppression of warning C4127
2018-10-11 10:37:47 -07:00
Frank Benkstein
53ce80ce91 better output on TestError (#4979)
Print a slightly better error message when a TestError fails.
2018-10-11 10:33:12 -07:00
Rikard Lundmark
233976c821 Add @javax.annotation.Generated to generated flatbuffer Java types (#4986)
* Add @javax.annotation.Generated to generated flatbuffer Java types.

* Updating test goldens.
2018-10-08 15:29:22 -07:00
Frank Benkstein
99fe1dc80f don't crash when calling EnumNameXXX on sparse enum (#4982)
Make an out-of-bounds check for enum values before using them to index the
names array.  For consistency with non-sparse enums an empty string is
returned.

Fixes #4821
2018-10-08 14:37:35 -07:00
Michael Edwards
a4f9d1bfcc Fix expected type of enum values in reflection tables (#4944)
Fixes #4930
2018-10-08 14:29:29 -07:00
kostya-sh
a4c362a1ba Use enum types in generated read/mutate methods for Go (#4978) 2018-10-08 14:25:37 -07:00
cor3ntin
7c3c027295 Add missing const on Reference::As<> (#4975)
Reference::As<> was needlessly mutable wich made them
less safe and harder to use
2018-10-08 12:52:01 -07:00
Stewart Miles
569492e890 Disable armeabi builds for Android and re-enable CI builds. (#4970)
armeabi support was removed from the Android NDK so we should no
longer build it.  Since this fixes the Android build failures this
commit also re-enables Travis Android builds.

While re-enabling Android builds, some recent changes broke C++98
support so this fixes those issues as well which include:
- Conditionally compiling use of move constructors, operators and
  std::move.
- Changing sample to use flatbuffers::unique_ptr rather than
  std::unique_ptr.

Finally, added the special "default_ptr_type" value for the
"cpp_ptr_type" attribute.  This expands to the value passed to
the "--cpp-ptr-type" argument of flatc.
2018-10-08 12:43:57 -07:00
Taj Morton
d840856093 In Javascript, generate bidirectional mappings for enums, between Name: Value and between Value: Name. (#4960) 2018-10-04 10:37:22 -07:00
Vladimir Glavnyy
925c1d77fc Fix recursion counter check. Add control to override depth of nested … (#4953)
* Fix recursion counter check. Add control to override depth of nested objects.

* Change if-condition to `>=`
2018-10-04 09:27:37 -07:00
Wouter van Oortmerssen
c0698cc33f Bumped version to 1.10.1 for all languages.
Change-Id: I9a6256d90ea800834a887afdcf888df412018933
v1.10.0
2018-10-03 12:48:47 -07:00
Wouter van Oortmerssen
ea8a4296e7 Updated TestAll.sh with Rust.
Change-Id: I751f3bbd85eb1b521e1533c68f95442af0d18b8a
2018-10-03 12:27:27 -07:00
Jason Neufeld
f85af46262 Adds __reset method to Struct and Table (#4966)
This allow recycling/pooling instances without leaking ByteBuffers, by
providing a mechanism to reset instance to newly constructed state.
2018-10-03 12:09:30 -07:00
Vladimir Glavnyy
7a43775661 Assert tests on the first failure. (#4952)
* Assert tests on the first failure. Disable pop-up message box on assertion.

* Fix format and code style

* Move MSVC dependent code to ifdef
2018-10-03 12:04:14 -07:00
kostya-sh
062dcf7007 Use standard header for generated Go files (#4961)
As recommended by https://golang.org/pkg/cmd/go/internal/generate/:

  To convey to humans and machine tools that code is generated,
  generated source should have a line early in the file that
  matches the following regular expression (in Go syntax):

        ^// Code generated .* DO NOT EDIT\.$
2018-10-03 11:19:40 -07:00
Taj Morton
ebb410062b Allow tables that are entirely composed of native inlines to be copied. (#4958) 2018-10-01 16:27:54 -07:00
Sumant Tambe
4b864fd172 Turn on gRPC tests in travis build (#4955)
Download and build with a known grpc version
2018-10-01 15:59:04 -07:00
Vladimir Glavnyy
7e711f80d7 Parser error message reports both the line number and the cursor position. (#4954) 2018-10-01 14:57:36 -07:00
Matt Mastracci
bf871ffd7f Remove lifetime specifier on table getter methods (#4949)
With the old-style code, the test fails with a borrow-checker error:

```
  #[inline]
  pub fn name(&'a self) -> &'a str {
    self._tab.get::<flatbuffers::ForwardsUOffset<&str>>(Monster::VT_NAME, None).unwrap()
  }
```

```
error[E0597]: `e` does not live long enough
   --> tests/integration_test.rs:273:57
    |
273 |         let enemy_of_my_enemy = monster.enemy().map(|e| e.name());
    |                                                         ^      - `e` dropped here while still borrowed
    |                                                         |
    |                                                         borrowed value does not live long enough
274 |         assert_eq!(enemy_of_my_enemy, Some("Fred"));
275 |     }
    |     - borrowed value needs to live until here
```
2018-09-28 20:11:05 -07:00
kzvi
a89be8739c loosen lifetimes in type signature of Table::get (#4925) 2018-09-27 20:56:49 -07:00
Shivendra Agarwal
0bffce5aef Add more apis to query vector types from a reference (#4823)
* Add more apis to query vector types from a reference

https://github.com/google/flatbuffers/issues/4818

* changing order of apis

* another reordering

* removed vector element type api as not needed as for now
2018-09-27 12:34:27 -07:00
Vladimir Glavnyy
d48f08acfe Add missed defined(clang) and fix the wrong placement of #pragma push/pop for MSVC compiler (#4946) 2018-09-27 12:31:43 -07:00
kzvi
43132560f9 don't return Option from required table field accessors (#4926) 2018-09-26 21:11:25 -07:00
jean-airoldie
c56fff88a2 rust: Fixed MakeCamelCase (#4932) (#4936)
* Fixed MakeCamelCase behavior when supplied Upper_Camel_Case,
snake_case and UPPERCASE strings.
* Modified the rust integration test to reflect changes.
2018-09-26 13:35:02 -07:00
Sumant Tambe
49fed8c4f6 Add FlatBufferBuilder move semantics tests to the main test suite (#4902)
* Add FlatBufferBuilder move semantics tests to main

Do not eagerly delete/reset allocators in release and release_raw functions
Update android, vs2010 build files
New tests for various types of FlatBufferBuilders and move semantics

* Improve test failure output with function names
2018-09-24 12:03:31 -07:00
Michael Edwards
b1a925dfc2 ToStringVisitor settings to allow pretty formatted JSON (#4933) 2018-09-24 09:29:49 -07:00
Thomas
33791dc7b0 Add compare operator to code generated for c++ (#4940)
* Add operator== for c++ genated code

New "--gen-compare" option for flatc to generate compare operators. The operators are defined based on object based api types.

Inspired by issue #263.

* Improve compare operator for c++.
Thanks for the code review.

- Improve robustness against future schema extensions
- Code style
- Fix --rust generation in generate_code.sh
2018-09-21 16:53:59 -07:00
Wouter van Oortmerssen
873a60b0d8 Updated readme.md
Change-Id: I9b0664a3bde44a4ee44ef0fd117d0e4bedc132d9
2018-09-21 10:42:00 -07:00
Wouter van Oortmerssen
4b10656f9b Changed JS/TS codegen to use stable non-compiler dependent hash.
Different implementations of std::hash kept littering commits with
namespace changes.

Change-Id: Ic2d4fdcd76f8fef9802bc1572eb74ae7427085e3
2018-09-21 09:42:43 -07:00
Wouter van Oortmerssen
e317b148dc Added missing Dart codegen files.
Change-Id: Ic97f5b50fa191f967672c404f737d302462fc6ac
2018-09-21 09:42:43 -07:00
Christopher Cifra
ed03faaf07 [C#] Fix compile issue when compiling with older versions of C# (#4938)
* C# support for directly reading and writting to memory other than byte[].  For example, ByteBuffer can be initialized with a custom allocator which uses shared memory / memory mapped files.

Public access to the backing buffer uses Span<T> instead of ArraySegment<T>.

Writing to the buffer now supports Span<T> in addition to T[].

To maintain backwards compatibility ENABLE_SPAN_T must be defined.

* Remove usage of expression bodied method so that ByteBuffer can be compiled with older version of C#.
2018-09-20 15:07:03 -07:00
Robert
02a7807dd8 Add Rust to Appveyor config. (#4928) 2018-09-12 11:44:51 -07:00
Enrico Olivelli
615885e889 Add ByteBufferFactory#releaseByteBuffer (#4914)
This adds the ability to dispose unused buffers or to return them to an object pool
2018-09-06 11:08:08 -07:00
Robert
528ccdd458 rust: more builder lifetimes predicates (#4923) 2018-09-05 18:15:30 -07:00
Robert
c23ba6756f rust: more builder lifetimes logic (#4917) 2018-09-04 21:53:39 -07:00
Onur Karaman
10e1d1a69e fix rust flatbuffers create_vector docs (#4913)
Manual vector creation begins with start_vector, not create_vector.
2018-09-04 14:30:31 -07:00
Robert
660c491265 rust generator: fix builder lifetime switch (#4912) 2018-09-04 14:29:27 -07:00
Robert
c504a45404 rust generator: fix enum member comments (#4911) 2018-09-04 13:52:31 -07:00
Robert
919c929d30 readme.md: add Rust as a supported language 2018-09-03 23:38:41 -07:00
Robert
ba4a02b46a Update Cargo.toml for Crates.io package 2018-09-03 19:42:25 -07:00
Robert
be3d0b9c64 delete and ignore Cargo.lock files (#4906) 2018-09-03 19:33:38 -07:00
Chris Holcombe
872fad049e Fix extern crate in root namespace (#4905)
Imports the Rust FlatBuffers runtime crate even when not using a namespace in a schema.
2018-09-03 19:09:38 -07:00
Robert
9e648c392b Rust: Add basic crate-level documentation 2018-09-03 18:01:31 -07:00