From 4a94f39020dcc143f9a1d8f5c57ba77a828ead61 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 15 Aug 2017 09:29:52 -0700 Subject: 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... --- source/slangc/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source/slangc/main.cpp') 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 -- cgit v1.2.3