From 7f78c17319ae28602d64df1c6a51b36c63aec4c1 Mon Sep 17 00:00:00 2001 From: Rui Paulo Date: Tue, 10 Jun 2014 06:16:34 +0000 Subject: [PATCH] dtc: ignore lines starting with #. This is necessary because we use the C pre-processor to parse #include lines and cpp adds line markings that start with #. --- usr.bin/dtc/input_buffer.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/usr.bin/dtc/input_buffer.cc b/usr.bin/dtc/input_buffer.cc index 8f055fe61d72..c83044d9d8fb 100644 --- a/usr.bin/dtc/input_buffer.cc +++ b/usr.bin/dtc/input_buffer.cc @@ -151,7 +151,7 @@ input_buffer::next_token() start = cursor; skip_spaces(); // Parse /* comments - if (((*this)[0] == '/') && ((*this)[1] == '*')) + if ((*this)[0] == '/' && (*this)[1] == '*') { // eat the start of the comment ++(*this); @@ -168,13 +168,14 @@ input_buffer::next_token() // Eat the / ++(*this); } - // Parse // comments - if (((*this)[0] == '/') && ((*this)[1] == '/')) + // Parse // comments and # comments + if (((*this)[0] == '/' && (*this)[1] == '/') || + (*this)[0] == '#') { // eat the start of the comment ++(*this); ++(*this); - // Find the ending * of */ + // Find the ending of the line while (**this != '\n') { ++(*this);