Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
5c5cd461
Commit
5c5cd461
authored
Aug 22, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix GCC problems.
parent
0c93fd60
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
37 deletions
+69
-37
capnp.c++
c++/src/capnp/compiler/capnp.c++
+1
-0
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+3
-0
capnpc-capnp.c++
c++/src/capnp/compiler/capnpc-capnp.c++
+4
-1
encoding-test.c++
c++/src/capnp/encoding-test.c++
+9
-9
schema-parser-test.c++
c++/src/capnp/schema-parser-test.c++
+1
-1
super-test.sh
super-test.sh
+51
-26
No files found.
c++/src/capnp/compiler/capnp.c++
View file @
5c5cd461
...
...
@@ -233,6 +233,7 @@ public:
kj
::
MainBuilder
::
Validity
generateId
()
{
context
.
exitInfo
(
kj
::
str
(
"@0x"
,
kj
::
hex
(
generateRandomId
())));
KJ_CLANG_KNOWS_THIS_IS_UNREACHABLE_BUT_GCC_DOESNT
;
}
// =====================================================================================
...
...
c++/src/capnp/compiler/capnpc-c++.c++
View file @
5c5cd461
...
...
@@ -546,6 +546,7 @@ private:
return
kj
::
strTree
(
"!_reader.isPointerFieldNull("
,
slot
.
offset
,
" * ::capnp::POINTERS)"
);
}
KJ_UNREACHABLE
;
},
"
\n
|| "
),
";
\n
"
"}
\n
"
"inline bool "
,
scope
,
"Builder::has"
,
titleCase
,
"() {
\n
"
,
...
...
@@ -563,6 +564,7 @@ private:
return
kj
::
strTree
(
"!_builder.isPointerFieldNull("
,
slot
.
offset
,
" * ::capnp::POINTERS)"
);
}
KJ_UNREACHABLE
;
},
"
\n
|| "
),
";
\n
"
"}
\n
"
"inline "
,
scope
,
titleCase
,
"::Reader "
,
scope
,
"Reader::get"
,
titleCase
,
"() const {
\n
"
,
...
...
@@ -587,6 +589,7 @@ private:
return
kj
::
strTree
(
" _builder.clearPointer("
,
slot
.
offset
,
" * ::capnp::POINTERS);
\n
"
);
}
KJ_UNREACHABLE
;
},
" return "
,
scope
,
titleCase
,
"::Builder(_builder);
\n
"
"}
\n
"
)
...
...
c++/src/capnp/compiler/capnpc-capnp.c++
View file @
5c5cd461
...
...
@@ -345,9 +345,12 @@ private:
}
else
{
seenUnion
=
true
;
uint
offset
=
schema
.
getProto
().
getStruct
().
getDiscriminantOffset
();
// GCC 4.7.3 crashes if you inline unionFields.
auto
unionFields
=
sortByCodeOrder
(
schema
.
getUnionFields
());
return
kj
::
strTree
(
indent
,
"union { # tag bits ["
,
offset
*
16
,
", "
,
offset
*
16
+
16
,
")
\n
"
,
KJ_MAP
(
sortByCodeOrder
(
schema
.
getUnionFields
())
,
uField
)
{
KJ_MAP
(
unionFields
,
uField
)
{
return
genStructField
(
uField
.
getProto
(),
schema
,
indent
.
next
());
},
indent
,
"}
\n
"
);
...
...
c++/src/capnp/encoding-test.c++
View file @
5c5cd461
...
...
@@ -379,8 +379,8 @@ TEST(Encoding, UnnamedUnion) {
EXPECT_TRUE
(
root
.
hasBar
());
EXPECT_FALSE
(
root
.
asReader
().
hasFoo
());
EXPECT_TRUE
(
root
.
asReader
().
hasBar
());
EXPECT_EQ
(
321
,
root
.
getBar
());
EXPECT_EQ
(
321
,
root
.
asReader
().
getBar
());
EXPECT_EQ
(
321
u
,
root
.
getBar
());
EXPECT_EQ
(
321
u
,
root
.
asReader
().
getBar
());
EXPECT_DEBUG_ANY_THROW
(
root
.
getFoo
());
EXPECT_DEBUG_ANY_THROW
(
root
.
asReader
().
getFoo
());
...
...
@@ -391,17 +391,17 @@ TEST(Encoding, UnnamedUnion) {
EXPECT_FALSE
(
root
.
hasBar
());
EXPECT_TRUE
(
root
.
asReader
().
hasFoo
());
EXPECT_FALSE
(
root
.
asReader
().
hasBar
());
EXPECT_EQ
(
123
,
root
.
getFoo
());
EXPECT_EQ
(
123
,
root
.
asReader
().
getFoo
());
EXPECT_EQ
(
123
u
,
root
.
getFoo
());
EXPECT_EQ
(
123
u
,
root
.
asReader
().
getFoo
());
EXPECT_DEBUG_ANY_THROW
(
root
.
getBar
());
EXPECT_DEBUG_ANY_THROW
(
root
.
asReader
().
getBar
());
StructSchema
schema
=
Schema
::
from
<
test
::
TestUnnamedUnion
>
();
// The discriminant is allocated just before allocating "bar".
EXPECT_EQ
(
2
,
schema
.
getProto
().
getStruct
().
getDiscriminantOffset
());
EXPECT_EQ
(
0
,
schema
.
getFieldByName
(
"foo"
).
getProto
().
getNonGroup
().
getOffset
());
EXPECT_EQ
(
2
,
schema
.
getFieldByName
(
"bar"
).
getProto
().
getNonGroup
().
getOffset
());
EXPECT_EQ
(
2
u
,
schema
.
getProto
().
getStruct
().
getDiscriminantOffset
());
EXPECT_EQ
(
0
u
,
schema
.
getFieldByName
(
"foo"
).
getProto
().
getNonGroup
().
getOffset
());
EXPECT_EQ
(
2
u
,
schema
.
getFieldByName
(
"bar"
).
getProto
().
getNonGroup
().
getOffset
());
}
TEST
(
Encoding
,
Groups
)
{
...
...
@@ -569,7 +569,7 @@ TEST(Encoding, UnionDefault) {
{
auto
field
=
reader
.
getUnnamed1
();
EXPECT_EQ
(
test
::
TestUnnamedUnion
::
FOO
,
field
.
which
());
EXPECT_EQ
(
123
,
field
.
getFoo
());
EXPECT_EQ
(
123
u
,
field
.
getFoo
());
EXPECT_FALSE
(
field
.
hasBefore
());
EXPECT_FALSE
(
field
.
hasAfter
());
}
...
...
@@ -577,7 +577,7 @@ TEST(Encoding, UnionDefault) {
{
auto
field
=
reader
.
getUnnamed2
();
EXPECT_EQ
(
test
::
TestUnnamedUnion
::
BAR
,
field
.
which
());
EXPECT_EQ
(
321
,
field
.
getBar
());
EXPECT_EQ
(
321
u
,
field
.
getBar
());
EXPECT_EQ
(
"foo"
,
field
.
getBefore
());
EXPECT_EQ
(
"bar"
,
field
.
getAfter
());
}
...
...
c++/src/capnp/schema-parser-test.c++
View file @
5c5cd461
...
...
@@ -99,7 +99,7 @@ TEST(SchemaParser, Basic) {
auto
barStruct
=
barSchema
.
getNested
(
"Bar"
);
auto
barFields
=
barStruct
.
asStruct
().
getFields
();
ASSERT_EQ
(
4
,
barFields
.
size
());
ASSERT_EQ
(
4
u
,
barFields
.
size
());
EXPECT_EQ
(
"baz"
,
barFields
[
0
].
getProto
().
getName
());
EXPECT_EQ
(
0x823456789abcdef1ull
,
getFieldTypeFileId
(
barFields
[
0
]));
EXPECT_EQ
(
"corge"
,
barFields
[
1
].
getProto
().
getName
());
...
...
super-test.sh
View file @
5c5cd461
...
...
@@ -7,10 +7,16 @@ doit() {
"
$@
"
}
if
[
$#
-gt
0
]
;
then
if
[
"x
$1
"
==
"xtest"
]
;
then
:
# nothing
elif
[
"x
$1
"
==
"xremote"
]
;
then
QUICK
=
while
[
$#
-gt
0
]
;
do
case
"
$1
"
in
test
)
;;
# nothing
quick
)
QUICK
=
quick
;;
remote
)
if
[
"$#"
-lt
2
]
;
then
echo
"usage:
$0
remote HOST [COMMAND]"
>
&2
exit
1
...
...
@@ -24,11 +30,14 @@ if [ $# -gt 0 ]; then
git push ssh://
$HOST
/~/tmp-test-capnp master:test
ssh
$HOST
"cd tmp-test-capnp && git checkout test && ./super-test.sh
$@
&& cd .. && rm -rf tmp-test-capnp"
exit
0
elif
[
"x
$1
"
==
"xclang"
]
;
then
;;
clang
)
export
CXX
=
clang++
elif
[
"x
$1
"
==
"xgcc-4.8"
]
;
then
;;
gcc-4.8
)
export
CXX
=
g++-4.8
elif
[
"x
$1
"
==
"xkenton"
]
;
then
;;
kenton
)
cat
<<
"__EOF__"
=========================================================================
*************************************************************************
...
...
@@ -41,7 +50,7 @@ if [ $# -gt 0 ]; then
*************************************************************************
=========================================================================
__EOF__
$0 test
$0 test $QUICK
$0 clean
cat << "__EOF__"
=========================================================================
...
...
@@ -55,7 +64,7 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0
remote beat
$0
remote beat
$QUICK
cat
<<
"__EOF__"
=========================================================================
*************************************************************************
...
...
@@ -68,7 +77,7 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0 remote Kenton@flashman
$0 remote Kenton@flashman $QUICK
cat << "__EOF__"
=========================================================================
*************************************************************************
...
...
@@ -81,7 +90,7 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0 gcc-4.8
$0 gcc-4.8 $QUICK
$0 clean
cat << "__EOF__"
=========================================================================
...
...
@@ -95,7 +104,7 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0 clang
$0 clang $QUICK
$0 clean
cat << "__EOF__"
=========================================================================
...
...
@@ -110,7 +119,8 @@ __EOF__
=========================================================================
__EOF__
exit 0
elif [ "x$1" == "xclean" ]; then
;;
clean )
rm -rf tmp-staging
cd c++
if [ -e Makefile ]; then
...
...
@@ -119,7 +129,8 @@ __EOF__
rm -f capnproto-*.tar.gz samples/addressbook samples/addressbook.capnp.c++ \
samples/addressbook.capnp.h
exit 0
elif [ "x$1" == "xhelp" ]; then
;;
help )
echo "usage: $0 [COMMAND]"
echo "commands:"
echo " test Runs tests (the default)."
...
...
@@ -130,27 +141,36 @@ __EOF__
echo " clean Delete temporary files that may be left after failure."
echo " help Prints this help text."
exit 0
else
;;
* )
echo "unknown command: $1" >&2
echo "try: $0 help" >&2
exit 1
fi
fi
;;
esac
shift
done
rm -rf tmp-staging
mkdir tmp-staging
STAGING=$PWD/tmp-staging
mkdir $STAGING/bin
mkdir $STAGING/lib
export PATH=$STAGING/bin:$PATH
export LD_LIBRARY_PATH=$STAGING/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
if [ "$QUICK" != quick ]; then
rm -rf "$STAGING"
mkdir "$STAGING"
mkdir "$STAGING/bin"
mkdir "$STAGING/lib"
export PATH=$STAGING/bin:$PATH
export LD_LIBRARY_PATH=$STAGING/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
fi
if [ "$QUICK" = quick ]; then
echo "************************** QUICK TEST ***********************************"
fi
echo "========================================================================="
echo "Building c++"
echo "========================================================================="
if [ "x`uname`" =
=
xDarwin ]; then
if [ "x`uname`" = xDarwin ]; then
if [ ! -e ~/clang-3.2/bin/clang++ ]; then
echo "You need to put the clang-3.2 binaries in ~/clang-3.2." >&2
exit 1
...
...
@@ -167,14 +187,19 @@ doit autoreconf -i
doit ./configure --prefix="$STAGING"
doit make -j6 check
if [ "$QUICK" = quick ]; then
make maintainer-clean
exit 0
fi
echo "========================================================================="
echo "Testing c++ install"
echo "========================================================================="
doit make install
test "x$(which capnp)" =
=
"x$STAGING/bin/capnp"
test "x$(which capnpc-c++)" =
=
"x$STAGING/bin/capnpc-c++"
test "x$(which capnp)" = "x$STAGING/bin/capnp"
test "x$(which capnpc-c++)" = "x$STAGING/bin/capnpc-c++"
cd samples
doit capnp compile -oc++ addressbook.capnp -I"$STAGING"/include --no-standard-import
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment