Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
c045251b
Commit
c045251b
authored
4 years ago
by
Rye Mutt
Browse files
Options
Downloads
Patches
Plain Diff
Fix ODR violations
parent
3d92ed98
No related branches found
No related tags found
No related merge requests found
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/llcommon/llsdutil.cpp
+2
-2
2 additions, 2 deletions
indra/llcommon/llsdutil.cpp
indra/llcommon/tests/llpounceable_test.cpp
+19
-19
19 additions, 19 deletions
indra/llcommon/tests/llpounceable_test.cpp
with
21 additions
and
21 deletions
indra/llcommon/llsdutil.cpp
+
2
−
2
View file @
c045251b
...
@@ -500,7 +500,7 @@ bool filter_llsd_with_template(
...
@@ -500,7 +500,7 @@ bool filter_llsd_with_template(
* Helpers for llsd_matches()
* Helpers for llsd_matches()
*****************************************************************************/
*****************************************************************************/
// raw data used for LLSD::Type lookup
// raw data used for LLSD::Type lookup
struct
Data
struct
LLSDType
Data
{
{
LLSD
::
Type
type
;
LLSD
::
Type
type
;
const
char
*
name
;
const
char
*
name
;
...
@@ -529,7 +529,7 @@ class TypeLookup
...
@@ -529,7 +529,7 @@ class TypeLookup
public:
public:
TypeLookup
()
TypeLookup
()
{
{
for
(
const
Data
*
di
(
boost
::
begin
(
typedata
)),
*
dend
(
boost
::
end
(
typedata
));
di
!=
dend
;
++
di
)
for
(
const
LLSDType
Data
*
di
(
boost
::
begin
(
typedata
)),
*
dend
(
boost
::
end
(
typedata
));
di
!=
dend
;
++
di
)
{
{
mMap
[
di
->
type
]
=
di
->
name
;
mMap
[
di
->
type
]
=
di
->
name
;
}
}
...
...
This diff is collapsed.
Click to expand it.
indra/llcommon/tests/llpounceable_test.cpp
+
19
−
19
View file @
c045251b
...
@@ -27,24 +27,24 @@ void append(std::string* dest, const std::string& src)
...
@@ -27,24 +27,24 @@ void append(std::string* dest, const std::string& src)
}
}
/*-------------------------- Data-struct testing ---------------------------*/
/*-------------------------- Data-struct testing ---------------------------*/
struct
Data
struct
Pounceable
Data
{
{
Data
(
const
std
::
string
&
data
)
:
Pounceable
Data
(
const
std
::
string
&
data
)
:
mData
(
data
)
mData
(
data
)
{}
{}
const
std
::
string
mData
;
const
std
::
string
mData
;
};
};
void
setter
(
Data
**
dest
,
Data
*
ptr
)
void
setter
(
Pounceable
Data
**
dest
,
Pounceable
Data
*
ptr
)
{
{
*
dest
=
ptr
;
*
dest
=
ptr
;
}
}
static
Data
*
static_check
=
0
;
static
Pounceable
Data
*
static_check
=
0
;
// Set up an extern pointer to an LLPounceableStatic so the linker will fill
// Set up an extern pointer to an LLPounceableStatic so the linker will fill
// in the forward reference from below, before runtime.
// in the forward reference from below, before runtime.
extern
LLPounceable
<
Data
*
,
LLPounceableStatic
>
gForward
;
extern
LLPounceable
<
Pounceable
Data
*
,
LLPounceableStatic
>
gForward
;
struct
EnqueueCall
struct
EnqueueCall
{
{
...
@@ -64,7 +64,7 @@ struct EnqueueCall
...
@@ -64,7 +64,7 @@ struct EnqueueCall
// to remark, we want this call not to crash.
// to remark, we want this call not to crash.
// Now declare gForward. Its constructor should not run until after nqcall's.
// Now declare gForward. Its constructor should not run until after nqcall's.
LLPounceable
<
Data
*
,
LLPounceableStatic
>
gForward
;
LLPounceable
<
Pounceable
Data
*
,
LLPounceableStatic
>
gForward
;
/*****************************************************************************
/*****************************************************************************
* TUT
* TUT
...
@@ -90,7 +90,7 @@ namespace tut
...
@@ -90,7 +90,7 @@ namespace tut
// implementing it with an LLSingleton queue. This models (say)
// implementing it with an LLSingleton queue. This models (say)
// LLPounceableStatic<LLMessageSystem*, LLPounceableStatic>.
// LLPounceableStatic<LLMessageSystem*, LLPounceableStatic>.
ensure
(
"static_check should still be null"
,
!
static_check
);
ensure
(
"static_check should still be null"
,
!
static_check
);
Data
myData
(
"test<1>"
);
Pounceable
Data
myData
(
"test<1>"
);
gForward
=
&
myData
;
// should run setter
gForward
=
&
myData
;
// should run setter
ensure_equals
(
"static_check should be &myData"
,
static_check
,
&
myData
);
ensure_equals
(
"static_check should be &myData"
,
static_check
,
&
myData
);
}
}
...
@@ -105,13 +105,13 @@ namespace tut
...
@@ -105,13 +105,13 @@ namespace tut
// We expect that LLPounceable<T, LLPounceableQueue> should have
// We expect that LLPounceable<T, LLPounceableQueue> should have
// different queues because that specialization stores the queue
// different queues because that specialization stores the queue
// directly in the LLPounceable instance.
// directly in the LLPounceable instance.
Data
*
aptr
=
0
,
*
bptr
=
0
;
Pounceable
Data
*
aptr
=
0
,
*
bptr
=
0
;
LLPounceable
<
Data
*>
a
,
b
;
LLPounceable
<
Pounceable
Data
*>
a
,
b
;
a
.
callWhenReady
(
boost
::
bind
(
setter
,
&
aptr
,
_1
));
a
.
callWhenReady
(
boost
::
bind
(
setter
,
&
aptr
,
_1
));
b
.
callWhenReady
(
boost
::
bind
(
setter
,
&
bptr
,
_1
));
b
.
callWhenReady
(
boost
::
bind
(
setter
,
&
bptr
,
_1
));
ensure
(
"aptr should be null"
,
!
aptr
);
ensure
(
"aptr should be null"
,
!
aptr
);
ensure
(
"bptr should be null"
,
!
bptr
);
ensure
(
"bptr should be null"
,
!
bptr
);
Data
adata
(
"a"
),
bdata
(
"b"
);
Pounceable
Data
adata
(
"a"
),
bdata
(
"b"
);
a
=
&
adata
;
a
=
&
adata
;
ensure_equals
(
"aptr should be &adata"
,
aptr
,
&
adata
);
ensure_equals
(
"aptr should be &adata"
,
aptr
,
&
adata
);
// but we haven't yet set b
// but we haven't yet set b
...
@@ -127,13 +127,13 @@ namespace tut
...
@@ -127,13 +127,13 @@ namespace tut
// LLPounceable<T, LLPounceableStatic> should also have a distinct
// LLPounceable<T, LLPounceableStatic> should also have a distinct
// queue for each instance, but that engages an additional map lookup
// queue for each instance, but that engages an additional map lookup
// because there's only one LLSingleton for each T.
// because there's only one LLSingleton for each T.
Data
*
aptr
=
0
,
*
bptr
=
0
;
Pounceable
Data
*
aptr
=
0
,
*
bptr
=
0
;
LLPounceable
<
Data
*
,
LLPounceableStatic
>
a
,
b
;
LLPounceable
<
Pounceable
Data
*
,
LLPounceableStatic
>
a
,
b
;
a
.
callWhenReady
(
boost
::
bind
(
setter
,
&
aptr
,
_1
));
a
.
callWhenReady
(
boost
::
bind
(
setter
,
&
aptr
,
_1
));
b
.
callWhenReady
(
boost
::
bind
(
setter
,
&
bptr
,
_1
));
b
.
callWhenReady
(
boost
::
bind
(
setter
,
&
bptr
,
_1
));
ensure
(
"aptr should be null"
,
!
aptr
);
ensure
(
"aptr should be null"
,
!
aptr
);
ensure
(
"bptr should be null"
,
!
bptr
);
ensure
(
"bptr should be null"
,
!
bptr
);
Data
adata
(
"a"
),
bdata
(
"b"
);
Pounceable
Data
adata
(
"a"
),
bdata
(
"b"
);
a
=
&
adata
;
a
=
&
adata
;
ensure_equals
(
"aptr should be &adata"
,
aptr
,
&
adata
);
ensure_equals
(
"aptr should be &adata"
,
aptr
,
&
adata
);
// but we haven't yet set b
// but we haven't yet set b
...
@@ -149,11 +149,11 @@ namespace tut
...
@@ -149,11 +149,11 @@ namespace tut
// We want LLPounceable<T, TAG> to be drop-in replaceable for a plain
// We want LLPounceable<T, TAG> to be drop-in replaceable for a plain
// T for read constructs. In particular, it should behave like a dumb
// T for read constructs. In particular, it should behave like a dumb
// pointer -- and with zero abstraction cost for such usage.
// pointer -- and with zero abstraction cost for such usage.
Data
*
aptr
=
0
;
Pounceable
Data
*
aptr
=
0
;
Data
a
(
"a"
);
Pounceable
Data
a
(
"a"
);
// should be able to initialize a pounceable (when its constructor
// should be able to initialize a pounceable (when its constructor
// runs)
// runs)
LLPounceable
<
Data
*>
pounceable
(
&
a
);
LLPounceable
<
Pounceable
Data
*>
pounceable
(
&
a
);
// should be able to pass LLPounceable<T> to function accepting T
// should be able to pass LLPounceable<T> to function accepting T
setter
(
&
aptr
,
pounceable
);
setter
(
&
aptr
,
pounceable
);
ensure_equals
(
"aptr should be &a"
,
aptr
,
&
a
);
ensure_equals
(
"aptr should be &a"
,
aptr
,
&
a
);
...
@@ -170,9 +170,9 @@ namespace tut
...
@@ -170,9 +170,9 @@ namespace tut
void
object
::
test
<
5
>
()
void
object
::
test
<
5
>
()
{
{
set_test_name
(
"Multiple callWhenReady() queue items"
);
set_test_name
(
"Multiple callWhenReady() queue items"
);
Data
*
p1
=
0
,
*
p2
=
0
,
*
p3
=
0
;
Pounceable
Data
*
p1
=
0
,
*
p2
=
0
,
*
p3
=
0
;
Data
a
(
"a"
);
Pounceable
Data
a
(
"a"
);
LLPounceable
<
Data
*>
pounceable
;
LLPounceable
<
Pounceable
Data
*>
pounceable
;
// queue up a couple setter() calls for later
// queue up a couple setter() calls for later
pounceable
.
callWhenReady
(
boost
::
bind
(
setter
,
&
p1
,
_1
));
pounceable
.
callWhenReady
(
boost
::
bind
(
setter
,
&
p1
,
_1
));
pounceable
.
callWhenReady
(
boost
::
bind
(
setter
,
&
p2
,
_1
));
pounceable
.
callWhenReady
(
boost
::
bind
(
setter
,
&
p2
,
_1
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment