linker_script: emit "unclosed comment" error for unterminated block comments#1674
Conversation
libwild/src/linker_script.rs
Outdated
| fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
| match self { | ||
| LinkerScriptError::InvalidAlignment => write!(f, "Invalid alignment"), | ||
| LinkerScriptError::UnclosedComment => write!(f, "unclosed comment"), |
There was a problem hiding this comment.
Let's make the case consistent:
| LinkerScriptError::UnclosedComment => write!(f, "unclosed comment"), | |
| LinkerScriptError::UnclosedComment => write!(f, "Unclosed comment"), |
There was a problem hiding this comment.
I agree. The mold test can have a comment added next to it - "Different message formats". There's plenty of other tests that we do that for.
There was a problem hiding this comment.
capitalized the error message, updated the integration test to match, and resolved the merge conflict.
Looks like this test was already passing before your changes. |
It seems the test is listed in Regarding the capitalization, the mold test greps for the exact string i will create and add the test you asked for shortly. |
hey, I've written a test based on the pattern of the tests i saw, but it doesn't seem to be getting discovered by the test runner. Could you help me with this? |
It doesn't look like you've pushed the change that includes the test, so it's hard to say, but at a guess, I'd say you might have not known to add the test to the list of tests in |
yeah i forgot to push that but got it now, thanks for the feedback. |
When a linker script contains an unclosed
/*comment, the parser previously returned a generic winnow parse error with no meaningful message.This adds an
UnclosedCommentvariant toLinkerScriptErrorand returns it whentake_until("*/")fails due to EOF, producing an error message containing "unclosed comment".Fixes the mold test
linker-script-error.sh.