Skip to content
This repository has been archived by the owner on Nov 4, 2023. It is now read-only.

GCC align attribute #13

Open
wants to merge 112 commits into
base: master
Choose a base branch
from
Open

Conversation

killdaclick
Copy link

Added align attribute for GCC.
Would not cross compile for 32bit ARM.

Steve Dee and others added 30 commits February 5, 2014 14:02
Fixes a compiler warning.
Renamed gtest/include to gtest/gtest since that's what the include files
expected.

Adjusted the Makefile to work through it all.
No real need to build a gtest archive, gtest-all.cc includes all the
files so a single .o is fine.
It is not used and we already validated the total buffer size
beforehand.
Should make it a bit more readable, the variable is used before that
case as well but doesn't require the zero initialization in that case.
The hdr variable gets the same constants as value but it is easier to
understand that the constants are used than the hdr which needs to be
traced to the value it received.
The header of packing is a single byte and nothing was written to the
first byte anyway.
This uses the capn_deflate function.

The current use may get smaller packing than the maximum possible due to
the inability to peak around segments as it packs each segment on its
own. This saves time compared to copying everything into one place and
saves effort by not requiring to change the interface of capn_deflate to
support multiple different buffers.

It should be possible to make the capn_deflate state machine better to
handle the multiple buffers case too.
…ored gtest-all.cpp

builds cleanly (minus a couple warnings in the test code itself) on OS X 10.10.4 with “Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)”
previously, this was emitting the following warning (treated as error):

`c++ -g -Wall -Werror -I. -Igtest-1.7.0/include -o capn-test.o -c capn-test.cpp
capn-test.cpp:66:29: error: unused variable 'SUBSTRUCT_DEFAULT' [-Werror,-Wunused-const-variable]
static const AlignedData<2> SUBSTRUCT_DEFAULT = {{0,0,0,0,1,0,0,0,  0,0,0,0,0,0,0,0}};
                            ^
capn-test.cpp:67:29: error: unused variable 'STRUCTLIST_ELEMENT_SUBSTRUCT_DEFAULT' [-Werror,-Wunused-const-variable]
static const AlignedData<2> STRUCTLIST_ELEMENT_SUBSTRUCT_DEFAULT =
                            ^`
lilith and others added 30 commits April 27, 2016 10:25
ssize_t is not available in visual studio, nor is sys/param.h We typedef
intmax_t to ssize_t
Visual studio's execution flow analysis insists that (e) could be
undefined. I don't see it, but this permits compilation.
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
…ndian

start making endianness switch less weird
…ricter.compilers

working with stricter compiler flags
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.
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...)
allows changing output filenames from "foo.capnp.c" to
"foo.capnpSOMETHING.c" where SOMETHING is the argument to the
annotation.
init_fp itself tries to read 4 bytes for the segment count.
Missing braces end up scaling the offset by * 4 ... which is actually a
stack/heap overflow.
There is no point in having these functions be part of the public API.
This reverts commit 1afce95.

Turns out this is a misunderstanding of the C standard...  meh.
Fixes github issue opensourcerouting#11, also makes it easier to use annotations.
Generating per-field getters/setters adds a lot of functions; this makes
them switchable with an annotation in the source schema.
This fixes #include output when $C.nameinfix is used.
Would not cross compile for 32bit ARM.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants