summaryrefslogtreecommitdiffstats
path: root/source/slang
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang')
-rw-r--r--source/slang/glsl.meta.slang1
-rw-r--r--source/slang/slang-emit-metal.cpp1
-rw-r--r--source/slang/slang-emit-source-writer.cpp16
-rw-r--r--source/slang/slang-ir-glsl-legalize.cpp4
-rw-r--r--source/slang/slang-parser.cpp2
5 files changed, 9 insertions, 15 deletions
diff --git a/source/slang/glsl.meta.slang b/source/slang/glsl.meta.slang
index d04dfe8b9..79f5bfdb8 100644
--- a/source/slang/glsl.meta.slang
+++ b/source/slang/glsl.meta.slang
@@ -3236,7 +3236,6 @@ ${{{{
StringBuilder SPV_DEFAULT_SAMPLE_VAR_IF_MISSINGBuilder;
SPV_PREFIX_IMAGE_PARAMSBuilder << "$image $P";
- SPV_SUFFIX_IMAGE_PARAMSBuilder;
if (targetShape.isMS)
{
SPV_SUFFIX_IMAGE_PARAMSBuilder << " Sample $sample";
diff --git a/source/slang/slang-emit-metal.cpp b/source/slang/slang-emit-metal.cpp
index bf4a67b09..459104ac9 100644
--- a/source/slang/slang-emit-metal.cpp
+++ b/source/slang/slang-emit-metal.cpp
@@ -160,7 +160,6 @@ void MetalSourceEmitter::emitParameterGroupImpl(IRGlobalParam* varDecl, IRUnifor
void MetalSourceEmitter::emitEntryPointAttributesImpl(IRFunc* irFunc, IREntryPointDecoration* entryPointDecor)
{
- auto profile = m_effectiveProfile;
auto stage = entryPointDecor->getProfile().getStage();
switch (stage)
diff --git a/source/slang/slang-emit-source-writer.cpp b/source/slang/slang-emit-source-writer.cpp
index d8364d5c3..ddce0ab89 100644
--- a/source/slang/slang-emit-source-writer.cpp
+++ b/source/slang/slang-emit-source-writer.cpp
@@ -3,10 +3,6 @@
#include "../core/slang-char-encode.h"
-// Disable warnings about sprintf
-#ifdef _WIN32
-# pragma warning(disable:4996)
-#endif
// Note: using C++ stdio just to get a locale-independent
// way to format floating-point values.
@@ -199,28 +195,28 @@ void SourceWriter::emitInt64(int64_t value)
void SourceWriter::emit(Int32 value)
{
char buffer[16];
- sprintf(buffer, "%" PRId32, value);
+ snprintf(buffer, sizeof(buffer), "%" PRId32, value);
emit(buffer);
}
void SourceWriter::emit(Int64 value)
{
char buffer[32];
- sprintf(buffer, "%" PRId64, value);
+ snprintf(buffer, sizeof(buffer), "%" PRId64, value);
emit(buffer);
}
void SourceWriter::emit(UInt32 value)
{
char buffer[32];
- sprintf(buffer, "%" PRIu32, value);
+ snprintf(buffer, sizeof(buffer), "%" PRIu32, value);
emit(buffer);
}
void SourceWriter::emit(UInt64 value)
{
char buffer[32];
- sprintf(buffer, "%" PRIu64, value);
+ snprintf(buffer, sizeof(buffer), "%" PRIu64, value);
emit(buffer);
}
@@ -463,7 +459,7 @@ void SourceWriter::_emitLineDirective(const HumaneSourceLoc& sourceLocation)
emitRawText("\n#line ");
char buffer[16];
- sprintf(buffer, "%llu", (unsigned long long)sourceLocation.line);
+ snprintf(buffer, sizeof(buffer), "%llu", (unsigned long long)sourceLocation.line);
emitRawText(buffer);
// Only emit the path part of a `#line` directive if needed
@@ -497,7 +493,7 @@ void SourceWriter::_emitLineDirective(const HumaneSourceLoc& sourceLocation)
m_mapGLSLSourcePathToID.add(path, id);
}
- sprintf(buffer, "%d", id);
+ snprintf(buffer, sizeof(buffer), "%d", id);
emitRawText(buffer);
break;
}
diff --git a/source/slang/slang-ir-glsl-legalize.cpp b/source/slang/slang-ir-glsl-legalize.cpp
index b741e7ffa..54af7a746 100644
--- a/source/slang/slang-ir-glsl-legalize.cpp
+++ b/source/slang/slang-ir-glsl-legalize.cpp
@@ -2795,7 +2795,7 @@ void getAllNullLocationRayObjectsAndUsedLocations(
for (auto inst : module->getGlobalInsts())
{
auto instOp = inst->getOp();
- IRIntegerValue intLitVal = NULL;
+ IRIntegerValue intLitVal = 0;
if (instOp != kIROp_GlobalParam && instOp != kIROp_GlobalVar) continue;
for (auto decor : inst->getDecorations())
{
@@ -2839,7 +2839,7 @@ void assignRayPayloadHitObjectAttributeLocations(IRModule* module)
for (auto inst : nullRayObjects)
{
IRInst* location = nullptr;
- IRIntegerValue intLitVal = NULL;
+ IRIntegerValue intLitVal = 0;
for (auto decor : inst->getDecorations())
{
switch (decor->getOp())
diff --git a/source/slang/slang-parser.cpp b/source/slang/slang-parser.cpp
index 9e0a94cae..e0b964a45 100644
--- a/source/slang/slang-parser.cpp
+++ b/source/slang/slang-parser.cpp
@@ -5453,7 +5453,7 @@ namespace Slang
bool lookAheadTokenAfterModifiers(Parser* parser, const char* token)
{
TokenReader tokenPreview = parser->tokenReader;
- for (Index i = 0;; i++)
+ for (;;)
{
if (tokenPreview.peekToken().getContent() == token)
return true;