diff --git a/README.md b/README.md index 4ec8e0c8..3118a3e5 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ Main features supported as of 0.4.0 New in 0.4.0: - support for big endian platforms. -- support for big endian encoded flatbuffers on both le and be platforms. +- support for big endian encoded flatbuffers on both le and be platforms. Enabled on `be` branch. - size prefixed buffers - see also `doc/builder.md` Supported platforms: @@ -125,15 +125,9 @@ it may require some work in the build configuration and possibly updates to the portable library. The above is simply what has been tested and configured. -Use versions from 0.3.0 and up as there has been some minor breaking -[interface changes](https://github.com/dvidelabs/flatcc/blob/master/CHANGELOG.md#030). -Version 0.3.3 has a minor breaking change where the `verify_as_root` call -must be renamed to `verify_as_root_with_identifier`, or drop the identifier -argument. - The portability layer has some features that are generally important for things like endian handling, and others to provide compatibility for -non-C11 compliant compilers. Together this should support most C +optional and missing C11 features. Together this should support most C compilers around, but relies on community feedback for maturity. The necessary size of the runtime include files can be reduced @@ -632,16 +626,25 @@ construct overlapping datastructures such that in-place updates may cause subsequent invalid buffers. Therefore an untrusted buffer should never be updated in-place without first rewriting it to a new buffer. -Note: prior to version 0.2.0, the verifier would fail on 0 and report -success on non-zero value. As of 0.2.0, success is indicated by 0, and -non-zero yields an error code that can be translated into a string. - The CMake build system has build option to enable assertions in the verifier. This will break debug builds and not usually what is desired, -but it can be very useful when debugging why a buffer is invalid. +but it can be very useful when debugging why a buffer is invalid. Traces +can also be enabled so table offset and field id can be reported. See also `include/flatcc/flatcc_verifier.h`. +When verifying buffers returned directly from the builder, it may be +necessary to use the `flatcc_builder_finalize_aligned_buffer` to ensure +proper alignment and use `aligned_free` to free the buffer, see also +`doc/builder.md`. Buffers may also be copied into aligned memory via +mmap or using the portable layers `paligned_alloc.h` feature which is +available when including generated headers. +`test/flatc_compat/flatc_compat.c` is an example of how this can be +done. For the majority of use cases, standard allocation would be +sufficient, but for example standard 32-bit Windows only allocates on an +8-byte boundary and can break the monster schema because it has 16-byte +aligned fields. + ## File and Type Identifiers @@ -840,8 +843,7 @@ quoted in order to be compatible with Googles flatc tool for Flatbuffers color: "Green Red" -The following is also accepted in flatcc 0.2.0, but subsequent releases -only permits it if explicitly enabled at compile time. +The following is only permitted if explicitly enabled at compile time. color: Green Red diff --git a/include/flatcc/flatcc_version.h b/include/flatcc/flatcc_version.h index a8bd4112..964b5051 100644 --- a/include/flatcc/flatcc_version.h +++ b/include/flatcc/flatcc_version.h @@ -1,6 +1,6 @@ -#define FLATCC_VERSION_TEXT "0.3.6-dev" +#define FLATCC_VERSION_TEXT "0.4.0" #define FLATCC_VERSION_MAJOR 0 -#define FLATCC_VERSION_MINOR 3 -#define FLATCC_VERSION_PATCH 6 +#define FLATCC_VERSION_MINOR 4 +#define FLATCC_VERSION_PATCH 0 /* 1 or 0 */ -#define FLATCC_VERSION_RELEASED 0 +#define FLATCC_VERSION_RELEASED 1 diff --git a/include/flatcc/portable/pstdalign.h b/include/flatcc/portable/pstdalign.h index f1c6776f..8a90c1d8 100644 --- a/include/flatcc/portable/pstdalign.h +++ b/include/flatcc/portable/pstdalign.h @@ -26,8 +26,7 @@ /* C11 or newer */ #include #else - -#if defined(__GNUC__) || defined (__IBMC__) || defined(__clang__) +#if defined(__GNUC__) || defined(__IBM_ALIGNOF__) || defined(__clang__) #define _Alignas(t) __attribute__((__aligned__(t))) #define _Alignof(t) __alignof__(t) #elif defined(_MSC_VER) diff --git a/include/flatcc/portable/pversion.h b/include/flatcc/portable/pversion.h index cbc4c718..a3c7c669 100644 --- a/include/flatcc/portable/pversion.h +++ b/include/flatcc/portable/pversion.h @@ -3,4 +3,4 @@ #define PORTABLE_VERSION_MINOR 2 #define PORTABLE_VERSION_PATCH 0 /* 1 or 0 */ -#define PORTABLE_VERSION_RELEASED 0 +#define PORTABLE_VERSION_RELEASED 1 diff --git a/include/flatcc/reflection/flatbuffers_common_builder.h b/include/flatcc/reflection/flatbuffers_common_builder.h index 616e9ecc..704d758e 100644 --- a/include/flatcc/reflection/flatbuffers_common_builder.h +++ b/include/flatcc/reflection/flatbuffers_common_builder.h @@ -1,7 +1,7 @@ #ifndef FLATBUFFERS_COMMON_BUILDER_H #define FLATBUFFERS_COMMON_BUILDER_H -/* Generated by flatcc 0.3.6-dev FlatBuffers schema compiler for C by dvide.com */ +/* Generated by flatcc 0.4.0 FlatBuffers schema compiler for C by dvide.com */ /* Common FlatBuffers build functionality for C. */ diff --git a/include/flatcc/reflection/flatbuffers_common_reader.h b/include/flatcc/reflection/flatbuffers_common_reader.h index c56c95ce..fc07d0dc 100644 --- a/include/flatcc/reflection/flatbuffers_common_reader.h +++ b/include/flatcc/reflection/flatbuffers_common_reader.h @@ -1,7 +1,7 @@ #ifndef FLATBUFFERS_COMMON_READER_H #define FLATBUFFERS_COMMON_READER_H -/* Generated by flatcc 0.3.6-dev FlatBuffers schema compiler for C by dvide.com */ +/* Generated by flatcc 0.4.0 FlatBuffers schema compiler for C by dvide.com */ /* Common FlatBuffers read functionality for C. */ diff --git a/include/flatcc/reflection/reflection_builder.h b/include/flatcc/reflection/reflection_builder.h index 749e0770..48411521 100644 --- a/include/flatcc/reflection/reflection_builder.h +++ b/include/flatcc/reflection/reflection_builder.h @@ -1,7 +1,7 @@ #ifndef REFLECTION_BUILDER_H #define REFLECTION_BUILDER_H -/* Generated by flatcc 0.3.6-dev FlatBuffers schema compiler for C by dvide.com */ +/* Generated by flatcc 0.4.0 FlatBuffers schema compiler for C by dvide.com */ #ifndef REFLECTION_READER_H #include "reflection_reader.h" diff --git a/include/flatcc/reflection/reflection_reader.h b/include/flatcc/reflection/reflection_reader.h index df0710c0..72bc1f0e 100644 --- a/include/flatcc/reflection/reflection_reader.h +++ b/include/flatcc/reflection/reflection_reader.h @@ -1,7 +1,7 @@ #ifndef REFLECTION_READER_H #define REFLECTION_READER_H -/* Generated by flatcc 0.3.6-dev FlatBuffers schema compiler for C by dvide.com */ +/* Generated by flatcc 0.4.0 FlatBuffers schema compiler for C by dvide.com */ #ifndef FLATBUFFERS_COMMON_READER_H #include "flatbuffers_common_reader.h" diff --git a/include/flatcc/reflection/reflection_verifier.h b/include/flatcc/reflection/reflection_verifier.h index bb5b1f89..309eb7f6 100644 --- a/include/flatcc/reflection/reflection_verifier.h +++ b/include/flatcc/reflection/reflection_verifier.h @@ -1,7 +1,7 @@ #ifndef REFLECTION_VERIFIER_H #define REFLECTION_VERIFIER_H -/* Generated by flatcc 0.3.6-dev FlatBuffers schema compiler for C by dvide.com */ +/* Generated by flatcc 0.4.0 FlatBuffers schema compiler for C by dvide.com */ #ifndef REFLECTION_READER_H #include "reflection_reader.h"