diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-04-17 02:34:39 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-17 09:34:39 +0000 |
| commit | 04db5a95657a8c1ad1db36570eadaeedbea01cbb (patch) | |
| tree | 4d61bd130c86a0d60c55bf1fa14e79b6fce8dcd7 /source | |
| parent | 297417c754961d2c1c3f8a2e94126c668e4574bc (diff) | |
Fix compiler warning with clang 18.1.8 on windows (#6843)
* Fix compiler warning with clang 18.1.8 on windows
Diffstat (limited to 'source')
| -rw-r--r-- | source/compiler-core/slang-glslang-compiler.cpp | 2 | ||||
| -rw-r--r-- | source/core/slang-castable.h | 5 | ||||
| -rw-r--r-- | source/core/slang-io.cpp | 6 | ||||
| -rw-r--r-- | source/core/slang-stream.cpp | 3 | ||||
| -rw-r--r-- | source/slang/slang-compiler.h | 6 | ||||
| -rw-r--r-- | source/slang/slang-parser.cpp | 2 |
6 files changed, 13 insertions, 11 deletions
diff --git a/source/compiler-core/slang-glslang-compiler.cpp b/source/compiler-core/slang-glslang-compiler.cpp index 27a24512d..4fbeff716 100644 --- a/source/compiler-core/slang-glslang-compiler.cpp +++ b/source/compiler-core/slang-glslang-compiler.cpp @@ -53,7 +53,7 @@ public: const uint32_t* contents, int contentsSize, String& outString) SLANG_OVERRIDE; - int link( + virtual SLANG_NO_THROW int SLANG_MCALL link( const uint32_t** modules, const uint32_t* moduleSizes, const uint32_t moduleCount, diff --git a/source/core/slang-castable.h b/source/core/slang-castable.h index 50b41766a..e3591577d 100644 --- a/source/core/slang-castable.h +++ b/source/core/slang-castable.h @@ -77,7 +77,10 @@ public: // IBoxValue virtual SLANG_NO_THROW void* SLANG_MCALL getValuePtr() SLANG_OVERRIDE { return &m_value; } - virtual SlangUUID SLANG_MCALL getValueTypeGuid() SLANG_OVERRIDE { return T::getTypeGuid(); } + virtual SLANG_NO_THROW SlangUUID SLANG_MCALL getValueTypeGuid() SLANG_OVERRIDE + { + return T::getTypeGuid(); + } BoxValue() {} diff --git a/source/core/slang-io.cpp b/source/core/slang-io.cpp index 3c0c9a11e..5490294ca 100644 --- a/source/core/slang-io.cpp +++ b/source/core/slang-io.cpp @@ -1331,7 +1331,7 @@ SlangResult LockFile::tryLock(LockType lockType) SlangResult result = SLANG_OK; #if SLANG_WINDOWS_FAMILY - OVERLAPPED overlapped = {0}; + OVERLAPPED overlapped = {}; DWORD flags = lockType == LockType::Shared ? LOCKFILE_FAIL_IMMEDIATELY : (LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY); @@ -1356,7 +1356,7 @@ SlangResult LockFile::lock(LockType lockType) SlangResult result = SLANG_OK; #if SLANG_WINDOWS_FAMILY - OVERLAPPED overlapped = {0}; + OVERLAPPED overlapped = {}; overlapped.hEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); DWORD flags = lockType == LockType::Shared ? 0 : LOCKFILE_EXCLUSIVE_LOCK; if (::LockFileEx(m_fileHandle, flags, DWORD(0), ~DWORD(0), ~DWORD(0), &overlapped) == 0) @@ -1392,7 +1392,7 @@ SlangResult LockFile::unlock() return SLANG_E_CANNOT_OPEN; #if SLANG_WINDOWS_FAMILY - OVERLAPPED overlapped = {0}; + OVERLAPPED overlapped = {}; if (::UnlockFileEx(m_fileHandle, DWORD(0), ~DWORD(0), ~DWORD(0), &overlapped) == 0) { return SLANG_E_INTERNAL_FAIL; diff --git a/source/core/slang-stream.cpp b/source/core/slang-stream.cpp index 1b8468c04..07c7e858c 100644 --- a/source/core/slang-stream.cpp +++ b/source/core/slang-stream.cpp @@ -163,8 +163,7 @@ SlangResult FileStream::_init( return SLANG_FAIL; } if (share == FileShare::None) -#pragma warning(suppress : 4996) - m_handle = _wfopen(fileName.toWString(), wideMode); + _wfopen_s(&m_handle, fileName.toWString(), wideMode); else m_handle = _wfsopen(fileName.toWString(), wideMode, shFlag); #else diff --git a/source/slang/slang-compiler.h b/source/slang/slang-compiler.h index 8a9b8985a..26a4bb43b 100644 --- a/source/slang/slang-compiler.h +++ b/source/slang/slang-compiler.h @@ -1520,12 +1520,12 @@ public: return SLANG_OK; } - virtual SlangInt32 SLANG_MCALL getDefinedEntryPointCount() override + virtual SLANG_NO_THROW SlangInt32 SLANG_MCALL getDefinedEntryPointCount() override { return (SlangInt32)m_entryPoints.getCount(); } - virtual SlangResult SLANG_MCALL + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getDefinedEntryPoint(SlangInt32 index, slang::IEntryPoint** outEntryPoint) override { if (index < 0 || index >= m_entryPoints.getCount()) @@ -1625,7 +1625,7 @@ public: virtual void buildHash(DigestBuilder<SHA1>& builder) SLANG_OVERRIDE; - virtual slang::DeclReflection* SLANG_MCALL getModuleReflection() SLANG_OVERRIDE; + virtual SLANG_NO_THROW slang::DeclReflection* SLANG_MCALL getModuleReflection() SLANG_OVERRIDE; void setDigest(SHA1::Digest const& digest) { m_digest = digest; } SHA1::Digest computeDigest(); diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp index b7828999a..00f15cbb3 100644 --- a/source/slang/slang-parser.cpp +++ b/source/slang/slang-parser.cpp @@ -8098,7 +8098,7 @@ static std::optional<SPIRVAsmInst> parseSPIRVAsmInst(Parser* parser) } if (ret.opcode.flavor == SPIRVAsmOperand::Flavor::NamedValue && - ret.opcode.knownValue == SpvOp(0xffffffff)) + ret.opcode.knownValue == (SpvWord)(SpvOp(0xffffffff))) { if (ret.opcode.token.type == TokenType::IntegerLiteral) { |
