Skip to content

Commit

Permalink
Compile fixes for WASM
Browse files Browse the repository at this point in the history
- class members redeclared errors
- << with StringBuilder and unsigned long is ambiguous

This helps to address issue shader-slang#5115.
  • Loading branch information
aleino-nv committed Sep 23, 2024
1 parent 53684ed commit f1245b4
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 17 deletions.
4 changes: 3 additions & 1 deletion source/core/slang-io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
# include <shellapi.h>
#endif

#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY
#if defined(__linux__) || defined(__CYGWIN__) || SLANG_APPLE_FAMILY || SLANG_WASM
# include <fcntl.h>
# include <unistd.h>
// For Path::find
# include <fnmatch.h>
Expand Down Expand Up @@ -1012,6 +1013,7 @@ namespace Slang
}
return SLANG_FAIL;
#else
SLANG_UNUSED(outPath);
return SLANG_E_NOT_IMPLEMENTED;
#endif
}
Expand Down
4 changes: 0 additions & 4 deletions source/slang/slang-ast-dump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,6 @@ struct ASTDumpContext
}

void dump(uint32_t v)
{
m_writer->emit(UInt(v));
}
void dump(UInt v)
{
m_writer->emit(v);
}
Expand Down
2 changes: 1 addition & 1 deletion source/slang/slang-parameter-binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
9 changes: 0 additions & 9 deletions source/slang/slang-workspace-version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 0 additions & 2 deletions source/slang/slang-workspace-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit f1245b4

Please sign in to comment.