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
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
115 additions
and
83 deletions
+115
-83
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
+97
-72
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,29 +7,38 @@ doit() {
"
$@
"
}
if
[
$#
-gt
0
]
;
then
if
[
"x
$1
"
==
"xtest"
]
;
then
:
# nothing
elif
[
"x
$1
"
==
"xremote"
]
;
then
if
[
"$#"
-lt
2
]
;
then
echo
"usage:
$0
remote HOST [COMMAND]"
>
&2
exit
1
fi
HOST
=
$2
shift
2
echo
"========================================================================="
echo
"Pushing code to
$HOST
..."
echo
"========================================================================="
ssh
$HOST
'rm -rf tmp-test-capnp && mkdir tmp-test-capnp && git init tmp-test-capnp'
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
export
CXX
=
clang++
elif
[
"x
$1
"
==
"xgcc-4.8"
]
;
then
export
CXX
=
g++-4.8
elif
[
"x
$1
"
==
"xkenton"
]
;
then
cat
<<
"__EOF__"
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
fi
HOST
=
$2
shift
2
echo
"========================================================================="
echo
"Pushing code to
$HOST
..."
echo
"========================================================================="
ssh
$HOST
'rm -rf tmp-test-capnp && mkdir tmp-test-capnp && git init tmp-test-capnp'
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
;;
clang
)
export
CXX
=
clang++
;;
gcc-4.8
)
export
CXX
=
g++-4.8
;;
kenton
)
cat
<<
"__EOF__"
=========================================================================
*************************************************************************
_ _ ____ ____ ____
...
...
@@ -41,9 +50,9 @@ if [ $# -gt 0 ]; then
*************************************************************************
=========================================================================
__EOF__
$0 test
$0 clean
cat << "__EOF__"
$0 test $QUICK
$0 clean
cat << "__EOF__"
=========================================================================
*************************************************************************
___ ______ __ ____ _
...
...
@@ -55,8 +64,8 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0
remote beat
cat
<<
"__EOF__"
$0
remote beat
$QUICK
cat
<<
"__EOF__"
=========================================================================
*************************************************************************
____ _
...
...
@@ -68,8 +77,8 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0 remote Kenton@flashman
cat << "__EOF__"
$0 remote Kenton@flashman $QUICK
cat << "__EOF__"
=========================================================================
*************************************************************************
____ ____ ____ _ _ ___
...
...
@@ -81,9 +90,9 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0 gcc-4.8
$0 clean
cat << "__EOF__"
$0 gcc-4.8 $QUICK
$0 clean
cat << "__EOF__"
=========================================================================
*************************************************************************
_ _ ____ _
...
...
@@ -95,9 +104,9 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
$0 clang
$0 clean
cat << "__EOF__"
$0 clang $QUICK
$0 clean
cat << "__EOF__"
=========================================================================
*************************************************************************
____ _ _ ___ ____ ___ _____
...
...
@@ -109,48 +118,59 @@ __EOF__
*************************************************************************
=========================================================================
__EOF__
exit 0
elif [ "x$1" == "xclean" ]; then
rm -rf tmp-staging
cd c++
if [ -e Makefile ]; then
doit make maintainer-clean
fi
rm -f capnproto-*.tar.gz samples/addressbook samples/addressbook.capnp.c++ \
samples/addressbook.capnp.h
exit 0
elif [ "x$1" == "xhelp" ]; then
echo "usage: $0 [COMMAND]"
echo "commands:"
echo " test Runs tests (the default)."
echo " clang Runs tests using Clang compiler."
echo " gcc-4.8 Runs tests using gcc-4.8."
echo " remote HOST Runs tests on HOST via SSH."
echo " kenton Kenton'
s meta-test
(
uses hosts on Kenton
's network)."
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
exit 0
;;
clean )
rm -rf tmp-staging
cd c++
if [ -e Makefile ]; then
doit make maintainer-clean
fi
rm -f capnproto-*.tar.gz samples/addressbook samples/addressbook.capnp.c++ \
samples/addressbook.capnp.h
exit 0
;;
help )
echo "usage: $0 [COMMAND]"
echo "commands:"
echo " test Runs tests (the default)."
echo " clang Runs tests using Clang compiler."
echo " gcc-4.8 Runs tests using gcc-4.8."
echo " remote HOST Runs tests on HOST via SSH."
echo " kenton Kenton'
s meta-test
(
uses hosts on Kenton
's network)."
echo " clean Delete temporary files that may be left after failure."
echo " help Prints this help text."
exit 0
;;
* )
echo "unknown command: $1" >&2
echo "try: $0 help" >&2
exit 1
;;
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