summaryrefslogtreecommitdiffstats
path: root/source/slang/preprocessor.cpp
diff options
context:
space:
mode:
authorTim Foley <tim.foley.is@gmail.com>2017-07-19 18:52:38 -0700
committerGitHub <noreply@github.com>2017-07-19 18:52:38 -0700
commitf07c01ceb012b9b325a8ecebd12cdd5797d8d5b3 (patch)
tree0b93a109d51e6565560ad785519a863386490e2a /source/slang/preprocessor.cpp
parenta2b8b4c20632d79721052abd232fe2d1bdf2700d (diff)
parent3f48e1c0d84bf4909954154ad147559656e87516 (diff)
Merge pull request #128 from tfoleyNV/improve-failure-modes
Try to improve handling of failures during compilation
Diffstat (limited to 'source/slang/preprocessor.cpp')
-rw-r--r--source/slang/preprocessor.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/slang/preprocessor.cpp b/source/slang/preprocessor.cpp
index a4cccf4f4..ec38a7214 100644
--- a/source/slang/preprocessor.cpp
+++ b/source/slang/preprocessor.cpp
@@ -705,8 +705,7 @@ static void MaybeBeginMacroExpansion(
UInt argCount = argIndex;
if (argCount != paramCount)
{
- // TODO: diagnose
- throw 99;
+ GetSink(preprocessor)->diagnose(PeekLoc(preprocessor), Diagnostics::wrongNumberOfArgumentsToMacro, paramCount, argCount);
}
// We are ready to expand.
@@ -1006,7 +1005,7 @@ static void beginConditional(
bool enable)
{
Preprocessor* preprocessor = context->preprocessor;
- assert(inputStream);
+ SLANG_ASSERT(inputStream);
PreprocessorConditional* conditional = CreateConditional(preprocessor);
@@ -1346,7 +1345,7 @@ static void HandleIfNDefDirective(PreprocessorDirectiveContext* context)
static void HandleElseDirective(PreprocessorDirectiveContext* context)
{
PreprocessorInputStream* inputStream = context->preprocessor->inputStream;
- assert(inputStream);
+ SLANG_ASSERT(inputStream);
// if we aren't inside a conditional, then error
PreprocessorConditional* conditional = inputStream->conditional;
@@ -1386,7 +1385,7 @@ static void HandleElifDirective(PreprocessorDirectiveContext* context)
// Need to grab current input stream *before* we try to parse
// the conditional expression.
PreprocessorInputStream* inputStream = context->preprocessor->inputStream;
- assert(inputStream);
+ SLANG_ASSERT(inputStream);
// HACK(tfoley): handle an empty `elif` like an `else` directive
//
@@ -1438,7 +1437,7 @@ static void HandleElifDirective(PreprocessorDirectiveContext* context)
static void HandleEndIfDirective(PreprocessorDirectiveContext* context)
{
PreprocessorInputStream* inputStream = context->preprocessor->inputStream;
- assert(inputStream);
+ SLANG_ASSERT(inputStream);
// if we aren't inside a conditional, then error
PreprocessorConditional* conditional = inputStream->conditional;