diff options
| author | Tim Foley <tfoley@nvidia.com> | 2017-08-15 09:29:52 -0700 |
|---|---|---|
| committer | Tim Foley <tfoley@nvidia.com> | 2017-08-15 09:33:36 -0700 |
| commit | 4a94f39020dcc143f9a1d8f5c57ba77a828ead61 (patch) | |
| tree | 384ed2dd18f2d3fa070dffbd70d3e1f9a2bf0909 /source/slangc/main.cpp | |
| parent | 4a9b281c154422cdef03ef629718a458f753093f (diff) | |
Improve diagnostics for overlapping/conflicting bindings
Closes #38
- Change overlapping bindings case from error to warning (it is *technically* allowed in HLSL/GLSL)
- Make diagnostic messages for these cases include a note to point at the "other" declaration in each case, so that user can more easily isolate the problem
- Unrelated fix: make sure `slangc` sets up its diagnostic callback *before* parsing command-line options so that error messages output during options parsing will be visible
- Unrelated fix: make sure that formatting for diagnostic messages doesn't print diagnostic ID for notes (all have IDs < 0).
- Note: eventually I'd like to not print diagnostic IDs at all (I think they are cluttering up our output), but doing that requires touching all the test cases...
Diffstat (limited to 'source/slangc/main.cpp')
| -rw-r--r-- | source/slangc/main.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/slangc/main.cpp b/source/slangc/main.cpp index 6fb394cce..da670909d 100644 --- a/source/slangc/main.cpp +++ b/source/slangc/main.cpp @@ -34,6 +34,11 @@ int MAIN(int argc, char** argv) SlangSession* session = spCreateSession(nullptr); SlangCompileRequest* compileRequest = spCreateCompileRequest(session); + spSetDiagnosticCallback( + compileRequest, + &diagnosticCallback, + nullptr); + spSetCommandLineCompilerMode(compileRequest); char const* appName = "slangc"; @@ -46,11 +51,6 @@ int MAIN(int argc, char** argv) exit(1); } - spSetDiagnosticCallback( - compileRequest, - &diagnosticCallback, - nullptr); - // Invoke the compiler #ifndef _DEBUG |
