Skip to content

Commit

Permalink
Disable cpp modules again because VS2019 broke them again with ICEs. …
Browse files Browse the repository at this point in the history
…Fix some other build issues.
  • Loading branch information
fdwr committed Feb 12, 2021
1 parent 5e678bb commit dc0191a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
6 changes: 4 additions & 2 deletions Attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ interface IAttributeSource
//{
// return HRESULT_FROM_WIN32(ERROR_UNMAPPED_SUBSTITUTION_STRING);
//}
values.reset(byteValues.reinterpret_as<T>());
auto a = byteValues.reinterpret_as<T>();
values.reset(a);
return S_OK;
}

Expand All @@ -329,7 +330,8 @@ interface IAttributeSource

if (SUCCEEDED(GetValueData(id, OUT actualType, OUT byteValues)))
{
values.reset(byteValues.reinterpret_as<T>());
auto a = byteValues.reinterpret_as<T>();
values.reset(a);
}
// // todo::: restore once you figure out enums! || !Attribute::AreCompatibleTypes(desiredType, actualType))
//if (!Attribute::AreCompatibleTypes(desiredType, actualType))
Expand Down
6 changes: 3 additions & 3 deletions Attributes.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ char16_t const* Attribute::GetPredefinedValue(uint32_t valueIndex, GetPredefined
}
else
{
auto& newBuffer = std::to_wstring(predefinedValue.integerValue);
auto newBuffer = std::to_wstring(predefinedValue.integerValue);
auto& recastBuffer = reinterpret_cast<std::u16string&>(newBuffer);
buffer = recastBuffer;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ HRESULT Attribute::ParseString(
{
HRESULT hr = HRESULT_FROM_WIN32(ERROR_UNMAPPED_SUBSTITUTION_STRING);

if (stringValue == '\0')
if (stringValue == nullptr)
return hr;

static_assert(Attribute::TypeTotal == 13, "Update this switch statement.");
Expand Down Expand Up @@ -253,7 +253,7 @@ HRESULT Attribute::MapValueToName(_Out_ uint32_t enumValue, _Out_ std::u16string

// Otherwise look for a numeric value, confirming that numeric value is
// actually in the enumeration set.
auto& newString = std::to_wstring(enumValue);
auto newString = std::to_wstring(enumValue);
auto& recastString = reinterpret_cast<std::u16string&>(newString);
std::swap(stringValue, recastString);

Expand Down
3 changes: 2 additions & 1 deletion Common.FastVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
#pragma warning(push)
#pragma warning(disable:4127) // Conditional expression is constant. VS can't tell that certain compound conditionals of template parameters aren't always constant when the tempalate parameter is true.

#if defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0
// Disable for Visual Studio 2019
#if 0 // defined(_ITERATOR_DEBUG_LEVEL) && _ITERATOR_DEBUG_LEVEL > 0
// For std::uninitialized_copy and std::uninitialized_move.
#define FASTVECTOR_MAKE_UNCHECKED stdext::make_unchecked_array_iterator
#else
Expand Down
12 changes: 9 additions & 3 deletions DrawableObject.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,11 @@ HRESULT DrawableObjectGdiTextOut::Draw(

if (!glyphs.empty() || !attributeSource.GetString(DrawableObjectAttributeGlyphs).empty())
{
text.reset(glyphs.reinterpret_as<char16_t const>());
// Assign to a temporary to work around bogus error.
// message : A non-const reference may only be bound to an lvalue
// There's utterly no reason why you shouldn't be able to pass a temporary as mutable in the language. -_-
auto a = glyphs.reinterpret_as<char16_t const>();
text.reset(a);
textOutFlags |= ETO_GLYPH_INDEX;
// todo::: Pass glyph advances if non-empty. ETO_PDY
}
Expand Down Expand Up @@ -2089,7 +2093,8 @@ HRESULT CachedDWriteGlyphRun::Update(
// leaving the others as zeroes.
if (glyphOffsetFloats.size() >= glyphs.size() * 2U)
{
glyphOffsets.reset(glyphOffsetFloats.reinterpret_as<DWRITE_GLYPH_OFFSET const>());
auto a = glyphOffsetFloats.reinterpret_as<DWRITE_GLYPH_OFFSET const>();
glyphOffsets.reset(a);
}
else
{
Expand Down Expand Up @@ -3370,7 +3375,8 @@ HRESULT DrawableObjectGdiPlusDrawDriverString::Draw(
if (glyphs.empty() && attributeSource.GetString(DrawableObjectAttributeGlyphs).empty())
{
drawDriverStringFlags |= Gdiplus::DriverStringOptionsCmapLookup;
glyphs.reset(text.reinterpret_as<uint16_t const>());
auto a = text.reinterpret_as<uint16_t const>();
glyphs.reset(a);
// todo::: Convert and pass glyph advances if non-empty.
}

Expand Down
4 changes: 2 additions & 2 deletions MainWindow.ixx
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ INT_PTR MainWindow::InitializeMainDialog()
// but they also ignore the Edit_SetCueBannerText call, meaning we can't
// just call GetCueBannerText in the subclassed function. So store it as
// a window property instead.
SetProp(attributeValuesEdit, L"CueBannerText", L"<no attributes selected>");
SetProp(attributeValuesEdit, L"CueBannerText", const_cast<wchar_t*>(L"<no attributes selected>"));

auto attributesEdit = GetWindowFromId(hwnd_, IdcAttributesFilterEdit);
Edit_SetCueBannerText(attributesEdit, L"<type attribute filter here>");
Expand Down Expand Up @@ -1100,7 +1100,7 @@ void MainWindow::InitializeDefaultDrawableObjects()
////////////////////
// Initialize with typical APIs.

char16_t* const functionNames[] = {
char16_t const* const functionNames[] = {
u"D2D DrawTextLayout",
u"IDWriteBitmapRenderTarget IDWriteTextLayout",
u"User32 DrawText",
Expand Down
10 changes: 5 additions & 5 deletions TextLayoutSampler.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</UndefinePreprocessorDefinitions>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precomp.h</PrecompiledHeaderFile>
<AdditionalOptions>/module:search $(IntDir)</AdditionalOptions>
<AdditionalOptions>/ifcSearchDir $(IntDir)</AdditionalOptions>
<AdditionalIncludeDirectories>
</AdditionalIncludeDirectories>
<DisableSpecificWarnings>
Expand All @@ -73,7 +73,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;USE_CPP_MODULES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;USE_CPP_MODULES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<UndefinePreprocessorDefinitions>
Expand All @@ -89,7 +89,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PreprocessorDefinitions>_DEBUG;USE_CPP_MODULES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;USE_CPP_MODULES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<Optimization>Disabled</Optimization>
<UndefinePreprocessorDefinitions>
Expand All @@ -103,7 +103,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;USE_CPP_MODULES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;USE_CPP_MODULES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
Expand All @@ -125,7 +125,7 @@
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PreprocessorDefinitions>NDEBUG;USE_CPP_MODULES=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;USE_CPP_MODULES=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<UndefinePreprocessorDefinitions>
</UndefinePreprocessorDefinitions>
Expand Down

0 comments on commit dc0191a

Please sign in to comment.