Correct 2 x grammar rules for compilation unit name in #line
Good catch, @logeshkumars0604!
This PR addresses Issue #1118.
The " vs. # error was introduced in V6 when we converted to the ANTLR grammar notation.
The ability to have an empty filename was never tested, but as you point out, it does work, so I have made the name contents zero-or-more characters, instead of one-or-more. I tested this using #line 300 "" along with CallerFilePathAttribute.
closing and reopening to rerun the CI builds.
6.5.8 Line directives, states
Line directives may be used to alter the line numbers and compilation unit names that are reported by the compiler in output such as warnings and errors.
Note the presence of "reported": there is no requirement that such a reported name map to anything in a file system, so why not allow an empty string name?
From the 2024-09-04 TG2 call:
There appear to be 2 issues:
- Conflicting text for the existing grammar.
- Whether we want to allow an empty string. Just because Roslyn allows it is not necessarily a reason for the spec to do so.
After a short discussion, Rex agreed to take another look.
Having looked at this again, I don't have more to add, and I've re-added the "Meeting discuss" label.
Roslyn crash reported as https://github.com/dotnet/msbuild/issues/11168