Commit graph

256 commits

Author SHA1 Message Date
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
David Lamparter
33ae16bba8 lib: don't overrun buffer in capn_write_mem_packed
Missing braces end up scaling the offset by * 4 ... which is actually a
stack/heap overflow.
2016-06-27 16:03:03 +02:00
David Lamparter
0b128565c0 tests: duplicate stream tests in packed variant 2016-06-27 15:35:06 +02:00
David Lamparter
3059f4dd5c lib: make capn_inflate() work with unaligned data
init_fp itself tries to read 4 bytes for the segment count.
2016-06-27 15:34:51 +02:00
David Lamparter
5d787b698e compiler: add "C::nameinfix" annotation
allows changing output filenames from "foo.capnp.c" to
"foo.capnpSOMETHING.c" where SOMETHING is the argument to the
annotation.
2016-06-22 15:16:40 +02:00
David Lamparter
87591da455 Update autogenerated files 2016-06-22 14:24:28 +02:00
David Lamparter
1afce9573a lib: endianness: don't break strict-aliasing
Strict aliasing prohibits writing to union members of one type, then
reading another type.  The read is undefined.  Use memcpy instead (which
compilers will hopefully optimize away...)
2016-06-22 14:22:11 +02:00
David Lamparter
0abd16d62c lib: try GCC builtins for endian byteswap 2016-06-22 14:14:46 +02:00
David Lamparter
b3b83e0343 lib: make endian check more platform-friendly
neither Windows nor OSX have endian.h

autoconf checking this makes things worse on Windows too, so let's just
try endian.h on "unix" systems.
2016-06-22 14:03:36 +02:00
David Lamparter
48535d02bd whitespace fixes 2016-06-22 13:44:56 +02:00
David Lamparter
1c0652db2d Merge branch 'pullreq-6' (dropped ms_c_capnproto/) 2016-06-22 13:32:29 +02:00
David Lamparter
2b15c6ceae Merge pull request #5 from mikegarts/working.with.stricter.compilers
working with stricter compiler flags
2016-06-22 13:27:15 +02:00
David Lamparter
0e850b18ff Merge pull request #4 from mikegarts/short.circuit.endian
start making endianness switch less weird
2016-06-22 13:24:36 +02:00
Nathanael Jones
27df3d6064 Align capn_segment to 64-bit boundaries on MSVC
Unless capn_segment is defined with __declspec(align(64)),
check_segment_alignment fails to compile in x86 mode, as (sizeof(struct
capn_segment)&7) -> (44 & 7) evaluates to 4
Always compiles in x64 mode, as (sizeof(struct capn_segment)&7) -> (80 &
7) evaluates to 0
2016-05-11 10:30:41 -07:00
Nathanael Jones
8f37e0f618 Define default value for char *e
Visual studio's execution flow analysis insists that (e) could be
undefined. I don't see it, but this permits compilation.
2016-05-11 09:58:42 -07:00
Nathanael Jones
8d0ccbeeae Define ssize_t for MSVC
ssize_t is not available in visual studio, nor is sys/param.h We typedef
intmax_t to ssize_t
2016-05-11 09:57:41 -07:00
Michael Gartsbein
05f5884385 add u to avoid undefined shl 2016-05-05 11:40:13 +03:00
Michael Gartsbein
1d5a2c83b5 include fix 2016-05-05 10:55:12 +03:00
Michael Gartsbein
ec9bb1417e compile time endianess check, faster on little endian cpus 2016-04-28 12:02:29 +03:00
Michael Gartsbein
12ad949df8 working with stricter compiler flags 2016-04-28 12:01:08 +03:00
David Lamparter
a15accf4eb Merge pull request #3 from nathanaeljones/patch-1
Add build instructions
2016-04-27 19:54:21 +02:00
Nathanael Jones
cee25a3be7 Add build instructions 2016-04-27 10:25:43 -06:00
David Lamparter
e9df12b387 don't write out empty structs
"struct { } foo" is not valid ISO C99; while gcc/clang/icc support it,
other compilers and tools don't (e.g. pycparser)
2016-04-06 14:18:29 -03:00
Michael Gartsbein
90c3473406 support set of non terminated string (with len) 2016-04-06 11:40:18 +03:00
Michael Gartsbein
bf2c598f63 uint8_t cast 2016-03-29 10:26:01 +03:00
Michael Gartsbein
61a43a4998 static const instead of function in size getters 2016-03-29 10:25:33 +03:00
Michael Gartsbein
e870b5d605 generate setter and getter 2016-03-27 16:35:11 +03:00
David Lamparter
b58fa3b6a5 c-capnproto 0.1 release 2016-03-19 00:53:06 +01:00
David Lamparter
e626b3f26e README: fix travis link 2016-03-19 00:49:42 +01:00
David Lamparter
4de69a555d test.schema: drop interface & generic, regenerate 2016-03-19 00:46:05 +01:00
David Lamparter
7ecadefbfd compiler: fix remaining warnings 2016-03-19 00:39:30 +01:00
David Lamparter
3f9141616b add & install pkgconfig file 2016-03-19 00:39:30 +01:00
David Lamparter
00eaeeb936 lib: fix API
capn_new_string is exported as symbol but not in the header
capn_write_mem_packed is internal but the symbol is visible
2016-03-19 00:39:30 +01:00
David Lamparter
b18dc3de8c include README.md in dist tarball 2016-03-19 00:39:30 +01:00
David Lamparter
c2faf4e5da tests: move into tests/ subdir 2016-03-19 00:39:30 +01:00
David Lamparter
93351266ee gtest: integrate as git submodule 2016-03-19 00:39:29 +01:00
David Lamparter
811d3046e1 rename to "[lib]capnp_c", use lib/ subdir 2016-03-19 00:39:29 +01:00
David Lamparter
d3b1cad50f compiler: regenerate schema.c with enum/int cast 2016-03-19 00:39:25 +01:00
David Lamparter
41462901df lib: fix warning on uint16->enum cast 2016-03-19 00:36:24 +01:00
David Lamparter
332076e522 Fix empty-object pointers
Pointers are written as offsets to the segment start;  leaving p->data
as NULL results in invalid pointers for zero-size objects (particularly,
lists.)
2016-03-08 14:49:10 +01:00
David Lamparter
48ab119048 Travis CI: whatever.
gtest packages intentionally don't provide binaries anymore.
Will probably re-add as submodule later.
2016-02-28 18:38:41 +01:00
David Lamparter
c92a985849 Fix Travis CI even more...
automake 1.11 is sufficient (and what's installed by default on CI
boxes).  Also disable cap'n proto reference (it's not actually used)
2016-02-28 18:31:43 +01:00
David Lamparter
c02d6d59d0 Fix up Travis CI
... it doesn't autodetect that it needs to run autoreconf
Also add gtest package.
2016-02-28 18:26:35 +01:00
David Lamparter
663cfe2d23 Update Travis icon URL 2016-02-28 18:23:23 +01:00
David Lamparter
b18d178884 Remove "script" spec from travis.yml
Travis should autodetect & do the right thing for autoconf projects...
2016-02-28 18:20:23 +01:00
David Lamparter
89818b0286 tack on autoconf/automake build 2016-02-28 13:55:23 +01:00
David Lamparter
34f150dc1c Update merged forks 2016-02-28 12:52:38 +01:00