From cda9c3b1a712715209a3f4ba155c1425898334cb Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Mon, 22 Oct 2018 07:45:09 -0700 Subject: Osx build fixes (#681) * Remove 'register' qualifiers. These will be illegal come c++17 and give a warning on OSX. * Add UNREACHABLE_RETURNs to silence compiler warnings. * Make FileStream::GetPosition() compile on OSX (w.r.t. the linux build, I believe that strictly-speaking, fpos64_t is specified as an opaque type and the cast to an Int64 is not necessarily well-defined.) * Avoid an inadvertent trigraph. --- source/slang/lower-to-ir.cpp | 11 ++++++++++- source/slang/vm.cpp | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'source/slang') diff --git a/source/slang/lower-to-ir.cpp b/source/slang/lower-to-ir.cpp index 5f3b00b24..1ee521e3b 100644 --- a/source/slang/lower-to-ir.cpp +++ b/source/slang/lower-to-ir.cpp @@ -676,7 +676,7 @@ LoweredValInfo emitCallToDeclRef( #undef CASE default: SLANG_UNIMPLEMENTED_X("IR pseudo-op"); - break; + UNREACHABLE_RETURN(LoweredValInfo()); } } @@ -994,6 +994,7 @@ struct ValLoweringVisitor : ValVisitor LoweredValInfo visitOverloadedExpr(OverloadedExpr* /*expr*/) { SLANG_UNEXPECTED("overloaded expressions should not occur in checked AST"); + UNREACHABLE_RETURN(LoweredValInfo()); } LoweredValInfo visitOverloadedExpr2(OverloadedExpr2* /*expr*/) { SLANG_UNEXPECTED("overloaded expressions should not occur in checked AST"); + UNREACHABLE_RETURN(LoweredValInfo()); } LoweredValInfo visitIndexExpr(IndexExpr* expr) @@ -1498,6 +1501,7 @@ struct ExprLoweringVisitorBase : ExprVisitor } SLANG_UNIMPLEMENTED_X("codegen for subscript expression"); + UNREACHABLE_RETURN(LoweredValInfo()); } // We will always lower a dereference expression (`*ptr`) @@ -1662,6 +1666,7 @@ struct ExprLoweringVisitorBase : ExprVisitor LoweredValInfo visitAggTypeCtorExpr(AggTypeCtorExpr* /*expr*/) { SLANG_UNIMPLEMENTED_X("codegen for aggregate type constructor expression"); + UNREACHABLE_RETURN(LoweredValInfo()); } // After a call to a function with `out` or `in out` @@ -2034,11 +2039,13 @@ struct ExprLoweringVisitorBase : ExprVisitor LoweredValInfo visitGenericAppExpr(GenericAppExpr* /*expr*/) { SLANG_UNIMPLEMENTED_X("generic application expression during code generation"); + UNREACHABLE_RETURN(LoweredValInfo()); } LoweredValInfo visitSharedTypeExpr(SharedTypeExpr* /*expr*/) { SLANG_UNIMPLEMENTED_X("shared type expression during code generation"); + UNREACHABLE_RETURN(LoweredValInfo()); } LoweredValInfo visitAssignExpr(AssignExpr* expr) @@ -5279,6 +5286,7 @@ IRInst* lowerSubstitutionArg( else { SLANG_UNIMPLEMENTED_X("value cases"); + UNREACHABLE_RETURN(nullptr); } } @@ -5419,6 +5427,7 @@ LoweredValInfo emitDeclRef( else { SLANG_UNEXPECTED("uhandled substitution type"); + UNREACHABLE_RETURN(LoweredValInfo()); } } diff --git a/source/slang/vm.cpp b/source/slang/vm.cpp index f5f5540f5..fa59a741b 100644 --- a/source/slang/vm.cpp +++ b/source/slang/vm.cpp @@ -415,11 +415,11 @@ void dumpVMFrame(VMFrame* vmFrame) break; case kIROp_HLSLRWStructuredBufferType: - fprintf(stderr, ": RWStructuredBuffer = ???"); + fprintf(stderr, ": RWStructuredBuffer = ???"); break; case kIROp_HLSLStructuredBufferType: - fprintf(stderr, ": StructuredBuffer = ???"); + fprintf(stderr, ": StructuredBuffer = ???"); break; case kIROp_BoolType: -- cgit v1.2.3