flatbuffers: update bindings, add verifier

This commit is contained in:
William Casarin
2023-08-28 08:17:25 -07:00
parent 984c7b6932
commit ba6792640d
24 changed files with 434 additions and 77 deletions

View File

@@ -69,7 +69,7 @@ extern "C" {
#ifndef FLATCC_USE_GENERIC_ALIGNED_ALLOC
#ifndef FLATCC_NO_PALIGNED_ALLOC
#include "paligned_alloc.h"
#include "portable/paligned_alloc.h"
#else
#if !defined(__aligned_free_is_defined) || !__aligned_free_is_defined
#define aligned_free free

View File

@@ -4,5 +4,5 @@
}
#endif
#include "pdiagnostic_pop.h"
#include "portable/pdiagnostic_pop.h"

View File

@@ -4,7 +4,7 @@
*
* Outside include guard to handle scope counter.
*/
#include "pstatic_assert.h"
#include "portable/pstatic_assert.h"
#ifndef FLATCC_FLATBUFFERS_H
#define FLATCC_FLATBUFFERS_H
@@ -17,14 +17,14 @@ extern "C" {
#define flatcc_flatbuffers_defined
#ifdef FLATCC_PORTABLE
#include "flatcc/flatcc_portable.h"
#include "flatcc_portable.h"
#endif
#include "pwarnings.h"
#include "portable/pwarnings.h"
/* Needed by C99 compilers without FLATCC_PORTABLE. */
#include "pstdalign.h"
#include "portable/pstdalign.h"
/* Handle fallthrough attribute in switch statements. */
#include "pattributes.h"
#include "portable/pattributes.h"
#include "flatcc_alloc.h"
#include "flatcc_assert.h"
@@ -37,7 +37,7 @@ extern "C" {
* "flatcc_endian.h" requires the preceeding include files,
* or compatible definitions.
*/
#include "pendian.h"
#include "portable/pendian.h"
#include "flatcc_types.h"
#include "flatcc_endian.h"
#include "flatcc_identifier.h"

View File

@@ -20,7 +20,7 @@ extern "C" {
#include "flatcc_unaligned.h"
#define PDIAGNOSTIC_IGNORE_UNUSED
#include "pdiagnostic_push.h"
#include "portable/pdiagnostic_push.h"
enum flatcc_json_parser_flags {
flatcc_json_parser_f_skip_unknown = 1,
@@ -886,7 +886,7 @@ int flatcc_json_parser_struct_as_root(flatcc_builder_t *B, flatcc_json_parser_t
const char *buf, size_t bufsiz, int flags, const char *fid,
flatcc_json_parser_struct_f *parser);
#include "pdiagnostic_pop.h"
#include "portable/pdiagnostic_pop.h"
#ifdef __cplusplus
}

View File

@@ -32,8 +32,8 @@ extern "C" {
#include <stdlib.h>
#include <string.h>
#include "flatcc/flatcc_rtconfig.h"
#include "flatcc/flatcc_flatbuffers.h"
#include "flatcc_rtconfig.h"
#include "flatcc_flatbuffers.h"
/* -DFLATCC_PORTABLE may help if inttypes.h is missing. */
#ifndef PRId64

View File

@@ -5,7 +5,7 @@
extern "C" {
#endif
#include "flatcc/portable/portable_basic.h"
#include "portable/portable_basic.h"
#ifdef __cplusplus
}

View File

@@ -1,7 +1,7 @@
/* Include guard intentionally left out. */
#define PDIAGNOSTIC_IGNORE_UNUSED
#include "pdiagnostic_push.h"
#include "portable/pdiagnostic_push.h"
#ifdef __cplusplus
extern "C" {

View File

@@ -8,7 +8,7 @@ extern "C" {
/* Include portability layer here since all other files depend on it. */
#ifdef FLATCC_PORTABLE
#include "flatcc/portable/portable.h"
#include "portable/portable.h"
#endif
/*

View File

@@ -5,7 +5,7 @@
extern "C" {
#endif
#include "punaligned.h"
#include "portable/punaligned.h"
#define FLATCC_ALLOW_UNALIGNED_ACCESS PORTABLE_UNALIGNED_ACCESS

View File

@@ -51,7 +51,7 @@ extern "C" {
*
*/
#include "flatcc/flatcc_types.h"
#include "flatcc_types.h"
#define FLATCC_VERIFY_ERROR_MAP(XX)\
XX(ok, "ok")\

View File

@@ -6,8 +6,8 @@
#include <string.h>
#include <stdlib.h>
#include "flatcc/flatcc_rtconfig.h"
#include "flatcc/flatcc_assert.h"
#include "flatcc_rtconfig.h"
#include "flatcc_assert.h"
/*
* Grisu significantly improves printing speed of floating point values
@@ -18,13 +18,13 @@
#define PORTABLE_USE_GRISU3 1
#endif
#include "flatcc/flatcc_flatbuffers.h"
#include "flatcc/flatcc_json_printer.h"
#include "flatcc/flatcc_identifier.h"
#include "flatcc_flatbuffers.h"
#include "flatcc_json_printer.h"
#include "flatcc_identifier.h"
#include "flatcc/portable/pprintint.h"
#include "flatcc/portable/pprintfp.h"
#include "flatcc/portable/pbase64.h"
#include "portable/pprintint.h"
#include "portable/pprintfp.h"
#include "portable/pbase64.h"
#define RAISE_ERROR(err) flatcc_json_printer_set_error(ctx, flatcc_json_printer_error_##err)

View File

@@ -64,6 +64,7 @@ static inline TK ## _option_t N ## _ ## NK ## _option(N ## _table_t t__tmp)\
#define __flatbuffers_offset_field(T, ID, t, r, adjust)\
{\
flatbuffers_uoffset_t *elem__tmp;\
printf("got here\n");
__flatbuffers_read_vt(ID, offset__tmp, t)\
if (offset__tmp) {\
elem__tmp = (flatbuffers_uoffset_t *)((uint8_t *)(t) + offset__tmp);\

View File

@@ -179,7 +179,7 @@ flatcc_refmap_ref_t flatcc_refmap_find(flatcc_refmap_t *refmap, const void *src)
#include <stdio.h>
#ifndef FLATCC_REFMAP_H
#include "flatcc/flatcc_refmap.h"
#include "flatcc_refmap.h"
#endif
#define test(x) do { if (!(x)) { fprintf(stderr, "%02d: refmap test failed\n", __LINE__); exit(-1); } } while (0)

View File

@@ -6,10 +6,10 @@
*/
#include <string.h>
#include "flatcc/flatcc_rtconfig.h"
#include "flatcc/flatcc_flatbuffers.h"
#include "flatcc/flatcc_verifier.h"
#include "flatcc/flatcc_identifier.h"
#include "flatcc_rtconfig.h"
#include "flatcc_flatbuffers.h"
#include "flatcc_verifier.h"
#include "flatcc_identifier.h"
/* Customization for testing. */
#if FLATCC_DEBUG_VERIFY