From c7b5ea27156b68971d1fc46935e9e5b63243b9ba Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Mon, 5 Apr 2021 11:49:14 -0600 Subject: give context for eagerly-expanded macro definition errors --- src/makefile/input.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/makefile/input.rs b/src/makefile/input.rs index 3fe28e7..3707aef 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -265,6 +265,14 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { LineType::Macro => self.read_macro(line_tokens, line_number)?, LineType::Unknown => { if !line_tokens.is_empty() { + #[cfg(feature = "full")] + if line_tokens.starts_with("export") { + log::error!("export directive not supported yet"); + continue; + } else if line_tokens.starts_with("unexport") { + log::error!("unexport directive not supported yet"); + continue; + } bail!( "error: line {}: unknown line \"{}\"", line_number, @@ -562,7 +570,10 @@ impl<'a, 'parent, R: BufRead> MakefileReader<'a, 'parent, R> { value.trim_start(); let value = if expand_value { - TokenString::text(self.expand_macros(&value)?) + TokenString::text( + self.expand_macros(&value) + .wrap_err_with(|| format!("while defining {} on line {}", name, line_number))?, + ) } else { value }; -- cgit v1.2.3