From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: A Soare Newsgroups: gmane.emacs.devel Subject: Re: - c-end-of-defun - ! Date: Wed, 18 Apr 2007 21:36:22 +0200 (CEST) Message-ID: <14139684.372931176924982833.JavaMail.www@wwinf4101> Reply-To: alinsoar@voila.fr NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: sea.gmane.org 1176924997 8846 80.91.229.12 (18 Apr 2007 19:36:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Apr 2007 19:36:37 +0000 (UTC) Cc: "Emacs Dev \[emacs-devel\]" To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 18 21:36:31 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HeFx8-0003l3-NU for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2007 21:36:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeG20-0000ta-71 for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2007 15:41:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HeG1x-0000tH-5W for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:41:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HeG1v-0000sV-Ce for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:41:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeG1v-0000sM-AW for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:41:27 -0400 Original-Received: from smtp2.voila.fr ([193.252.22.175] helo=smtp1.voila.fr) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1HeFx2-0007mI-Tc for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:36:25 -0400 Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf4101.voila.fr (SMTP Server) with ESMTP id D8C6E1C0037B; Wed, 18 Apr 2007 21:36:22 +0200 (CEST) Original-Received: from wwinf4101 (wwinf4101 [172.22.152.28]) by mwinf4101.voila.fr (SMTP Server) with ESMTP id CEFBC1C002BD; Wed, 18 Apr 2007 21:36:22 +0200 (CEST) X-ME-UUID: 20070418193622848.CEFBC1C002BD@mwinf4101.voila.fr X-Originating-IP: [86.107.96.49] X-Wum-Nature: EMAIL-NATURE X-WUM-FROM: |~| X-WUM-TO: |~| X-WUM-CC: |~| X-WUM-REPLYTO: |~| X-detected-kernel: Linux 2.4-2.6 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:69577 Archived-At: Shell I do the patch tomorrow? Or it has already been done? A Soare. > Message du 18/04/07 =C3=A0 20h38 > De : "Alan Mackenzie" > A : "A Soare" , "Andreas Schwab" > Copie =C3=A0 : "Chong Yidong" , emacs-devel@gnu.or= g, bug-cc-mode@gnu.org > Objet : Re: - c-end-of-defun - ! >=20 > 'evening, Alin and Andreas! >=20 > Thank you both very much for reporting this bug! (Andreas: the bug you > reported 2 hours after Alin is the same bug.) >=20 > On Wed, Apr 18, 2007 at 03:17:00PM +0200, A Soare wrote: > >=20 > > int > > function (void) > > { > > int b; > > =20 > > } >=20 > > struct ONE function (void) > > { > > int a; > > =20 > > } >=20 > > struct > > TWO function (void) > > { > > int a; > > =20 > > } >=20 > >=20 > > Here are 3 valid functions written in C. > > Copy them into a buffer in C-MODE, and eval (end-of defun) in the first= one and in the second. >=20 > > In the second case =3D> FAIL. > =20 > > That is because of this code in c-end-of-defun: > >=20 > > ;; Do we need to move forward from the brace to the semicolon? > > (when (eq arg 0) > > (if (c-in-function-trailer-p)=09; after "}" of struct/enum, etc. > > =09 (c-syntactic-re-search-forward ";")) > =20 > > (c-in-function-trailer-p) in our case MUST return NULL. Not the (point)= . > =20 > This is indeed the case. =20 > =20 > > Is really need to call (c-syntactic-re-search-forward ";") here? > =20 > Yes. c-end-of-defun is being fooled by the "struct" in the functions' > return types into thinking the function is actually a struct declaration > like this: >=20 > struct foo { > int bar ; > int baz ; > } blorg ; >=20 > A struct also counts as a defun, and it ends at the first semicolon > following the brace (as contrasted with a function, which ends at the > brace). This is what the (c-syntactic-re-search-forward ";") is for. >=20 > The solution is to analyse the defuns' headers more thoroughly. It > shouldn't be too hard, and shouldn't take too long. >=20 > > Alin Soare. >=20 > --=20 > Alan Mackenzie (Ittersbach, Germany) >=20 >