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
907b508e
Commit
907b508e
authored
Nov 25, 2016
by
Kenton Varda
Committed by
GitHub
Nov 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #387 from harrishancock/msvc-grab-bag
A grab bag of small changes to support the MSVC port
parents
b6d7079a
73e9b41a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
10 deletions
+39
-10
CMakeLists.txt
c++/src/capnp/CMakeLists.txt
+5
-3
json-test.c++
c++/src/capnp/compat/json-test.c++
+6
-1
dynamic.h
c++/src/capnp/dynamic.h
+14
-0
fuzz-test.c++
c++/src/capnp/fuzz-test.c++
+1
-1
generated-header-support.h
c++/src/capnp/generated-header-support.h
+1
-1
stringify.c++
c++/src/capnp/stringify.c++
+2
-1
common.h
c++/src/kj/common.h
+3
-0
io-test.c++
c++/src/kj/io-test.c++
+1
-1
one-of.h
c++/src/kj/one-of.h
+5
-1
thread.c++
c++/src/kj/thread.c++
+1
-1
No files found.
c++/src/capnp/CMakeLists.txt
View file @
907b508e
...
...
@@ -243,9 +243,11 @@ if(BUILD_TESTING)
${
test_capnp_h_files
}
)
target_link_libraries
(
capnp-heavy-tests
${
test_libraries
}
)
set_target_properties
(
capnp-heavy-tests
PROPERTIES COMPILE_FLAGS
"-Wno-deprecated-declarations"
)
if
(
NOT MSVC
)
set_target_properties
(
capnp-heavy-tests
PROPERTIES COMPILE_FLAGS
"-Wno-deprecated-declarations"
)
endif
()
add_dependencies
(
check capnp-heavy-tests
)
add_test
(
NAME capnp-heavy-tests-run COMMAND capnp-heavy-tests
)
...
...
c++/src/capnp/compat/json-test.c++
View file @
907b508e
...
...
@@ -577,7 +577,12 @@ KJ_TEST("basic json decoding") {
KJ_EXPECT_THROW_MESSAGE
(
"Input remains"
,
json
.
decodeRaw
(
"11a"
,
root
));
KJ_EXPECT_THROW_MESSAGE
(
"Invalid escape"
,
json
.
decodeRaw
(
R"("\z")"
,
root
));
KJ_EXPECT_THROW_MESSAGE
(
"Invalid escape"
,
json
.
decodeRaw
(
R"("\z")"
,
root
));
KJ_EXPECT_THROW_MESSAGE
(
"ends prematurely"
,
json
.
decodeRaw
(
R"(["\n\", 3])"
,
root
));
{
// TODO(msvc): This raw string literal currently confuses MSVC's preprocessor, so I hoisted
// it outside the macro.
auto
f
=
[
&
]
{
json
.
decodeRaw
(
R"(["\n\", 3])"
,
root
);
};
KJ_EXPECT_THROW_MESSAGE
(
"ends prematurely"
,
f
());
}
KJ_EXPECT_THROW_MESSAGE
(
"Invalid hex"
,
json
.
decodeRaw
(
R"("\u12zz")"
,
root
));
KJ_EXPECT_THROW_MESSAGE
(
"ends prematurely"
,
json
.
decodeRaw
(
"-"
,
root
));
KJ_EXPECT_THROW_MESSAGE
(
"Unexpected input"
,
json
.
decodeRaw
(
"--"
,
root
));
...
...
c++/src/capnp/dynamic.h
View file @
907b508e
...
...
@@ -634,6 +634,7 @@ public:
// - DynamicEnum: Returns the corresponding type.
// - DynamicStruct, DynamicList: Returns the corresponding Reader.
// - Any capability type, including DynamicCapability: Returns the corresponding Client.
// - DynamicValue: Returns an identical Reader. Useful to avoid special-casing in generic code.
// (TODO(perf): On GCC 4.8 / Clang 3.3, provide rvalue-qualified version that avoids
// refcounting.)
//
...
...
@@ -1408,6 +1409,19 @@ struct DynamicValue::Builder::AsImpl<T, Kind::INTERFACE> {
}
};
template
<>
struct
DynamicValue
::
Reader
::
AsImpl
<
DynamicValue
>
{
static
DynamicValue
::
Reader
apply
(
const
Reader
&
reader
)
{
return
reader
;
}
};
template
<>
struct
DynamicValue
::
Builder
::
AsImpl
<
DynamicValue
>
{
static
DynamicValue
::
Builder
apply
(
Builder
&
builder
)
{
return
builder
;
}
};
inline
DynamicValue
::
Pipeline
::
Pipeline
(
std
::
nullptr_t
n
)
:
type
(
UNKNOWN
)
{}
inline
DynamicValue
::
Pipeline
::
Pipeline
(
DynamicStruct
::
Pipeline
&&
value
)
:
type
(
STRUCT
),
structValue
(
kj
::
mv
(
value
))
{}
...
...
c++/src/capnp/fuzz-test.c++
View file @
907b508e
...
...
@@ -36,7 +36,7 @@ struct SkipTestHack {
SkipTestHack
()
{
if
(
getenv
(
"CAPNP_SKIP_FUZZ_TEST"
)
!=
nullptr
)
{
char
message
[]
=
"Skipping test because CAPNP_SKIP_FUZZ_TEST is set in environment.
\n
"
;
write
(
STDOUT_FILENO
,
message
,
sizeof
(
message
));
KJ_SYSCALL
(
write
(
STDOUT_FILENO
,
message
,
sizeof
(
message
)
));
_exit
(
0
);
}
}
...
...
c++/src/capnp/generated-header-support.h
View file @
907b508e
...
...
@@ -19,7 +19,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
// This file is included f
or
m all generated headers.
// This file is included f
ro
m all generated headers.
#ifndef CAPNP_GENERATED_HEADER_SUPPORT_H_
#define CAPNP_GENERATED_HEADER_SUPPORT_H_
...
...
c++/src/capnp/stringify.c++
View file @
907b508e
...
...
@@ -58,7 +58,8 @@ public:
if
(
amount
==
0
||
canPrintAllInline
(
items
,
kind
))
{
return
kj
::
StringTree
(
kj
::
mv
(
items
),
", "
);
}
else
{
char
delim
[
amount
*
2
+
3
];
KJ_STACK_ARRAY
(
char
,
delimArrayPtr
,
amount
*
2
+
3
,
32
,
256
);
auto
delim
=
delimArrayPtr
.
begin
();
delim
[
0
]
=
','
;
delim
[
1
]
=
'\n'
;
memset
(
delim
+
2
,
' '
,
amount
*
2
);
...
...
c++/src/kj/common.h
View file @
907b508e
...
...
@@ -86,6 +86,9 @@
#endif
#if defined(_MSC_VER)
#ifndef NOMINMAX
#define NOMINMAX 1
#endif
#include <intrin.h> // __popcnt
#endif
...
...
c++/src/kj/io-test.c++
View file @
907b508e
...
...
@@ -56,7 +56,7 @@ TEST(Io, WriteVec) {
KJ_TEST
(
"stringify AutoCloseFd"
)
{
int
fds
[
2
];
miniposix
::
pipe
(
fds
);
KJ_SYSCALL
(
miniposix
::
pipe
(
fds
)
);
AutoCloseFd
in
(
fds
[
0
]),
out
(
fds
[
1
]);
KJ_EXPECT
(
kj
::
str
(
in
)
==
kj
::
str
(
fds
[
0
]),
in
,
fds
[
0
]);
...
...
c++/src/kj/one-of.h
View file @
907b508e
...
...
@@ -94,8 +94,12 @@ private:
// TODO(someday): Generalize the above template and make it common. I tried, but C++ decided to
// be difficult so I cut my losses.
static
constexpr
auto
spaceSize
=
maxSize
(
sizeof
(
Variants
)...);
// TODO(msvc): This constant could just as well go directly inside space's bracket's, where it's
// used, but MSVC suffers a parse error on `...`.
union
{
byte
space
[
maxSize
(
sizeof
(
Variants
)...)
];
byte
space
[
spaceSize
];
void
*
forceAligned
;
// TODO(someday): Use C++11 alignas() once we require GCC 4.8 / Clang 3.3.
...
...
c++/src/kj/thread.c++
View file @
907b508e
...
...
@@ -134,7 +134,7 @@ void* Thread::runThread(void* ptr) {
void
Thread
::
ThreadState
::
unref
()
{
#if _MSC_VER
if
(
_InterlockedDecrement
(
&
refcount
))
{
if
(
_InterlockedDecrement
(
&
refcount
)
==
0
)
{
#else
if
(
__atomic_sub_fetch
(
&
refcount
,
1
,
__ATOMIC_RELEASE
)
==
0
)
{
__atomic_thread_fence
(
__ATOMIC_ACQUIRE
);
...
...
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