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/slang/diagnostics.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'source/slang/diagnostics.cpp') diff --git a/source/slang/diagnostics.cpp b/source/slang/diagnostics.cpp index 45adf0ad8..65161db1d 100644 --- a/source/slang/diagnostics.cpp +++ b/source/slang/diagnostics.cpp @@ -162,8 +162,13 @@ static void formatDiagnostic( sb << humaneLoc.line; sb << "): "; sb << getSeverityName(diagnostic.severity); - sb << " "; - sb << diagnostic.ErrorID; + + if( diagnostic.ErrorID >= 0 ) + { + sb << " "; + sb << diagnostic.ErrorID; + } + sb << ": "; sb << diagnostic.Message; sb << "\n"; -- cgit v1.2.3