diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-29 14:49:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 14:49:26 +0800 |
| commit | f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch) | |
| tree | ea1d61342cd29368e19135000ec2948813096205 /source/compiler-core/slang-gcc-compiler-util.cpp | |
| parent | a729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff) | |
format
* format
* Minor test fixes
* enable checking cpp format in ci
Diffstat (limited to 'source/compiler-core/slang-gcc-compiler-util.cpp')
| -rw-r--r-- | source/compiler-core/slang-gcc-compiler-util.cpp | 265 |
1 files changed, 156 insertions, 109 deletions
diff --git a/source/compiler-core/slang-gcc-compiler-util.cpp b/source/compiler-core/slang-gcc-compiler-util.cpp index 875f7bea1..67ee6f8b3 100644 --- a/source/compiler-core/slang-gcc-compiler-util.cpp +++ b/source/compiler-core/slang-gcc-compiler-util.cpp @@ -1,19 +1,17 @@ // slang-gcc-compiler-util.cpp #include "slang-gcc-compiler-util.h" +#include "../core/slang-char-util.h" #include "../core/slang-common.h" -#include "slang-com-helper.h" -#include "../core/slang-string-util.h" - #include "../core/slang-io.h" #include "../core/slang-shared-library.h" -#include "../core/slang-char-util.h" #include "../core/slang-string-slice-pool.h" - +#include "../core/slang-string-util.h" #include "slang-artifact-desc-util.h" #include "slang-artifact-diagnostic-util.h" -#include "slang-artifact-util.h" #include "slang-artifact-representation-impl.h" +#include "slang-artifact-util.h" +#include "slang-com-helper.h" namespace Slang { @@ -44,7 +42,10 @@ static Index _findVersionEnd(const UnownedStringSlice& in) return len; } -/* static */SlangResult GCCDownstreamCompilerUtil::parseVersion(const UnownedStringSlice& text, const UnownedStringSlice& prefix, DownstreamCompilerDesc& outDesc) +/* static */ SlangResult GCCDownstreamCompilerUtil::parseVersion( + const UnownedStringSlice& text, + const UnownedStringSlice& prefix, + DownstreamCompilerDesc& outDesc) { List<UnownedStringSlice> lines; StringUtil::calcLines(text, lines); @@ -57,7 +58,8 @@ static Index _findVersionEnd(const UnownedStringSlice& in) continue; } - const UnownedStringSlice remainingSlice = UnownedStringSlice(line.begin() + prefixIndex + prefix.getLength(), line.end()).trim(); + const UnownedStringSlice remainingSlice = + UnownedStringSlice(line.begin() + prefixIndex + prefix.getLength(), line.end()).trim(); const Index versionEndIndex = _findVersionEnd(remainingSlice); if (versionEndIndex < 0) @@ -65,9 +67,11 @@ static Index _findVersionEnd(const UnownedStringSlice& in) return SLANG_FAIL; } - const UnownedStringSlice versionSlice(remainingSlice.begin(), remainingSlice.begin() + versionEndIndex); + const UnownedStringSlice versionSlice( + remainingSlice.begin(), + remainingSlice.begin() + versionEndIndex); - // Version is in format 0.0.0 + // Version is in format 0.0.0 List<UnownedStringSlice> split; StringUtil::split(versionSlice, '.', split); List<Int> digits; @@ -91,7 +95,9 @@ static Index _findVersionEnd(const UnownedStringSlice& in) return SLANG_FAIL; } -SlangResult GCCDownstreamCompilerUtil::calcVersion(const ExecutableLocation& exe, DownstreamCompilerDesc& outDesc) +SlangResult GCCDownstreamCompilerUtil::calcVersion( + const ExecutableLocation& exe, + DownstreamCompilerDesc& outDesc) { CommandLine cmdLine; cmdLine.setExecutableLocation(exe); @@ -102,16 +108,14 @@ SlangResult GCCDownstreamCompilerUtil::calcVersion(const ExecutableLocation& exe // Note we now have builds that add other words in front of the version // such as "Ubuntu clang version" - const UnownedStringSlice prefixes[] = - { + const UnownedStringSlice prefixes[] = { UnownedStringSlice::fromLiteral("clang version"), UnownedStringSlice::fromLiteral("gcc version"), UnownedStringSlice::fromLiteral("Apple LLVM version"), UnownedStringSlice::fromLiteral("Apple metal version"), }; - const SlangPassThrough types[] = - { + const SlangPassThrough types[] = { SLANG_PASS_THROUGH_CLANG, SLANG_PASS_THROUGH_GCC, SLANG_PASS_THROUGH_CLANG, @@ -125,7 +129,8 @@ SlangResult GCCDownstreamCompilerUtil::calcVersion(const ExecutableLocation& exe // Set the type outDesc.type = types[i]; // Extract the version - if (SLANG_SUCCEEDED(parseVersion(exeRes.standardError.getUnownedSlice(), prefixes[i], outDesc))) + if (SLANG_SUCCEEDED( + parseVersion(exeRes.standardError.getUnownedSlice(), prefixes[i], outDesc))) { return SLANG_OK; } @@ -134,7 +139,9 @@ SlangResult GCCDownstreamCompilerUtil::calcVersion(const ExecutableLocation& exe return SLANG_FAIL; } -static SlangResult _parseSeverity(const UnownedStringSlice& in, ArtifactDiagnostic::Severity& outSeverity) +static SlangResult _parseSeverity( + const UnownedStringSlice& in, + ArtifactDiagnostic::Severity& outSeverity) { typedef ArtifactDiagnostic::Severity Severity; @@ -157,28 +164,33 @@ static SlangResult _parseSeverity(const UnownedStringSlice& in, ArtifactDiagnost return SLANG_OK; } -namespace { // anonymous +namespace +{ // anonymous enum class LineParseResult { - Single, ///< It's a single line - Start, ///< Line was the start of a message - Continuation, ///< Not totally clear, add to previous line if nothing else hit - Ignore, ///< Ignore the line + Single, ///< It's a single line + Start, ///< Line was the start of a message + Continuation, ///< Not totally clear, add to previous line if nothing else hit + Ignore, ///< Ignore the line }; - -} // anonymous - -static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedStringSlice& line, LineParseResult& outLineParseResult, ArtifactDiagnostic& outDiagnostic) + +} // namespace + +static SlangResult _parseGCCFamilyLine( + SliceAllocator& allocator, + const UnownedStringSlice& line, + LineParseResult& outLineParseResult, + ArtifactDiagnostic& outDiagnostic) { typedef ArtifactDiagnostic Diagnostic; typedef Diagnostic::Severity Severity; - + // Set to default case outLineParseResult = LineParseResult::Ignore; /* example error output from different scenarios */ - + /* tests/cpp-compiler/c-compile-error.c: In function 'int main(int, char**)': tests/cpp-compiler/c-compile-error.c:8:13: error: 'b' was not declared in this scope @@ -189,25 +201,26 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS ^ */ - /* /tmp/ccS0JCWe.o:c-compile-link-error.c:(.rdata$.refptr.thing[.refptr.thing]+0x0): undefined reference to `thing' - collect2: error: ld returned 1 exit status*/ + /* /tmp/ccS0JCWe.o:c-compile-link-error.c:(.rdata$.refptr.thing[.refptr.thing]+0x0): undefined + reference to `thing' collect2: error: ld returned 1 exit status*/ /* - clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated] - Undefined symbols for architecture x86_64: + clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated + [-Wdeprecated] Undefined symbols for architecture x86_64: "_thing", referenced from: _main in c-compile-link-error-a83ace.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) */ - /* /tmp/c-compile-link-error-ccf151.o: In function `main': - c-compile-link-error.c:(.text+0x19): undefined reference to `thing' - clang: error: linker command failed with exit code 1 (use -v to see invocation) - */ + /* /tmp/c-compile-link-error-ccf151.o: In function `main': + c-compile-link-error.c:(.text+0x19): undefined reference to `thing' + clang: error: linker command failed with exit code 1 (use -v to see invocation) + */ - /* /tmp/c-compile-link-error-301c8c.o: In function `main': - /home/travis/build/shader-slang/slang/tests/cpp-compiler/c-compile-link-error.c:10: undefined reference to `thing' - clang-7: error: linker command failed with exit code 1 (use -v to see invocation)*/ + /* /tmp/c-compile-link-error-301c8c.o: In function `main': + /home/travis/build/shader-slang/slang/tests/cpp-compiler/c-compile-link-error.c:10: undefined + reference to `thing' clang-7: error: linker command failed with exit code 1 (use -v to see + invocation)*/ /* /path/slang-cpp-prelude.h:4:10: fatal error: ../slang.h: No such file or directory #include "slang.h" @@ -221,7 +234,8 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS List<UnownedStringSlice> split; StringUtil::split(line, ':', split); - // On windows we can have paths that are a: etc... if we detect this we can combine 0 - 1 to be 1. + // On windows we can have paths that are a: etc... if we detect this we can combine 0 - 1 to + // be 1. if (split.getCount() > 1 && split[0].getLength() == 1) { const char c = split[0][0]; @@ -328,7 +342,7 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS outDiagnostic.severity = Diagnostic::Severity::Error; outDiagnostic.stage = Diagnostic::Stage::Link; outDiagnostic.text = allocator.allocate(split[3]); - + outLineParseResult = LineParseResult::Start; return SLANG_OK; } @@ -353,55 +367,60 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -/* static */SlangResult GCCDownstreamCompilerUtil::parseOutput(const ExecuteResult& exeRes, IArtifactDiagnostics* diagnostics) +/* static */ SlangResult GCCDownstreamCompilerUtil::parseOutput( + const ExecuteResult& exeRes, + IArtifactDiagnostics* diagnostics) { LineParseResult prevLineResult = LineParseResult::Ignore; - + SliceAllocator allocator; diagnostics->reset(); diagnostics->setRaw(SliceUtil::asCharSlice(exeRes.standardError)); - // We hold in workDiagnostics so as it is more convenient to append to the last with a continuation - // also means we don't hold the allocations of building up continuations, just the results when finally allocated at the end + // We hold in workDiagnostics so as it is more convenient to append to the last with a + // continuation also means we don't hold the allocations of building up continuations, just the + // results when finally allocated at the end List<ArtifactDiagnostic> workDiagnostics; for (auto line : LineParser(exeRes.standardError.getUnownedSlice())) { ArtifactDiagnostic diagnostic; - + LineParseResult lineRes; - + SLANG_RETURN_ON_FAIL(_parseGCCFamilyLine(allocator, line, lineRes, diagnostic)); - + switch (lineRes) { - case LineParseResult::Start: + case LineParseResult::Start: { // It's start of a new message workDiagnostics.add(diagnostic); prevLineResult = LineParseResult::Start; break; } - case LineParseResult::Single: + case LineParseResult::Single: { // It's a single message, without anything following workDiagnostics.add(diagnostic); prevLineResult = LineParseResult::Ignore; break; } - case LineParseResult::Continuation: + case LineParseResult::Continuation: { - if (prevLineResult == LineParseResult::Start || prevLineResult == LineParseResult::Continuation) + if (prevLineResult == LineParseResult::Start || + prevLineResult == LineParseResult::Continuation) { if (workDiagnostics.getCount() > 0) { auto& last = workDiagnostics.getLast(); - // TODO(JS): Note that this is somewhat wasteful as every time we append we just allocate more memory - // to hold the result. - // If we had an allocator dedicated to 'text' we could perhaps just append to the end of the last allocation - // + // TODO(JS): Note that this is somewhat wasteful as every time we append we + // just allocate more memory to hold the result. If we had an allocator + // dedicated to 'text' we could perhaps just append to the end of the last + // allocation + // // We are now in a continuation, add to the last StringBuilder buf; buf.append(asStringSlice(last.text)); @@ -414,12 +433,12 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS } break; } - case LineParseResult::Ignore: + case LineParseResult::Ignore: { prevLineResult = lineRes; break; } - default: return SLANG_FAIL; + default: return SLANG_FAIL; } } @@ -428,7 +447,8 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS diagnostics->add(diagnostic); } - if (diagnostics->hasOfAtLeastSeverity(ArtifactDiagnostic::Severity::Error) || exeRes.resultCode != 0) + if (diagnostics->hasOfAtLeastSeverity(ArtifactDiagnostic::Severity::Error) || + exeRes.resultCode != 0) { diagnostics->setResult(SLANG_FAIL); } @@ -436,7 +456,11 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -/* static */SlangResult GCCDownstreamCompilerUtil::calcCompileProducts(const CompileOptions& options, ProductFlags flags, IOSFileArtifactRepresentation* lockFile, List<ComPtr<IArtifact>>& outArtifacts) +/* static */ SlangResult GCCDownstreamCompilerUtil::calcCompileProducts( + const CompileOptions& options, + ProductFlags flags, + IOSFileArtifactRepresentation* lockFile, + List<ComPtr<IArtifact>>& outArtifacts) { SLANG_ASSERT(options.modulePath.count); @@ -446,9 +470,13 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS { StringBuilder builder; const auto desc = ArtifactDescUtil::makeDescForCompileTarget(options.targetType); - SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc(desc, asStringSlice(options.modulePath), builder)); + SLANG_RETURN_ON_FAIL( + ArtifactDescUtil::calcPathForDesc(desc, asStringSlice(options.modulePath), builder)); - auto fileRep = OSFileArtifactRepresentation::create(IOSFileArtifactRepresentation::Kind::Owned, builder.getUnownedSlice(), lockFile); + auto fileRep = OSFileArtifactRepresentation::create( + IOSFileArtifactRepresentation::Kind::Owned, + builder.getUnownedSlice(), + lockFile); auto artifact = ArtifactUtil::createArtifact(desc); artifact->addRepresentation(fileRep); @@ -458,12 +486,16 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -/* static */SlangResult GCCDownstreamCompilerUtil::calcArgs(const CompileOptions& options, CommandLine& cmdLine) +/* static */ SlangResult GCCDownstreamCompilerUtil::calcArgs( + const CompileOptions& options, + CommandLine& cmdLine) { SLANG_ASSERT(options.modulePath.count); - PlatformKind platformKind = (options.platform == PlatformKind::Unknown) ? PlatformUtil::getPlatformKind() : options.platform; - + PlatformKind platformKind = (options.platform == PlatformKind::Unknown) + ? PlatformUtil::getPlatformKind() + : options.platform; + const auto targetDesc = ArtifactDescUtil::makeDescForCompileTarget(options.targetType); if (options.sourceLanguage == SLANG_SOURCE_LANGUAGE_CPP) @@ -473,7 +505,7 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS // C++17 since we share headers with slang itself (which uses c++17) cmdLine.addArg("-std=c++17"); } - + if (targetDesc.payload == ArtifactDesc::Payload::MetalAIR) { cmdLine.addArg("-std=metal3.1"); @@ -484,44 +516,44 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS // speaking UB, and GCC 10+ is happy to take advantage of this, stop it. cmdLine.addArg("-fno-strict-aliasing"); - // TODO(JS): Here we always set -m32 on x86. It could be argued it is only necessary when creating a shared library - // but if we create an object file, we don't know what to choose because we don't know what final usage is. - // It could also be argued that the platformKind could define the actual desired target - but as it stands - // we only have a target of 'Linux' (as opposed to Win32/64). Really it implies we need an arch enumeration too. + // TODO(JS): Here we always set -m32 on x86. It could be argued it is only necessary when + // creating a shared library but if we create an object file, we don't know what to choose + // because we don't know what final usage is. It could also be argued that the platformKind + // could define the actual desired target - but as it stands we only have a target of 'Linux' + // (as opposed to Win32/64). Really it implies we need an arch enumeration too. // - // For now we just make X86 binaries try and produce x86 compatible binaries as fixes the immediate problems. + // For now we just make X86 binaries try and produce x86 compatible binaries as fixes the + // immediate problems. #if SLANG_PROCESSOR_X86 - /* Used to specify the processor more broadly. For a x86 binary we need to make sure we build x86 builds - even when on an x64 system. - -m32 - -m64*/ + /* Used to specify the processor more broadly. For a x86 binary we need to make sure we build + x86 builds even when on an x64 system. -m32 -m64*/ cmdLine.addArg("-m32"); #endif switch (options.optimizationLevel) { - case OptimizationLevel::None: + case OptimizationLevel::None: { // No optimization cmdLine.addArg("-O0"); break; } - case OptimizationLevel::Default: + case OptimizationLevel::Default: { cmdLine.addArg("-Os"); break; } - case OptimizationLevel::High: + case OptimizationLevel::High: { cmdLine.addArg("-O2"); break; } - case OptimizationLevel::Maximal: + case OptimizationLevel::Maximal: { cmdLine.addArg("-O4"); break; } - default: break; + default: break; } if (options.debugInfoType != DebugInfoType::None) @@ -536,31 +568,35 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS switch (options.floatingPointMode) { - case FloatingPointMode::Default: break; - case FloatingPointMode::Precise: + case FloatingPointMode::Default: break; + case FloatingPointMode::Precise: { - //cmdLine.addArg("-fno-unsafe-math-optimizations"); + // cmdLine.addArg("-fno-unsafe-math-optimizations"); break; } - case FloatingPointMode::Fast: + case FloatingPointMode::Fast: { // We could enable SSE with -mfpmath=sse - // But that would only make sense on a x64/x86 type processor and only if that feature is present (it is on all x64) + // But that would only make sense on a x64/x86 type processor and only if that feature + // is present (it is on all x64) cmdLine.addArg("-ffast-math"); break; } } - StringBuilder moduleFilePath; - SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc(targetDesc, asStringSlice(options.modulePath), moduleFilePath)); - + StringBuilder moduleFilePath; + SLANG_RETURN_ON_FAIL(ArtifactDescUtil::calcPathForDesc( + targetDesc, + asStringSlice(options.modulePath), + moduleFilePath)); + cmdLine.addArg("-o"); cmdLine.addArg(moduleFilePath); switch (options.targetType) { - case SLANG_SHADER_SHARED_LIBRARY: - case SLANG_HOST_SHARED_LIBRARY: + case SLANG_SHADER_SHARED_LIBRARY: + case SLANG_HOST_SHARED_LIBRARY: { // Shared library cmdLine.addArg("-shared"); @@ -572,18 +608,18 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS } break; } - case SLANG_HOST_EXECUTABLE: + case SLANG_HOST_EXECUTABLE: { cmdLine.addArg("-rdynamic"); break; } - case SLANG_OBJECT_CODE: + case SLANG_OBJECT_CODE: { // Don't link, just produce object file cmdLine.addArg("-c"); break; } - default: break; + default: break; } // Add defines @@ -611,8 +647,8 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS // Link options if (0) // && options.targetType != TargetType::Object) { - //linkOptions << "-Wl,"; - //cmdLine.addArg(linkOptions); + // linkOptions << "-Wl,"; + // cmdLine.addArg(linkOptions); } if (options.targetType == SLANG_SHADER_SHARED_LIBRARY) @@ -632,7 +668,7 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS { ComPtr<IOSFileArtifactRepresentation> fileRep; - // TODO(JS): + // TODO(JS): // Do we want to keep the file on the file system? It's probably reasonable to do so. SLANG_RETURN_ON_FAIL(sourceArtifact->requireFile(ArtifactKeep::Yes, fileRep.writeRef())); cmdLine.addArg(fileRep->getPath()); @@ -640,10 +676,9 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS // Add the library paths - if (options.libraryPaths.count && - (options.targetType == SLANG_HOST_EXECUTABLE)) + if (options.libraryPaths.count && (options.targetType == SLANG_HOST_EXECUTABLE)) { - if(PlatformUtil::isFamily(PlatformFamily::Apple, platformKind)) + if (PlatformUtil::isFamily(PlatformFamily::Apple, platformKind)) cmdLine.addArg("-Wl,-rpath,@loader_path,-rpath,@loader_path/../lib"); else cmdLine.addArg("-Wl,-rpath,$ORIGIN,-rpath,$ORIGIN/../lib"); @@ -661,7 +696,8 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS { const auto artifactDesc = artifact->getDesc(); // If it's a library for CPU types, try and use it - if (ArtifactDescUtil::isCpuBinary(artifactDesc) && artifactDesc.kind == ArtifactKind::Library) + if (ArtifactDescUtil::isCpuBinary(artifactDesc) && + artifactDesc.kind == ArtifactKind::Library) { ComPtr<IOSFileArtifactRepresentation> fileRep; @@ -670,12 +706,15 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS const UnownedStringSlice path(fileRep->getPath()); libPathPool.add(Path::getParentDirectory(path)); - - cmdLine.addPrefixPathArg("-l", ArtifactDescUtil::getBaseNameFromPath(artifact->getDesc(), path)); + + cmdLine.addPrefixPathArg( + "-l", + ArtifactDescUtil::getBaseNameFromPath(artifact->getDesc(), path)); } } - if (options.sourceLanguage == SLANG_SOURCE_LANGUAGE_CPP && !PlatformUtil::isFamily(PlatformFamily::Windows, platformKind)) + if (options.sourceLanguage == SLANG_SOURCE_LANGUAGE_CPP && + !PlatformUtil::isFamily(PlatformFamily::Windows, platformKind)) { // Make STD libs available cmdLine.addArg("-lstdc++"); @@ -695,7 +734,9 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -/* static */SlangResult GCCDownstreamCompilerUtil::createCompiler(const ExecutableLocation& exe, ComPtr<IDownstreamCompiler>& outCompiler) +/* static */ SlangResult GCCDownstreamCompilerUtil::createCompiler( + const ExecutableLocation& exe, + ComPtr<IDownstreamCompiler>& outCompiler) { DownstreamCompilerDesc desc; SLANG_RETURN_ON_FAIL(GCCDownstreamCompilerUtil::calcVersion(exe, desc)); @@ -708,7 +749,10 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -/* static */SlangResult GCCDownstreamCompilerUtil::locateGCCCompilers(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set) +/* static */ SlangResult GCCDownstreamCompilerUtil::locateGCCCompilers( + const String& path, + ISlangSharedLibraryLoader* loader, + DownstreamCompilerSet* set) { SLANG_UNUSED(loader); @@ -717,10 +761,10 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS { // A downstream compiler for Slang must currently support C++17 - such that // the prelude and generated code works. - // + // // The first version of gcc that supports stable `-std=c++17` is 9.0 // https://gcc.gnu.org/projects/cxx-status.html - + auto desc = compiler->getDesc(); if (desc.version.m_major < 9) { @@ -733,7 +777,10 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -/* static */SlangResult GCCDownstreamCompilerUtil::locateClangCompilers(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set) +/* static */ SlangResult GCCDownstreamCompilerUtil::locateClangCompilers( + const String& path, + ISlangSharedLibraryLoader* loader, + DownstreamCompilerSet* set) { SLANG_UNUSED(loader); @@ -745,4 +792,4 @@ static SlangResult _parseGCCFamilyLine(SliceAllocator& allocator, const UnownedS return SLANG_OK; } -} +} // namespace Slang |
