diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2018-07-06 11:51:19 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-06 11:51:19 -0400 |
| commit | 7b2a549fcf04263e07127315d72c8570e8063828 (patch) | |
| tree | 8dd94dc20d8537f1c8406f5a9e561c9a68d599db /tools/slang-eval-test/main.cpp | |
| parent | 338a7701b37fe133eba2f72455ba7c1790a8a1f5 (diff) | |
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.
Diffstat (limited to 'tools/slang-eval-test/main.cpp')
| -rw-r--r-- | tools/slang-eval-test/main.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
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 <slang.h> -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; } |
