diff options
author | John Hodge <tpg@mutabah.net> | 2018-01-14 14:17:07 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2018-01-14 14:43:17 +0800 |
commit | ae34deb892458dbb75ab5492786babf1b3f360a0 (patch) | |
tree | ac625acc1ea540ec000b40f1947927ca9915d0f7 | |
parent | ad9ee752049e9e853adc634df66700dae573f8b8 (diff) | |
download | mrust-ae34deb892458dbb75ab5492786babf1b3f360a0.tar.gz |
MSVC compile fixes
-rw-r--r-- | src/expand/proc_macro.cpp | 1 | ||||
-rw-r--r-- | src/hir_conv/bind.cpp | 2 | ||||
-rw-r--r-- | src/mir/check_full.cpp | 23 | ||||
-rw-r--r-- | tools/minicargo/manifest.cpp | 1 | ||||
-rw-r--r-- | tools/testrunner/main.cpp | 7 | ||||
-rw-r--r-- | vsproject/minicargo/minicargo.vcxproj | 1 | ||||
-rw-r--r-- | vsproject/minicargo/minicargo.vcxproj.filters | 3 |
7 files changed, 13 insertions, 25 deletions
diff --git a/src/expand/proc_macro.cpp b/src/expand/proc_macro.cpp index 2474db5b..3eb0c85d 100644 --- a/src/expand/proc_macro.cpp +++ b/src/expand/proc_macro.cpp @@ -17,6 +17,7 @@ #ifdef _WIN32 # define NOGDI // Don't include GDI functions (defines some macros that collide with mrustc ones) # include <Windows.h> +# undef min #else # include <unistd.h> // read/write/pipe # include <spawn.h> diff --git a/src/hir_conv/bind.cpp b/src/hir_conv/bind.cpp index 11a6ac1c..f8a06013 100644 --- a/src/hir_conv/bind.cpp +++ b/src/hir_conv/bind.cpp @@ -86,7 +86,7 @@ namespace { } fix_type_params(sp, enm.m_params, path.m_params); - return ::std::make_pair( &enm, idx ); + return ::std::make_pair( &enm, static_cast<unsigned>(idx) ); } diff --git a/src/mir/check_full.cpp b/src/mir/check_full.cpp index 2762c4e7..24a4930a 100644 --- a/src/mir/check_full.cpp +++ b/src/mir/check_full.cpp @@ -909,28 +909,6 @@ void MIR_Validate_FullValState(::MIR::TypeResolve& mir_res, const ::MIR::Functio // Box<T> - Wrapper around Unique<T> MIR_ASSERT(mir_res, vs.is_composite(), "Shallow drop on non-composite state - " << se.slot << " (state=" << StateFmt(state,vs) << ")"); const auto& sub_states = state.get_composite(mir_res, vs); -#if 0 - MIR_ASSERT(mir_res, sub_states.size() == 1, "Shallow drop of slot with incorrect state shape (state=" << StateFmt(state,vs) << ")"); - // Unique<T> - NonZero<*const T>, PhantomData<T> - MIR_ASSERT(mir_res, sub_states[0].is_composite(), ""); - const auto& sub_states2 = state.get_composite(mir_res, sub_states[0]); - MIR_ASSERT(mir_res, sub_states2.size() == 2, "- " << StateFmt(state, sub_states[0])); - MIR_ASSERT(mir_res, sub_states2[0].is_composite(), ""); - MIR_ASSERT(mir_res, sub_states2[1].is_valid(), ""); - // `NonZero<*const T>` - *const T - const auto& sub_states3 = state.get_composite(mir_res, sub_states2[0]); - MIR_ASSERT(mir_res, sub_states3.size() == 1, "- " << StateFmt(state, sub_states2[0])); - MIR_ASSERT(mir_res, sub_states3[0].is_composite(), ""); - // `*const T` - Moved out of, so has a composite state - const auto& sub_states4 = state.get_composite(mir_res, sub_states3[0]); - MIR_ASSERT(mir_res, sub_states4.size() == 2, "- " << StateFmt(state, sub_states3[0])); - MIR_ASSERT(mir_res, sub_states4[0].is_valid(), "Shallow drop on deallocated Box - " << se.slot << " (state=" << StateFmt(state,vs) << ")"); - // TODO: This is leak protection, enable it once the rest works - if( ENABLE_LEAK_DETECTOR ) - { - MIR_ASSERT(mir_res, !sub_states4[1].is_valid(), "Shallow drop on populated Box - " << se.slot << " (state=" << StateFmt(state,vs) << ")"); - } -#else MIR_ASSERT(mir_res, sub_states.size() == 2, "Shallow drop of slot with incorrect state shape (state=" << StateFmt(state,vs) << ")"); MIR_ASSERT(mir_res, sub_states[0].is_valid(), "Shallow drop on deallocated Box - " << se.slot << " (state=" << StateFmt(state,vs) << ")"); // TODO: This is leak protection, enable it once the rest works @@ -938,7 +916,6 @@ void MIR_Validate_FullValState(::MIR::TypeResolve& mir_res, const ::MIR::Functio { MIR_ASSERT(mir_res, !sub_states[1].is_valid(), "Shallow drop on populated Box - " << se.slot << " (state=" << StateFmt(state,vs) << ")"); } -#endif state.set_lvalue_state(mir_res, se.slot, State(false)); } diff --git a/tools/minicargo/manifest.cpp b/tools/minicargo/manifest.cpp index fa20cec7..e7228ed7 100644 --- a/tools/minicargo/manifest.cpp +++ b/tools/minicargo/manifest.cpp @@ -6,6 +6,7 @@ #include "path.h" #include <cassert> #include <algorithm> +#include <cctype> // toupper #include "repository.h" diff --git a/tools/testrunner/main.cpp b/tools/testrunner/main.cpp index 1751c8ff..f7e15105 100644 --- a/tools/testrunner/main.cpp +++ b/tools/testrunner/main.cpp @@ -5,6 +5,7 @@ #include <string> #include <vector> #include <fstream> +#include <cctype> // std::isblank #include "../minicargo/debug.h" #include "../minicargo/path.h" #ifdef _WIN32 @@ -216,7 +217,7 @@ int main(int argc, const char* argv[]) continue ; // TODO Parse a skewer-case ident and check against known set? - auto start = (line[2] == ' ' ? 3 : 2); + size_t start = (line[2] == ' ' ? 3 : 2); if( line.substr(start, 10) == "aux-build:" ) { @@ -296,7 +297,11 @@ int main(int argc, const char* argv[]) bool pre_build_failed = false; for(const auto& file : test.m_pre_build) { +#ifdef _WIN32 + CreateDirectoryA(depdir.str().c_str(), NULL); +#else mkdir(depdir.str().c_str(), 0755); +#endif auto infile = input_path / "auxiliary" / file; if( !run_compiler(infile, depdir, {}, depdir, true) ) { diff --git a/vsproject/minicargo/minicargo.vcxproj b/vsproject/minicargo/minicargo.vcxproj index 17b2c269..39418735 100644 --- a/vsproject/minicargo/minicargo.vcxproj +++ b/vsproject/minicargo/minicargo.vcxproj @@ -111,6 +111,7 @@ </ItemDefinitionGroup> <ItemGroup> <ClCompile Include="..\..\tools\minicargo\build.cpp" /> + <ClCompile Include="..\..\tools\minicargo\debug.cpp" /> <ClCompile Include="..\..\tools\minicargo\main.cpp" /> <ClCompile Include="..\..\tools\minicargo\manifest.cpp" /> <ClCompile Include="..\..\tools\minicargo\path.cpp" /> diff --git a/vsproject/minicargo/minicargo.vcxproj.filters b/vsproject/minicargo/minicargo.vcxproj.filters index 2852cb19..c503bbbf 100644 --- a/vsproject/minicargo/minicargo.vcxproj.filters +++ b/vsproject/minicargo/minicargo.vcxproj.filters @@ -33,6 +33,9 @@ <ClCompile Include="..\..\tools\minicargo\path.cpp"> <Filter>Source Files</Filter> </ClCompile> + <ClCompile Include="..\..\tools\minicargo\debug.cpp"> + <Filter>Source Files</Filter> + </ClCompile> </ItemGroup> <ItemGroup> <ClInclude Include="..\..\tools\minicargo\helpers.h"> |