jose luis ferrer
d9240320c1
compiler: Allocate all possible space for constants
...
When the c-capnp compiler runs, currently only takes the len of 1st
segment in the list as a capacity used in the generator for constants
definitions.
This works when the schema processing only generates 1 segment, or the
1st segment has 8192 bytes. There are cases where the fd returns
multiple segments an the first one has very low capacity (e.g. 96 or 80).
Hence, if more constants require to be allocated for the current schema
it will have misleading positions.
This commit takes a conservative approach by summing up all the lenghts
of capnproto segments obtained at the fd_init call of the compiler.
Those values are taken to set the memory allocation and the max
capacity for the segment utilized in the code generation.
2018-02-01 15:13:18 +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
Alexis Ballier
95d81bc26d
Use proper format specifiers for size_t.
2016-09-28 14:17:59 +02:00
Alexis Ballier
de11757ac6
Ensure capn segment is aligned properly when build with gcc too. Fixes build on 32 bits arm.
2016-09-28 14:17:59 +02:00
Theo Hill
7b7346a73c
lib: make buf arg const in write_fd pointer
...
For capn_write_fd() the write() function would be ideal to pass as
write_fd, but write() has type ssize_t (*)(int, const void *, size_t),
whereas write_fd expects ssize_t (*)(int, void *, size_t). Passing
write() directly with GCC 5.4 causes a warning
-Wincompatible-pointer-types (on by default).
2016-08-06 17:42:19 -07:00
Alexis Ballier
c6285474b9
Drop gtest directory
2016-08-02 15:13:43 +02:00
Alexis Ballier
de5a960adb
Drop gtest submodule and use system one.
2016-08-02 15:12:37 +02:00
David Lamparter
75f79010f6
c-capnproto 0.2 release
2016-07-20 08:56:46 +02:00
David Lamparter
54a7bb7ffb
compiler: drop outdated find_node comment & IDs
2016-07-20 08:48:22 +02:00
David Lamparter
c322bc9618
compiler: apply name infix on include filenames
...
This fixes #include output when $C.nameinfix is used.
2016-07-19 15:21:56 +02:00
David Lamparter
da663f83ef
compiler: add annotation to enable field get/set
...
Generating per-field getters/setters adds a lot of functions; this makes
them switchable with an annotation in the source schema.
2016-07-19 15:21:05 +02:00
David Lamparter
52ca907f14
compiler: add find_node_mayfail(), remove hack
...
Fixes github issue #11 , also makes it easier to use annotations.
2016-07-19 15:14:00 +02:00
David Lamparter
81352b068d
Revert "lib: endianness: don't break strict-aliasing"
...
This reverts commit 1afce9573a .
Turns out this is a misunderstanding of the C standard... meh.
2016-06-30 14:59:53 +02:00
David Lamparter
97f30c591c
build: fix filename
2016-06-27 16:24:48 +02:00
David Lamparter
f2058f60c0
lib: make capn_{de,in}flate + capn_stream private
...
There is no point in having these functions be part of the public API.
2016-06-27 16:06:02 +02:00