From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#2203: C Mode: C-M-a fails at BOD re_comp, src/regex.c L6534 Date: 17 Jan 2016 22:31:14 -0000 Organization: muc.de e.V. Message-ID: <20160117223114.33668.qmail@mail.muc.de> References: <20090205113645.GA3213@muc.de> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1453069940 16447 80.91.229.3 (17 Jan 2016 22:32:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 17 Jan 2016 22:32:20 +0000 (UTC) Cc: 2203@debbugs.gnu.org To: Alan J Third Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jan 17 23:32:11 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aKvrn-0001q0-Ch for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Jan 2016 23:32:11 +0100 Original-Received: from localhost ([::1]:56128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKvrm-0003Pq-Fw for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Jan 2016 17:32:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKvrj-0003Pk-Ps for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2016 17:32:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKvri-00078K-SF for bug-gnu-emacs@gnu.org; Sun, 17 Jan 2016 17:32:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKvrf-00075S-4D; Sun, 17 Jan 2016 17:32:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aKvre-0002m3-Gz; Sun, 17 Jan 2016 17:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 17 Jan 2016 22:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 2203 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 2203-submit@debbugs.gnu.org id=B2203.14530698789535 (code B ref 2203); Sun, 17 Jan 2016 22:32:02 +0000 Original-Received: (at 2203) by debbugs.gnu.org; 17 Jan 2016 22:31:18 +0000 Original-Received: from localhost ([127.0.0.1]:52150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aKvqv-0002TR-Ib for submit@debbugs.gnu.org; Sun, 17 Jan 2016 17:31:17 -0500 Original-Received: from mail.muc.de ([193.149.48.3]:37849) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aKvqt-0002Pe-Dx for 2203@debbugs.gnu.org; Sun, 17 Jan 2016 17:31:16 -0500 Original-Received: (qmail 33669 invoked by uid 3782); 17 Jan 2016 22:31:14 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.2-RELEASE-p9 (amd64)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111690 Archived-At: Hello, Alan. In article you wrote: > Alan Mackenzie writes: >> In .../src/regex.c put point at BOL6534, "char *" here: >> >> } >> WEAK_ALIAS (__re_compile_pattern, re_compile_pattern) >> ^L >> /* Entry points compatible with 4.2 BSD regex library. We don't define >> them unless specifically requested. */ >> >> #if defined _REGEX_RE_COMP || defined _LIBC >> >> /* BSD has one and only one pattern buffer. */ >> static struct re_pattern_buffer re_comp_buf; >> >> char * <================================= >> # ifdef _LIBC >> /* Make these definitions weak in libc, so POSIX programs can redefine >> these names if they don't use our functions, and still use >> regcomp/regexec below without link errors. */ >> weak_function >> # endif >> re_comp (s) >> const char *s; >> { >> >> >> Do C-M-a. Point doesn't move. >> >> Preliminary investigation: With point on the 'h' of "char *", >> (c-beginning-of-decl-1 nil) should move point one character backwards. >> Instead, it moves to BOL "WEAK_ALIAS". > I just tested this in Emacs 25 and it seems that in every case point > moves back to "WEAK_ALIAS". That is, C-M-a, c-beginning-of-defun, > behaves the same way as (c-beginning-of-decl-1 nil). > I guess that makes it more broken, if more consistent, than when the bug > was raised. What is happening is that CC Mode is spuriously recognising WEAK_ALIAS as an old style "K&R" declaration[*], the line static struct re_pattern_buffer re_comp_buf; being a "type declaration for the parameter re_comp_buf". I'm tightening up the detection of K&R declarations such that in each putative type declaration of an identifier, that identifier must also appear inside the function's arglist. [*] A K&R declaration in C is one looking like this: static PyObject ** unpack_sequence(v, argcnt, why) PyObject **v; int argcnt; enum why_code *why; { rather than the now ubiquitous modern form: static PyObject ** unpack_sequence (PyObject **v, int argcnt, enum why_comde *why) { > Alan Third -- Alan Mackenzie (Nuremberg, Germany).