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
f04f6e77
Commit
f04f6e77
authored
Aug 23, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce that library header versions match capnp compiler version.
parent
83f9754e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
1 deletion
+72
-1
Makefile.am
c++/Makefile.am
+1
-0
common-test.c++
c++/src/capnp/common-test.c++
+48
-0
common.h
c++/src/capnp/common.h
+7
-0
capnpc-c++.c++
c++/src/capnp/compiler/capnpc-c++.c++
+7
-1
release.sh
release.sh
+9
-0
No files found.
c++/Makefile.am
View file @
f04f6e77
...
...
@@ -276,6 +276,7 @@ capnp_test_SOURCES = \
src/kj/mutex-test.c++
\
src/kj/parse/common-test.c++
\
src/kj/parse/char-test.c++
\
src/capnp/common-test.c++
\
src/capnp/blob-test.c++
\
src/capnp/endian-test.c++
\
src/capnp/endian-fallback-test.c++
\
...
...
c++/src/capnp/common-test.c++
0 → 100644
View file @
f04f6e77
// Copyright (c) 2013, Kenton Varda <temporal@gmail.com>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "common.h"
#include <gtest/gtest.h>
#include <kj/string.h>
#include <kj/debug.h>
#if HAVE_CONFIG_H
#include "config.h"
#endif
namespace
capnp
{
namespace
{
TEST
(
Common
,
Version
)
{
#ifdef VERSION
auto
expectedVersion
=
kj
::
str
(
CAPNP_VERSION_MAJOR
,
'.'
,
CAPNP_VERSION_MINOR
,
'.'
,
CAPNP_VERSION_MICRO
);
kj
::
StringPtr
actualVersion
=
VERSION
;
KJ_ASSERT
(
actualVersion
==
expectedVersion
||
actualVersion
.
startsWith
(
kj
::
str
(
expectedVersion
,
'-'
)),
expectedVersion
,
actualVersion
);
#endif
}
}
// namespace
}
// namespace capnp
c++/src/capnp/common.h
View file @
f04f6e77
...
...
@@ -33,6 +33,13 @@
namespace
capnp
{
#define CAPNP_VERSION_MAJOR 0
#define CAPNP_VERSION_MINOR 3
#define CAPNP_VERSION_MICRO 0
#define CAPNP_VERSION \
(CAPNP_VERSION_MAJOR * 1000000 + CAPNP_VERSION_MINOR * 1000 + CAPNP_VERSION_MICRO)
typedef
unsigned
int
uint
;
enum
class
Void
{
...
...
c++/src/capnp/compiler/capnpc-c++.c++
View file @
f04f6e77
...
...
@@ -1384,7 +1384,13 @@ private:
"#ifndef CAPNP_INCLUDED_"
,
kj
::
hex
(
node
.
getId
()),
"_
\n
"
,
"#define CAPNP_INCLUDED_"
,
kj
::
hex
(
node
.
getId
()),
"_
\n
"
"
\n
"
"#include <capnp/generated-header-support.h>
\n
"
,
"#include <capnp/generated-header-support.h>
\n
"
"
\n
"
"#if CAPNP_VERSION != "
,
CAPNP_VERSION
,
"
\n
"
"#error
\"
Version mismatch between generated code and library headers. You must "
"use the same version of the Cap'n Proto compiler and library.
\"\n
"
"#endif
\n
"
"
\n
"
,
KJ_MAP
(
includes
,
path
)
{
if
(
path
.
startsWith
(
"/"
))
{
return
kj
::
strTree
(
"#include <"
,
path
.
slice
(
1
),
".h>
\n
"
);
...
...
release.sh
View file @
f04f6e77
...
...
@@ -27,6 +27,15 @@ update_version() {
local
OLD_REGEX
=
${
OLD
//./[.]
}
doit
sed
-i
-e
"s/
$OLD_REGEX
/
$NEW
/g"
c++/configure.ac
local
NEW_NOTAG
=
${
NEW
%%-*
}
declare
-a
NEW_ARR
=(
${
NEW_NOTAG
//./
}
)
doit
sed
-i
-re
"
s/^#define CAPNP_VERSION_MAJOR [0-9]+
\$
/#define CAPNP_VERSION_MAJOR
${
NEW_ARR
[0]
}
/g;
s/^#define CAPNP_VERSION_MINOR [0-9]+
\$
/#define CAPNP_VERSION_MINOR
${
NEW_ARR
[1]
}
/g;
s/^#define CAPNP_VERSION_MICRO [0-9]+
\$
/#define CAPNP_VERSION_MICRO
${
NEW_ARR
[2]
:-
0
}
/g"
\
c++/src/capnp/common.h
doit git commit
-a
-m
"Set
$BRANCH_DESC
version to
$NEW
."
}
...
...
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