diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-10-25 11:24:16 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-25 11:24:16 -0400 |
| commit | 4f0415e338862ffec50c2d47eddea958255b504e (patch) | |
| tree | 084c8e25552e328ed14eafcf0431493f58f973e8 /source/slang | |
| parent | 2700a89f8c80620f1d523563cc80ec0da39e9761 (diff) | |
Feature/premake linux (#689)
* Premake work in progress for linux.
* Added dump function.
* Remove examples on linux
Small warning fix.
* * Don't build render-test on linux
* Removed work around virtual destructor warning, and just used virtual dtor for simplicity
* Git ignore obj directories
* Fix premake working on windows.
* * Fix sprintf_s functions
* Make generates arg parsing more robust
* Added FloatIntUnion to avoid type punning/strong aliasing issues, and repeated union definitions.
* Work around problems building on linux with getClass claiming a strict aliasing issue.
* Fix for targetBlock appearing potentiall used unintialized to gcc.
* Linux slang link options -fPIC to make dll.
* Add -fPIC to build options on linux.
* Add -ldl for linux on slang.
* Fixes to try and get premake working with .so on linux.
* Make core compile with -fPIC
* Try to fix linux linking with --no-as-needed before -ldl
* Add rpath back.
* Remove render-gl from linux build.
* Re-add location for linux.
* Don't include <malloc.h> except on windows.
* Remove unused line to fix warning on osx.
* Remove ambiguity on OSX for operator <<.
* Fixing ambiguity with operator overloading and Int types for OSX.
* Fix ambiguity around UInt and operator
* Fix ambiguity of UInt conversion for OSX.
* Added UnambiguousInt and UnambiguousUInt to make it easier to work around OSX integer coercion for UInt/Int types.
Diffstat (limited to 'source/slang')
| -rw-r--r-- | source/slang/check.cpp | 1 | ||||
| -rw-r--r-- | source/slang/core.meta.slang | 6 | ||||
| -rw-r--r-- | source/slang/core.meta.slang.h | 6 | ||||
| -rw-r--r-- | source/slang/default-file-system.h | 3 | ||||
| -rw-r--r-- | source/slang/diagnostics.cpp | 2 | ||||
| -rw-r--r-- | source/slang/emit.cpp | 7 | ||||
| -rw-r--r-- | source/slang/ir-legalize-types.cpp | 2 | ||||
| -rw-r--r-- | source/slang/ir-restructure.cpp | 2 | ||||
| -rw-r--r-- | source/slang/ir.cpp | 9 | ||||
| -rw-r--r-- | source/slang/lower-to-ir.cpp | 4 | ||||
| -rw-r--r-- | source/slang/mangle.cpp | 4 | ||||
| -rw-r--r-- | source/slang/parser.cpp | 4 | ||||
| -rw-r--r-- | source/slang/preprocessor.cpp | 6 | ||||
| -rw-r--r-- | source/slang/slang-stdlib.cpp | 1 | ||||
| -rw-r--r-- | source/slang/source-loc.h | 10 | ||||
| -rw-r--r-- | source/slang/syntax.h | 12 |
16 files changed, 42 insertions, 37 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp index 47713e6cc..278ba7b61 100644 --- a/source/slang/check.cpp +++ b/source/slang/check.cpp @@ -5283,7 +5283,6 @@ namespace Slang RefPtr<Type> bestType; if(auto basicType = type.As<BasicExpressionType>()) { - basicType->baseType; for(Int baseTypeFlavorIndex = 0; baseTypeFlavorIndex < Int(BaseType::CountOf); baseTypeFlavorIndex++) { // Don't consider `type`, since we already know it doesn't work. diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang index b1e6e0fd6..0502c9bf6 100644 --- a/source/slang/core.meta.slang +++ b/source/slang/core.meta.slang @@ -80,19 +80,19 @@ for (int tt = 0; tt < kBaseTypeCount; ++tt) case BaseType::Double: sb << "\n , __BuiltinFloatingPointType\n"; sb << "\n , __BuiltinRealType\n"; - // fall through to: + ; // fall through to: case BaseType::Int8: case BaseType::Int16: case BaseType::Int: case BaseType::Int64: sb << "\n , __BuiltinSignedArithmeticType\n"; - // fall through to: + ; // fall through to: case BaseType::UInt8: case BaseType::UInt16: case BaseType::UInt: case BaseType::UInt64: sb << "\n , __BuiltinArithmeticType\n"; - // fall through to: + ; // fall through to: case BaseType::Bool: sb << "\n , __BuiltinType\n"; break; diff --git a/source/slang/core.meta.slang.h b/source/slang/core.meta.slang.h index f0d61fa12..97a2d1edd 100644 --- a/source/slang/core.meta.slang.h +++ b/source/slang/core.meta.slang.h @@ -80,19 +80,19 @@ for (int tt = 0; tt < kBaseTypeCount; ++tt) case BaseType::Double: sb << "\n , __BuiltinFloatingPointType\n"; sb << "\n , __BuiltinRealType\n"; - // fall through to: + ; // fall through to: case BaseType::Int8: case BaseType::Int16: case BaseType::Int: case BaseType::Int64: sb << "\n , __BuiltinSignedArithmeticType\n"; - // fall through to: + ; // fall through to: case BaseType::UInt8: case BaseType::UInt16: case BaseType::UInt: case BaseType::UInt64: sb << "\n , __BuiltinArithmeticType\n"; - // fall through to: + ; // fall through to: case BaseType::Bool: sb << "\n , __BuiltinType\n"; break; diff --git a/source/slang/default-file-system.h b/source/slang/default-file-system.h index 47644f5ad..7805dd81a 100644 --- a/source/slang/default-file-system.h +++ b/source/slang/default-file-system.h @@ -43,6 +43,7 @@ public: private: /// Make so not constructible DefaultFileSystem() {} + virtual ~DefaultFileSystem() {} ISlangUnknown* getInterface(const Guid& guid); @@ -88,6 +89,8 @@ public: m_fileSystem(fileSystem) { } + virtual ~WrapFileSystem() {} + protected: ISlangUnknown* getInterface(const Guid& guid); diff --git a/source/slang/diagnostics.cpp b/source/slang/diagnostics.cpp index c4638f29a..7271c04d3 100644 --- a/source/slang/diagnostics.cpp +++ b/source/slang/diagnostics.cpp @@ -173,7 +173,7 @@ static void formatDiagnostic( sb << humaneLoc.pathInfo.foundPath; sb << "("; - sb << humaneLoc.line; + sb << Int32(humaneLoc.line); sb << "): "; sb << getSeverityName(diagnostic.severity); diff --git a/source/slang/emit.cpp b/source/slang/emit.cpp index c9e19dffc..9c7d61c51 100644 --- a/source/slang/emit.cpp +++ b/source/slang/emit.cpp @@ -2213,7 +2213,7 @@ struct EmitVisitor context->shared->uniqueNameCounters[key] = count+1; - sb.append(count); + sb.append(Int32(count)); return sb.ProduceString(); } @@ -2238,8 +2238,7 @@ struct EmitVisitor // for the instruction. StringBuilder sb; sb << "_S"; - sb << getID(inst); - + sb << Int32(getID(inst)); return sb.ProduceString(); } @@ -5000,7 +4999,7 @@ struct EmitVisitor String paramName; paramName.append("_"); - paramName.append(pp); + paramName.append(Int32(pp)); auto paramType = funcType->getParamType(pp); emitIRParamType(ctx, paramType, paramName); diff --git a/source/slang/ir-legalize-types.cpp b/source/slang/ir-legalize-types.cpp index 931ceb85a..b86c9f6e9 100644 --- a/source/slang/ir-legalize-types.cpp +++ b/source/slang/ir-legalize-types.cpp @@ -1201,7 +1201,7 @@ static LegalVal declareSimpleVar( if (mangledNameStr.Length() != 0) { mangledNameStr.append("L"); - mangledNameStr.append(globalNameInfo->counter++); + mangledNameStr.append(Int32(globalNameInfo->counter++)); globalVar->mangledName = context->session->getNameObj(mangledNameStr); } } diff --git a/source/slang/ir-restructure.cpp b/source/slang/ir-restructure.cpp index dc35a8aee..d8d3fe7c9 100644 --- a/source/slang/ir-restructure.cpp +++ b/source/slang/ir-restructure.cpp @@ -250,7 +250,7 @@ namespace Slang // information that can inform our control-flow restructuring pass. // SLANG_UNEXPECTED("unhandled terminator instruction opcode"); - // fall through to: + ; // fall through to: case kIROp_Unreachable: case kIROp_MissingReturn: case kIROp_ReturnVal: diff --git a/source/slang/ir.cpp b/source/slang/ir.cpp index f05aeabf6..6e14edc1f 100644 --- a/source/slang/ir.cpp +++ b/source/slang/ir.cpp @@ -3,6 +3,8 @@ #include "ir-insts.h" #include "../core/basic.h" +#include "../core/slang-cpu-defines.h" + #include "mangle.h" namespace Slang @@ -2570,8 +2572,7 @@ namespace Slang IRDumpContext* context, UInt val) { - context->builder->append(val); - + context->builder->append(UnambigousUInt(val)); // fprintf(context->file, "%llu", (unsigned long long)val); } @@ -2771,10 +2772,6 @@ namespace Slang IRDumpContext* context, IRType* type); - static void dumpDeclRef( - IRDumpContext* context, - DeclRef<Decl> const& declRef); - static void dumpOperand( IRDumpContext* context, IRInst* inst) diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 1ee521e3b..6cce469ea 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -2691,7 +2691,7 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // We just need to look up the basic block that // corresponds to the break label for that statement, // and then emit an instruction to jump to it. - IRBlock* targetBlock; + IRBlock* targetBlock = nullptr; context->shared->breakLabels.TryGetValue(parentStmt, targetBlock); SLANG_ASSERT(targetBlock); getBuilder()->emitBreak(targetBlock); @@ -2710,7 +2710,7 @@ struct StmtLoweringVisitor : StmtVisitor<StmtLoweringVisitor> // We just need to look up the basic block that // corresponds to the continue label for that statement, // and then emit an instruction to jump to it. - IRBlock* targetBlock; + IRBlock* targetBlock = nullptr; context->shared->continueLabels.TryGetValue(parentStmt, targetBlock); SLANG_ASSERT(targetBlock); getBuilder()->emitContinue(targetBlock); diff --git a/source/slang/mangle.cpp b/source/slang/mangle.cpp index c35ad1e14..c2645929f 100644 --- a/source/slang/mangle.cpp +++ b/source/slang/mangle.cpp @@ -4,6 +4,8 @@ #include "ir-insts.h" #include "syntax.h" +#include "../core/slang-cpu-defines.h" + namespace Slang { struct ManglingContext @@ -22,7 +24,7 @@ namespace Slang ManglingContext* context, UInt value) { - context->sb.append(value); + context->sb.append(UnambigousUInt(value)); } void emit( diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp index 4ebbdd191..9ccd7b962 100644 --- a/source/slang/parser.cpp +++ b/source/slang/parser.cpp @@ -993,7 +993,7 @@ namespace Slang nameToken.Content = nameToken.Content + ":"; break; } - + ; // fall-thru default: parser->sink->diagnose(nameToken.loc, Diagnostics::invalidOperator, nameToken); break; @@ -3689,12 +3689,14 @@ namespace Slang case TokenType::OpGeq: // Don't allow these ops inside a generic argument if (parser->genericDepth > 0) return Precedence::Invalid; + ; // fall-thru case TokenType::OpLeq: case TokenType::OpLess: return Precedence::RelationalComparison; case TokenType::OpRsh: // Don't allow this op inside a generic argument if (parser->genericDepth > 0) return Precedence::Invalid; + ; // fall-thru case TokenType::OpLsh: return Precedence::BitShift; case TokenType::OpAdd: diff --git a/source/slang/preprocessor.cpp b/source/slang/preprocessor.cpp index ca11b24e8..47aa0cfd4 100644 --- a/source/slang/preprocessor.cpp +++ b/source/slang/preprocessor.cpp @@ -992,7 +992,7 @@ static Token AdvanceToken(PreprocessorDirectiveContext* context) static Token PeekToken(PreprocessorDirectiveContext* context) { if (IsEndOfLine(context)) - context->preprocessor->endOfFileToken; + return context->preprocessor->endOfFileToken; return PeekToken(context->preprocessor); } @@ -2091,11 +2091,11 @@ static const PreprocessorDirective kDirectives[] = { "version", &handleGLSLVersionDirective, 0 }, { "extension", &handleGLSLExtensionDirective, 0 }, - { NULL, NULL }, + { nullptr, nullptr, 0 }, }; static const PreprocessorDirective kInvalidDirective = { - NULL, &HandleInvalidDirective, 0, + nullptr, &HandleInvalidDirective, 0, }; // Look up the directive with the given name. diff --git a/source/slang/slang-stdlib.cpp b/source/slang/slang-stdlib.cpp index 5a4718af4..936c92fdd 100644 --- a/source/slang/slang-stdlib.cpp +++ b/source/slang/slang-stdlib.cpp @@ -24,6 +24,7 @@ namespace Slang case '\t': case '\\': pathBuilder << "\\"; + ; // fall-thru default: pathBuilder << *cc; break; diff --git a/source/slang/source-loc.h b/source/slang/source-loc.h index 8f6b8f7cb..aba9b7bd9 100644 --- a/source/slang/source-loc.h +++ b/source/slang/source-loc.h @@ -60,12 +60,12 @@ struct PathInfo const String getMostUniquePath() const; // So simplify construction. In normal usage it's safer to use make methods over constructing directly. - static PathInfo makeUnknown() { return PathInfo { Type::Unknown, "unknown" }; } - static PathInfo makeTokenPaste() { return PathInfo{ Type::TokenPaste, "token paste" }; } + static PathInfo makeUnknown() { return PathInfo { Type::Unknown, "unknown", String() }; } + static PathInfo makeTokenPaste() { return PathInfo{ Type::TokenPaste, "token paste", String()}; } static PathInfo makeNormal(const String& foundPathIn, const String& canonicalPathIn) { SLANG_ASSERT(canonicalPathIn.Length() > 0 && foundPathIn.Length() > 0); return PathInfo { Type::Normal, foundPathIn, canonicalPathIn }; } - static PathInfo makePath(const String& pathIn) { SLANG_ASSERT(pathIn.Length() > 0); return PathInfo { Type::FoundPath, pathIn }; } - static PathInfo makeTypeParse() { return PathInfo { Type::TypeParse, "type string" }; } - static PathInfo makeCommandLine() { return PathInfo { Type::CommandLine, "command line" }; } + static PathInfo makePath(const String& pathIn) { SLANG_ASSERT(pathIn.Length() > 0); return PathInfo { Type::FoundPath, pathIn, String()}; } + static PathInfo makeTypeParse() { return PathInfo { Type::TypeParse, "type string", String() }; } + static PathInfo makeCommandLine() { return PathInfo { Type::CommandLine, "command line", String() }; } Type type; ///< The type of path String foundPath; ///< The path where the file was found (might contain relative elements) diff --git a/source/slang/syntax.h b/source/slang/syntax.h index 019740a5e..7bd2afc12 100644 --- a/source/slang/syntax.h +++ b/source/slang/syntax.h @@ -330,8 +330,8 @@ namespace Slang SyntaxClassBase() {} - SyntaxClassBase(ClassInfo const* classInfo) - : classInfo(classInfo) + SyntaxClassBase(ClassInfo const* classInfoIn) + : classInfo(classInfoIn) {} void* createInstanceImpl() const @@ -375,11 +375,13 @@ namespace Slang return (T*)createInstanceImpl(); } + SyntaxClass(const ClassInfo* classInfoIn): + SyntaxClassBase(classInfoIn) + {} + static SyntaxClass<T> getClass() { - SyntaxClass<T> result; - result.classInfo = &SyntaxClass::Impl<T>::kClassInfo; - return result; + return SyntaxClass<T>(&SyntaxClassBase::Impl<T>::kClassInfo); } template<typename U> |
