From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Subject: Re: [PATCH 2/2] dtc: cpp co-existence: add support for #line directives Date: Tue, 25 Sep 2012 23:58:00 -0600 Message-ID: <50629968.9040800@wwwdotorg.org> References: <1348527077-27471-1-git-send-email-swarren@wwwdotorg.org> <1348527077-27471-3-git-send-email-swarren@wwwdotorg.org> <20120926043459.GD31993@truffula.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20120926043459.GD31993-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: "devicetree-discuss" To: David Gibson Cc: Stephen Warren , devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org List-Id: devicetree@vger.kernel.org On 09/25/2012 10:34 PM, David Gibson wrote: > On Mon, Sep 24, 2012 at 04:51:17PM -0600, Stephen Warren wrote: >> From: Stephen Warren >> >> Line control directives of the following formats are supported: >> #line LINE "FILE" >> # LINE FILE [FLAGS] >> >> This allows dtc to consume the output of pre-processors, and to provide >> error messages that refer to the original filename, including taking >> into account any #include directives that the pre-processor may have >> performed. > > I like the idea of handling line directives, whichever way we go with > the other cpp-related proposals. The fact that these are > distinguished from a propnodename beginning with # only by the > following digits is more subtle than I'd ideally like, but I think > it's wirth it. > > The only thing I would like to see change is to only recognize line > directives at the beginning of the line (in fact, preferably in column > 0 only). Unfortunately that is going to mean some mucky flex work, > including a new start state, I expect. That turns out to be exceedingly easy; just put ^ at the start of the regex (after the start state specification), and Flex takes care of everything:-)