diff options
| -rw-r--r-- | .github/github_test.sh | 4 | ||||
| -rw-r--r-- | .github/workflows/macos.yml | 6 | ||||
| -rw-r--r-- | .github/workflows/release-macos.yml | 2 | ||||
| -rw-r--r-- | external/stb/stb_image_write.h | 2 | ||||
| -rw-r--r-- | github_macos_build.sh | 1 | ||||
| -rw-r--r-- | source/compiler-core/slang-perfect-hash.cpp | 6 | ||||
| -rw-r--r-- | source/slang/glsl.meta.slang | 1 | ||||
| -rw-r--r-- | source/slang/slang-emit-metal.cpp | 1 | ||||
| -rw-r--r-- | source/slang/slang-emit-source-writer.cpp | 16 | ||||
| -rw-r--r-- | source/slang/slang-ir-glsl-legalize.cpp | 4 | ||||
| -rw-r--r-- | source/slang/slang-parser.cpp | 2 | ||||
| -rw-r--r-- | tools/slang-spirv-embed-generator/spirv-embed-generator-main.cpp | 4 |
12 files changed, 23 insertions, 26 deletions
diff --git a/.github/github_test.sh b/.github/github_test.sh index ec6586114..5e75296fb 100644 --- a/.github/github_test.sh +++ b/.github/github_test.sh @@ -18,6 +18,10 @@ if [ "${ARCHITECTURE}" == "x86_64" ]; then ARCHITECTURE="x64" fi +if [ "${ARCHITECTURE}" == "arm64" ]; then + ARCHITECTURE="aarch64" +fi + # CONFIGURATION=release or debug if [ "${CC}" == "gcc" ] && [ "${CONFIGURATION}" == "release" ] && [ "${ARCHITECTURE}" == "x64" ] then diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 30a3fe003..7bb5b9651 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -17,8 +17,8 @@ jobs: matrix: configuration: ['release'] # 'debug' compiler: ['clang'] - platform: ['x64'] - targetPlatform: ['x64'] + platform: ['aarch64'] + targetPlatform: ['aarch64'] steps: - uses: actions/checkout@v3 with: @@ -64,7 +64,7 @@ jobs: path: | ${{ steps.package.outputs.SLANG_BINARY_ARCHIVE }} - name: test - if: ${{ matrix.targetPlatform != 'aarch64' }} + if: ${{ matrix.targetPlatform != 'x64' }} run: CONFIGURATION=${{matrix.configuration}} CC=${{matrix.compiler}} diff --git a/.github/workflows/release-macos.yml b/.github/workflows/release-macos.yml index bd3751e81..6bae8773a 100644 --- a/.github/workflows/release-macos.yml +++ b/.github/workflows/release-macos.yml @@ -14,7 +14,7 @@ jobs: matrix: configuration: ['release'] # 'debug' compiler: ['clang'] - platform: ['x64'] + platform: ['aarch64'] targetPlatform: ['x64', 'aarch64'] steps: - name: Checkout code diff --git a/external/stb/stb_image_write.h b/external/stb/stb_image_write.h index e4b32ed1b..151eacaac 100644 --- a/external/stb/stb_image_write.h +++ b/external/stb/stb_image_write.h @@ -773,7 +773,7 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f #ifdef __STDC_LIB_EXT1__ len = sprintf_s(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); #else - len = sprintf(buffer, "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); + len = snprintf(buffer, sizeof(buffer), "EXPOSURE= 1.0000000000000\n\n-Y %d +X %d\n", y, x); #endif s->func(s->context, buffer, len); diff --git a/github_macos_build.sh b/github_macos_build.sh index 9c3dcda25..2c78f8491 100644 --- a/github_macos_build.sh +++ b/github_macos_build.sh @@ -21,7 +21,6 @@ make config=${CONFIGURATION}_${ARCH} -j`sysctl -n hw.ncpu` rm -rf ./bin -ARCH="arm64" # Create the makefile ./premake5 gmake2 --cc=${CC} --enable-xlib=false --enable-embed-stdlib=true --arch=${TARGETARCH} --deps=true --build-glslang=true --no-progress=true --skip-source-generation=true --deploy-slang-llvm=false --deploy-slang-glslang=false make config=${CONFIGURATION}_${TARGETARCH} -j`sysctl -n hw.ncpu` diff --git a/source/compiler-core/slang-perfect-hash.cpp b/source/compiler-core/slang-perfect-hash.cpp index d5c4902ed..a741f013c 100644 --- a/source/compiler-core/slang-perfect-hash.cpp +++ b/source/compiler-core/slang-perfect-hash.cpp @@ -146,7 +146,7 @@ String perfectHashToEmbeddableCpp( w.print("bool %s(const UnownedStringSlice& str, %s& value)\n", String(funcName).getBuffer(), String(valueType).getBuffer()); line("{"); - w.print(" static const unsigned tableSalt[%ld] = {\n", hashParams.saltTable.getCount()); + w.print(" static const unsigned tableSalt[%d] = {\n", (int)hashParams.saltTable.getCount()); w.print(" "); for (Index i = 0; i < hashParams.saltTable.getCount(); ++i) { @@ -170,7 +170,7 @@ String perfectHashToEmbeddableCpp( w.print(" using KV = std::pair<const char*, %s>;\n", String(valueType).getBuffer()); line(""); - w.print(" static const KV words[%ld] =\n", hashParams.destTable.getCount()); + w.print(" static const KV words[%d] =\n", (int)hashParams.destTable.getCount()); line(" {"); for (Index i = 0; i < hashParams.destTable.getCount(); ++i) { @@ -191,7 +191,7 @@ String perfectHashToEmbeddableCpp( line(" UInt32 h = salt;"); line(" for (const char c : str)"); line(" h = (h * 0x01000193) ^ c;"); - w.print(" return h %% %ld;\n", hashParams.saltTable.getCount()); + w.print(" return h %% %d;\n", (int)hashParams.saltTable.getCount()); line(" };"); line(""); 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; diff --git a/tools/slang-spirv-embed-generator/spirv-embed-generator-main.cpp b/tools/slang-spirv-embed-generator/spirv-embed-generator-main.cpp index 2c07aa27f..e2f464712 100644 --- a/tools/slang-spirv-embed-generator/spirv-embed-generator-main.cpp +++ b/tools/slang-spirv-embed-generator/spirv-embed-generator-main.cpp @@ -353,9 +353,9 @@ void writeInfo( line("static bool lookupQualifiedEnum(const QualifiedEnumName& k, SpvWord& v)"); line("{"); line(" static_assert(sizeof(k.kind.index) == 1);"); - w.print(" if(k.name.getLength() > %ld)\n", maxNameLength); + w.print(" if(k.name.getLength() > %d)\n", (int)maxNameLength); line(" return false;"); - w.print(" char name[%ld];\n", maxNameLength + 2); + w.print(" char name[%d];\n", (int)maxNameLength + 2); line(" name[0] = char((k.kind.index >> 4) + 'a');"); line(" name[1] = char((k.kind.index & 0xf) + 'a');"); line(" memcpy(name+2, k.name.begin(), k.name.getLength());"); |
