From 34a1ff5226a526cc17c5baecd63637f69c324fc7 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Sat, 22 May 2021 16:03:30 -0400 Subject: Improvements in -X support (#1852) * #include an absolute path didn't work - because paths were taken to always be relative. * Added SourceLoc handling for command line parsing. * Fix typo in debug. * Fix issue around the DiagnosticSink used in options parsing not having a writer available - by having DiagnosticSink parenting. * Small rename for clarity. * WIP extracting command line args for downstream tools. * Unit tests/bug fixes around extracting args. * Use DownstreamArgs in the EndToEndCompileRequest * Passing downstream compiler options downstream. * Fix issue with endToEndReq being nullptr. * Fix issue with diagnostics number change. * Small improvements to how the source line is displayed if it's too long. Default to 120, as suggested in previous review. * Make render test use x-args parsing and CommandArgReader. * Added missing diagnostics. * More DownstreamArgs to linkage so can be seen by 'components'. Added dxc-x-arg test. * Used combination of name and args instead of two Lists, which whilst equivalent was perhaps a little confusing. * Added documentation for -X support. * Added test for x-args parsing diagnostic. Improved diagnostic with list of known names. * Fix issues from merge. * Fix lookup for -matrix-layout-column-major in render test. * Remove commented out line. --- tools/render-test/diagnostic-defs.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tools/render-test/diagnostic-defs.h (limited to 'tools/render-test/diagnostic-defs.h') diff --git a/tools/render-test/diagnostic-defs.h b/tools/render-test/diagnostic-defs.h new file mode 100644 index 000000000..e48012550 --- /dev/null +++ b/tools/render-test/diagnostic-defs.h @@ -0,0 +1,33 @@ +// + +// The file is meant to be included multiple times, to produce different +// pieces of declaration/definition code related to diagnostic messages +// +// Each diagnostic is declared here with: +// +// DIAGNOSTIC(id, severity, name, messageFormat) +// +// Where `id` is the unique diagnostic ID, `severity` is the default +// severity (from the `Severity` enum), `name` is a name used to refer +// to this diagnostic from code, and `messageFormat` is the default +// (non-localized) message for the diagnostic, with placeholders +// for any arguments. + +#ifndef DIAGNOSTIC +#error Need to #define DIAGNOSTIC(...) before including +#define DIAGNOSTIC(id, severity, name, messageFormat) /* */ +#endif + +// +// -1 - Notes that decorate another diagnostic. +// + + +DIAGNOSTIC(1001, Error, expectingCommaComputeDispatch, "expected 3 comma separated integers for compute dispatch size") +DIAGNOSTIC(1002, Error, expectingPositiveComputeDispatch, "expected 3 comma positive integers for compute dispatch size") +DIAGNOSTIC(1003, Error, unknownSourceLanguage, "unknown source language name") +DIAGNOSTIC(1003, Error, unknown, "unknown source language name") +DIAGNOSTIC(1004, Error, unknownCommandLineOption, "unknown command-line option '$0'") +DIAGNOSTIC(1005, Error, unexpectedPositionalArg, "unexpected positional arg") + +#undef DIAGNOSTIC -- cgit v1.2.3