From 7b2a549fcf04263e07127315d72c8570e8063828 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 6 Jul 2018 11:51:19 -0400 Subject: spCompile/spProcessCommandLineArguments return SlangResult (#610) * * Make spCompile return SlangResult * Make spProcessCommandLineArguments return SlangResult (and not internally exit) * Remove calls to exit() * Fix typos * Make all output from spProcessCommandLineArguments get sent to diagnostic sink. --- tools/slang-eval-test/main.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'tools/slang-eval-test/main.cpp') diff --git a/tools/slang-eval-test/main.cpp b/tools/slang-eval-test/main.cpp index e01d4441b..ff2ebed34 100644 --- a/tools/slang-eval-test/main.cpp +++ b/tools/slang-eval-test/main.cpp @@ -6,9 +6,7 @@ #include "../../source/core/secure-crt.h" #include -int main( - int argc, - char** argv) +static SlangResult innerMain(int argc, char*const* argv) { // TODO: parse arguments @@ -24,7 +22,7 @@ int main( size_t inputSize = ftell(inputFile); fseek(inputFile, 0, SEEK_SET); - char* inputText = (char*) malloc(inputSize + 1); + char* inputText = (char*)malloc(inputSize + 1); fread(inputText, inputSize, 1, inputFile); inputText[inputSize] = 0; fclose(inputFile); @@ -59,11 +57,11 @@ int main( "main", spFindProfile(session, "cs_5_0")); - if( spCompile(request) != 0 ) + if (SLANG_FAILED(spCompile(request))) { char const* output = spGetDiagnosticOutput(request); fputs(output, stderr); - exit(1); + return SLANG_FAIL; } // Things compiled, so now we need to run them... @@ -129,5 +127,13 @@ int main( spDestroyCompileRequest(request); spDestroySession(session); - return 0; + return SLANG_OK; +} + +int main( + int argc, + char** argv) +{ + SlangResult res = innerMain(argc, argv); + return SLANG_FAILED(res) ? 1 : 0; } -- cgit v1.2.3