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
373e4ea4
Commit
373e4ea4
authored
Mar 10, 2016
by
Harris Hancock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return nullptr from MSVC PtmfHelper until ported
parent
a8106dea
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
16 deletions
+23
-16
async-inl.h
c++/src/kj/async-inl.h
+23
-16
No files found.
c++/src/kj/async-inl.h
View file @
373e4ea4
...
@@ -255,12 +255,25 @@ class PtmfHelper {
...
@@ -255,12 +255,25 @@ class PtmfHelper {
friend
struct
GetFunctorStartAddress
;
friend
struct
GetFunctorStartAddress
;
#if __GNUG__
#if __GNUG__
void
*
ptr
;
void
*
ptr
;
ptrdiff_t
adj
;
ptrdiff_t
adj
;
// Layout of a pointer-to-member-function used by GCC and compatible compilers.
// Layout of a pointer-to-member-function used by GCC and compatible compilers.
void
*
apply
(
void
*
obj
)
{
#if defined(__arm__) || defined(__mips__) || defined(__aarch64__)
if
(
adj
&
1
)
{
ptrdiff_t
voff
=
(
ptrdiff_t
)
ptr
;
#else
#else
#error "TODO(port): PTMF instruction address extraction"
ptrdiff_t
voff
=
(
ptrdiff_t
)
ptr
;
if
(
voff
&
1
)
{
voff
&=
~
1
;
#endif
#endif
return
*
(
void
**
)(
*
(
char
**
)
obj
+
voff
);
}
else
{
return
ptr
;
}
}
#define BODY \
#define BODY \
PtmfHelper result; \
PtmfHelper result; \
...
@@ -268,6 +281,15 @@ class PtmfHelper {
...
@@ -268,6 +281,15 @@ class PtmfHelper {
memcpy(&result, &p, sizeof(result)); \
memcpy(&result, &p, sizeof(result)); \
return result
return result
#else // __GNUG__
void
*
apply
(
void
*
obj
)
{
return
nullptr
;
}
// TODO(port): PTMF instruction address extraction
#define BODY return PtmfHelper{}
#endif // __GNUG__, else
template
<
typename
R
,
typename
C
,
typename
...
P
,
typename
F
>
template
<
typename
R
,
typename
C
,
typename
...
P
,
typename
F
>
static
PtmfHelper
from
(
F
p
)
{
BODY
;
}
static
PtmfHelper
from
(
F
p
)
{
BODY
;
}
// Create a PtmfHelper from some arbitrary pointer-to-member-function which is not
// Create a PtmfHelper from some arbitrary pointer-to-member-function which is not
...
@@ -284,21 +306,6 @@ class PtmfHelper {
...
@@ -284,21 +306,6 @@ class PtmfHelper {
// guess at P. Luckily, if the function parameters are template parameters then it's not
// guess at P. Luckily, if the function parameters are template parameters then it's not
// necessary to be precise about P.
// necessary to be precise about P.
#undef BODY
#undef BODY
void
*
apply
(
void
*
obj
)
{
#if defined(__arm__) || defined(__mips__) || defined(__aarch64__)
if
(
adj
&
1
)
{
ptrdiff_t
voff
=
(
ptrdiff_t
)
ptr
;
#else
ptrdiff_t
voff
=
(
ptrdiff_t
)
ptr
;
if
(
voff
&
1
)
{
voff
&=
~
1
;
#endif
return
*
(
void
**
)(
*
(
char
**
)
obj
+
voff
);
}
else
{
return
ptr
;
}
}
};
};
template
<
typename
...
ParamTypes
>
template
<
typename
...
ParamTypes
>
...
...
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