From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Masatake YAMATO Newsgroups: gmane.emacs.devel Subject: Re: fix the sscanf usage in etags Date: Wed, 09 Aug 2006 23:10:42 +0900 (JST) Message-ID: <20060809.231042.111849761.jet@gyve.org> References: <44D9874B.3040206@swipnet.se> <20060809.165706.55623740.jet@gyve.org> <44D9E111.50807@swipnet.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1155132705 25304 80.91.229.2 (9 Aug 2006 14:11:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 9 Aug 2006 14:11:45 +0000 (UTC) Cc: user42@zip.com.au, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Aug 09 16:11:43 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GAomF-0000Br-Sw for ged-emacs-devel@m.gmane.org; Wed, 09 Aug 2006 16:11:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAomF-0001su-9q for ged-emacs-devel@m.gmane.org; Wed, 09 Aug 2006 10:11:19 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GAolz-0001sF-Hi for emacs-devel@gnu.org; Wed, 09 Aug 2006 10:11:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GAolv-0001rb-QY for emacs-devel@gnu.org; Wed, 09 Aug 2006 10:11:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GAolv-0001rP-Hq for emacs-devel@gnu.org; Wed, 09 Aug 2006 10:10:59 -0400 Original-Received: from [66.187.233.31] (helo=mx1.redhat.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GAoqc-0000M8-M1 for emacs-devel@gnu.org; Wed, 09 Aug 2006 10:15:50 -0400 Original-Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k79EAwIR007512; Wed, 9 Aug 2006 10:10:58 -0400 Original-Received: from pobox.tokyo.redhat.com (pobox.tokyo.redhat.com [172.16.33.225]) by int-mx1.corp.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id k79EAujF002048; Wed, 9 Aug 2006 10:10:57 -0400 Original-Received: from localhost (dhcp98.tokyo.redhat.com [172.16.33.98]) by pobox.tokyo.redhat.com (8.12.8/8.12.8) with ESMTP id k79EArfj010630; Wed, 9 Aug 2006 23:10:53 +0900 Original-To: jan.h.d@swipnet.se In-Reply-To: <44D9E111.50807@swipnet.se> <44D9874B.3040206@swipnet.se> X-Mailer: Mew version 4.2.53 on Emacs 22.0.51 / Mule 5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:58225 Archived-At: > Masatake YAMATO skrev: > > This is the file what I got trouble without my patch. > > > > ... > > > // 7.4: string literal in #line directive shall be a character string > > // literal. > > //E t_6_062.cpp(21): warning: ill formed #line directive: 123 L"wide" > > #line 123 L"wide" > > > > I don't know if etags supports wide characters at all. A line directive like > that is not allowed by ANSI-C as the comment says. I see. In this case, etags should ignore the line. The problem I found was that etags crashed when `#line 123 L"wide"' was given as input. If the crashing can be suppressed, it is enough. > We can switch places between \" and %n and check for ": > > if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1 > && lbp->buffer[start] == '"') > { > char *endp = lbp->buffer + ++start; This works fine. I tested with: const char * buffer = "#line 123 L\"wide\""; const char * buffer = "#line 123 L\"wide\""; const char * buffer = "#line 123L\"wide\""; Masatake YAMATO