Jason Heeris
939aa30c0a
Merge pull request #37 from detly/write_size
...
Implemented capn_size() for calculating buffer size
2021-05-10 21:58:57 +08:00
Jason Heeris
a2179f48c8
Make the comment for capn_size() clearer that it only applies to unpacked serialisation.
2021-05-10 21:55:01 +08:00
Jason Heeris
bbc208cf04
Simplified size calculation.
2021-05-10 17:52:42 +08:00
Jason Heeris
d29faccc64
Implemented capn_size() for dynamically calculating the required buffer size for capn_write_mem().
2021-05-10 17:52:42 +08:00
Jason Heeris
024dca615a
Merge pull request #42 from detly/annotations
...
Two extra annotations: donotinclude and typedefto
2021-05-10 17:43:14 +08:00
Jason Heeris
b619a87c61
Merge pull request #44 from detly/nested_unions
...
Fix code generation for nested unions.
2021-05-10 17:37:05 +08:00
Jason Heeris
515c06c689
Merge pull request #41 from detly/enum_cast
...
Fix bug where enums were treated interchangeably with uint16_t.
2021-05-10 17:35:12 +08:00
Jason Heeris
6661fc9d2d
Fix code generation for nested unions.
...
When a union is nested inside another union, it must be enclosed in a struct
so that its "which" member is not overlapping with its other members.
2021-01-14 10:43:46 +08:00
Jason Heeris
9153fc39c4
Add an annotation to typedef structs and enums.
...
A new annotation 'typedefto' allows you to make a typedef in the generated
code for structs and enums (but not union 'which' enums).
2021-01-02 09:28:31 +08:00
Jason Heeris
fe3a57de13
Added extra line break after structure size block.
2021-01-02 09:28:31 +08:00
Jason Heeris
b995a09c03
Add an annotation to skip including header files generated from specific
...
schema files.
Some schema files (eg. those that only decalare annotations) do not actually
result in any generated C code. They do not need to have a corresponding
include directive for C files generated from schemas that include them. This
introduces a "donotinclude" annotation that takes the Cap'n Proto ID (a
UInt64) of any such files and skips generating the include directive for them.
2021-01-02 09:28:31 +08:00
Jason Heeris
e13c143c99
Fix bug where enums were treated interchangeably with uint16_t.
...
ANSI C makes no guarantee about the size of an enum, only that it will be the
minimum required integer type that can hold all the given values. Treating
enums as interchangeable with uint16_t data caused undefined behavoiur on
platforms where enums were always at least 32 bits.
2020-12-28 21:46:37 +08:00
Joel Carlson
9053ebe6ee
compiler/str.h: include stdarg.h for va_list
...
With some toolchains, compilation of str.c produced the following error:
compiler/str.h:56:50: error: unknown type name ‘va_list’
int str_vaddf(struct str *v, const char *format, va_list ap) ATTR(2,0);
^~~~~~~
One toolchain had the following in its stdarg.h:
"We deliberately do not define va_list when called from
stdio.h, because ANSI C says that stdio.h is not supposed to
define va_list."
str.c includes stdio.h, but none of the prior includes result in the
inclusion of stdarg.h. Therefore, explicitly include it in str.h to fix
the issue on toolchains following this ANSI C rule.
Signed-off-by: Joel Carlson <JoelsonCarl@gmail.com>
2019-04-22 20:58:49 +01:00
Alex Helfet
bd9911a3e5
Add security warning to README.md
2019-04-22 20:43:17 +01:00
David Lamparter
cb30563de7
c-capnproto 0.3 release
2017-05-19 19:30:58 +02:00
David Lamparter
5cbd52ef74
Merge branch 'jamvideosolutions/master'
...
(Marker merge -- cherry-picked the size format; the align one is
superseded and the gtest ones collide with gtest's upstream
recommendations [only Gentoo has gtest as a package].)
2017-05-19 19:27:34 +02:00
Alexis Ballier
704a34fa65
Use proper format specifiers for size_t.
2017-05-19 19:26:47 +02:00
David Lamparter
aab56f1169
Merge branch 'issue20'
2017-05-19 19:15:28 +02:00
David Lamparter
89dd18a2d5
Add note in header about setting capn_data
2017-05-19 09:52:43 +02:00
David Lamparter
aa1f31d401
Silence empty struct warning
...
Last but not least, -Wpedantic warns about empty structs. With this,
-Wpedantic build is now clean of warnings on gcc 5.4.0 and clang 4.0.
2017-05-19 09:45:01 +02:00
David Lamparter
b0810da2c3
Silence warning on unused struct parameter
...
When generating code for an empty struct, the read_/write_ functions
would print warnings about the unused "s" pointer. Silence these.
2017-05-19 09:40:37 +02:00
David Lamparter
99e9412c02
Silence GCC unnamed union warning
...
We need the unnamed struct/union support, this is user-facing API.
So, silence the -Wpedantic warning.
2017-05-19 09:35:09 +02:00
David Lamparter
0ffd3fdae9
Add stddef.h for POSIX ssize_t
...
Recent GCC versions / OS headers don't automatically provide ssize_t
anymore, leading to compiler errors.
2017-05-19 09:18:09 +02:00
David Lamparter
2330c177d3
Merge pull request #19 from jlferrer/fix_empty_lists
...
Support creation of struct lists with size 0
2017-05-19 09:14:21 +02:00
David Lamparter
e0d1c36e43
Resolve pointers in capn_getv*
...
Reported by @xvuko, fixes #20
2017-05-19 09:05:47 +02:00
Josep Lluis Ferrer
c802ad3a1a
Support creation of struct lists with size 0
...
The case of creating capnp lists of size 0 didn't consider lists of
composite elements (structs), which requires the addition of list
element information.
This commit removes the case of size 0 when creating the list in order
to enable the creation of 0 sized lists of any element type (struct).
2017-05-17 18:23:33 +02:00
David Lamparter
7c819065e0
Merge branch 'pull/16'
2017-04-05 22:44:10 +02:00
Alex Helfet
4380d283f4
Add URL for original addressbook example; example to assert list length with capn_len().
2017-04-02 23:59:05 +01:00
Alex Helfet
a80f24583e
Add some missing capn_free() calls to the example test.
2017-03-30 14:33:15 +01:00
Alex Helfet
953031233b
Add example that uses accessor functions.
2017-03-27 04:20:38 +01:00
Alex Helfet
f7cd5685aa
Add comiler/c.capnp.h to Makefile.am noinst_HEADERS.
2017-03-27 03:33:34 +01:00
Alex Helfet
531eefc3cc
Rewrite tests/example-test.cpp to use addressbook example from capnproto C++ project.
2017-03-27 03:30:37 +01:00
Alex Helfet
989acc3414
Most .capnp files use "/c.capnp".fieldgetset. Recompile from schema files.
2017-03-26 23:40:55 +01:00
Alex Helfet
73b5d565de
Make task capnp-compile to compile from .capnp files in the project.
2017-03-26 18:45:14 +01:00
Alex Helfet
a379aa89ac
Compiler generates absolute #include paths from .capnp imports with leading /'s.
...
As specified in https://capnproto.org/language.html#imports and implemented
in the C++ compiler output plugin.
2017-03-26 18:43:57 +01:00
Alex Helfet
6b52d615a2
Add all .capnp files to make dist archive.
2017-03-26 15:23:35 +01:00
Alex Helfet
5a282f6c98
Add extra files to Makefile.am.
2017-03-24 18:02:22 +00:00
Alex Helfet
e32a85be79
Fix build errors in tests/example-test.cpp.
2017-03-24 02:32:21 +00:00
Alex Helfet
29a1342d00
Example usage in unit test.
2017-03-23 20:18:29 +00:00
Alex Helfet
362173091d
compiler: If an explicit symbol wasn't provided, make generated capn_val%d variables static.
2017-03-23 20:18:29 +00:00
David Lamparter
49031ea638
Merge pull request #15 from fluffysquirrels/master
...
Fix runtime library compiler warnings and errors in GCC.
2017-03-23 06:22:55 +01:00
Alex Helfet
408505ae31
8 byte alignment on capn_segment, updated comments about this.
...
As discussed in PR: https://github.com/opensourcerouting/c-capnproto/pull/15#discussion_r107588334
2017-03-23 05:11:45 +00:00
Alex Helfet
57d0ffea33
Remove UNUSED(x) macro. No longer needed.
2017-03-23 04:37:51 +00:00
Alex Helfet
a93ae12705
.gitignore .dirstamp files created during the build.
2017-03-23 04:33:27 +00:00
Alex Helfet
ef88fd8e9d
Fixed some issues raised by eqvinox in pull request.
...
PR URL: 1b25eae747
2017-03-23 04:33:03 +00:00
Alex Helfet
1b25eae747
Fix runtime library compiler warnings and errors in GCC.
2017-03-22 17:47:59 +00:00
Alex Helfet
0be620602a
Fix compiler warnings and errors in GCC.
2017-03-22 17:40:05 +00:00
David Lamparter
462f6eb9a8
Merge pull request #12 from ThirteenFish/master
...
lib: make buf arg const in write_fd pointer
2017-03-22 08:38:24 +01:00
David Lamparter
55b958c67a
Merge pull request #14 from fluffysquirrels/master
...
Fix GCC warnings in initializers for capn_val0 and capn_seg.
2017-03-22 08:37:55 +01:00
Alex Helfet
f16fae57b3
Fix GCC warnings in initializers for capn_val0 and capn_seg.
2017-03-22 06:48:58 +00:00