Skip to content

Commit 3d2b313

Browse files
committed
Fixed natvis and increased version to 1.5.2.
The sentinel for 64 bit pointers got changed in 402ac93. I forgot to adapt the sentinel in natvis.
1 parent b546e3e commit 3d2b313

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
22

33
project(
44
tiny-optional
5-
VERSION 1.5.1
5+
VERSION 1.5.2
66
DESCRIPTION "Replacement for std::optional that does not waste memory unnecessarily."
77
HOMEPAGE_URL "https://github.com/Sedeniono/tiny-optional"
88
LANGUAGES CXX

include/tiny/optional.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ Original repository: https://github.com/Sedeniono/tiny-optional
5454
// So the format is: MmmmPP, where 'M'=major, 'm'=minor and 'P'=patch.
5555
// E.g. TINY_OPTIONAL_VERSION 100301
5656
//
57-
#define TINY_OPTIONAL_VERSION_MAJOR_MINOR 1005 // If you change this, adapt Natvis, too!
58-
#define TINY_OPTIONAL_VERSION_PATCH 1
57+
#define TINY_OPTIONAL_VERSION_MAJOR_MINOR 1005 // If you change this, adapt Natvis and CMakeLists.txt, too!
58+
#define TINY_OPTIONAL_VERSION_PATCH 2 // If you change this, adapt CMakeLists.txt, too!
5959
#define TINY_OPTIONAL_VERSION (TINY_OPTIONAL_VERSION_MAJOR_MINOR * 100 + TINY_OPTIONAL_VERSION_PATCH)
6060

6161

include/tiny_optional.natvis

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ NOTES:
141141
natvis error debug output is enabled in the options).
142142
So instead this visualizer accepts EVERY tiny::optional_flag_manipulator<T, void>. If T is bool, float or double,
143143
the "overloads" above are used. If T is anything else, this here is used. The trick to check whether T is a pointer
144-
or not is in the definition of the IsEmpty() intrinsic: We do *&mStorage.storage, which is invalid if storage is not
144+
or not is in the definition of the IsEmpty() intrinsic: We do &*mStorage.storage, which is invalid if storage is not
145145
a pointer. Then, the condition "IsEmpty() || !IsEmpty()" is always true for a pointer and undefined for non-pointers.
146146
In case of undefined, the Optional="true" comes into play.
147147
Note: Using pure natvis, it is impossible to properly query the IsEmpty flag. Natvis does not allow to call functions,
@@ -152,7 +152,7 @@ NOTES:
152152
<Intrinsic Name="IsEmpty" Optional="true" Expression="
153153
sizeof(&amp;*mStorage.storage) == 4
154154
? ((unsigned int)(void*)mStorage.storage) == 0xffffffff - 8
155-
: ((unsigned long long)(void*)mStorage.storage) == 0xffff800000000000ull - 1
155+
: ((unsigned long long)(void*)mStorage.storage) == 0x7fffffffffffffffull
156156
"/>
157157
<!--Used for pointers-->
158158
<DisplayString Optional="true" Condition="IsEmpty() || !IsEmpty()">{*this,view(TinyOptionalInplaceStorageView)}</DisplayString>
@@ -176,7 +176,7 @@ NOTES:
176176
<Intrinsic Name="IsEmpty" Optional="true" Expression="
177177
sizeof(&amp;**(FlagType*)(((unsigned char*)&amp;mStorage.storage) + $T2)) == 4
178178
? ((unsigned int)(void*)*(FlagType*)(((unsigned char*)&amp;mStorage.storage) + $T2)) == 0xffffffff - 8
179-
: ((unsigned long long)(void*)*(FlagType*)(((unsigned char*)&amp;mStorage.storage) + $T2)) == 0xffff800000000000ull - 1
179+
: ((unsigned long long)(void*)*(FlagType*)(((unsigned char*)&amp;mStorage.storage) + $T2)) == 0x7fffffffffffffffull
180180
"/>
181181
<!--Used for pointers-->
182182
<DisplayString Optional="true" Condition="IsEmpty() || !IsEmpty()">{*this,view(TinyOptionalInplaceStorageView)}</DisplayString>

tests/NatvisTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ enum class TestEnum : unsigned long long
5252
{
5353
VALUE1,
5454
VALUE2,
55-
INVALID = 0xffff800000000000ull - 1
55+
INVALID = 0x7fff'ffff'ffff'ffffull
5656
};
5757
} // namespace
5858

0 commit comments

Comments
 (0)