From f1245b46502ed674951d90f45b39c2157c0dc4cf Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Thu, 19 Sep 2024 15:20:45 +0300 Subject: [PATCH] Compile fixes for WASM - class members redeclared errors - << with StringBuilder and unsigned long is ambiguous This helps to address issue #5115. --- source/core/slang-io.cpp | 4 +++- source/slang/slang-ast-dump.cpp | 4 ---- source/slang/slang-parameter-binding.cpp | 2 +- source/slang/slang-workspace-version.cpp | 9 --------- source/slang/slang-workspace-version.h | 2 -- 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index dd390fc285..9280262672 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -20,7 +20,8 @@ # include #endif -#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY +#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY || SLANG_WASM +# include # include // For Path::find # include @@ -1012,6 +1013,7 @@ namespace Slang } return SLANG_FAIL; #else + SLANG_UNUSED(outPath); return SLANG_E_NOT_IMPLEMENTED; #endif } diff --git a/source/slang/slang-ast-dump.cpp b/source/slang/slang-ast-dump.cpp index a1ab7a5c8f..65074fa4e5 100644 --- a/source/slang/slang-ast-dump.cpp +++ b/source/slang/slang-ast-dump.cpp @@ -303,10 +303,6 @@ struct ASTDumpContext } void dump(uint32_t v) - { - m_writer->emit(UInt(v)); - } - void dump(UInt v) { m_writer->emit(v); } diff --git a/source/slang/slang-parameter-binding.cpp b/source/slang/slang-parameter-binding.cpp index 115ccc55ee..ea22cbcba0 100644 --- a/source/slang/slang-parameter-binding.cpp +++ b/source/slang/slang-parameter-binding.cpp @@ -3748,7 +3748,7 @@ static void _appendRange(Index start, LayoutSize size, StringBuilder& ioBuf) ioBuf << "[ " << start << " ... "; if (size.isFinite()) { - ioBuf << start + size.getFiniteValue() << ")"; + ioBuf << start + (Index)size.getFiniteValue() << ")"; } else { diff --git a/source/slang/slang-workspace-version.cpp b/source/slang/slang-workspace-version.cpp index d857243288..09d5bbaa25 100644 --- a/source/slang/slang-workspace-version.cpp +++ b/source/slang/slang-workspace-version.cpp @@ -471,15 +471,6 @@ void DocumentVersion::oneBasedUTF8LocToZeroBasedUTF16Loc( outCol = std::lower_bound(bounds.begin(), bounds.end(), inCol - 1) - bounds.begin(); } -void DocumentVersion::oneBasedUTF8LocToZeroBasedUTF16Loc( - Index inLine, Index inCol, int& outLine, int& outCol) -{ - Index ioutLine, ioutCol; - oneBasedUTF8LocToZeroBasedUTF16Loc(inLine, inCol, ioutLine, ioutCol); - outLine = (int)ioutLine; - outCol = (int)ioutCol; -} - void DocumentVersion::zeroBasedUTF16LocToOneBasedUTF8Loc( Index inLine, Index inCol, Index& outLine, Index& outCol) { diff --git a/source/slang/slang-workspace-version.h b/source/slang/slang-workspace-version.h index d6cbfe6c5b..6a7294fbce 100644 --- a/source/slang/slang-workspace-version.h +++ b/source/slang/slang-workspace-version.h @@ -39,8 +39,6 @@ namespace Slang void oneBasedUTF8LocToZeroBasedUTF16Loc( Index inLine, Index inCol, Index& outLine, Index& outCol); - void oneBasedUTF8LocToZeroBasedUTF16Loc( - Index inLine, Index inCol, int& outLine, int& outCol); void zeroBasedUTF16LocToOneBasedUTF8Loc( Index inLine, Index inCol, Index& outLine, Index& outCol);