Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jun 2014 06:16:34 +0000 (UTC)
From:      Rui Paulo <rpaulo@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267318 - head/usr.bin/dtc
Message-ID:  <201406100616.s5A6GY4Q093247@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rpaulo
Date: Tue Jun 10 06:16:34 2014
New Revision: 267318
URL: http://svnweb.freebsd.org/changeset/base/267318

Log:
  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 #.

Modified:
  head/usr.bin/dtc/input_buffer.cc

Modified: head/usr.bin/dtc/input_buffer.cc
==============================================================================
--- head/usr.bin/dtc/input_buffer.cc	Tue Jun 10 06:04:25 2014	(r267317)
+++ head/usr.bin/dtc/input_buffer.cc	Tue Jun 10 06:16:34 2014	(r267318)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406100616.s5A6GY4Q093247>