unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#2203: C Mode:  C-M-a fails at BOD re_comp, src/regex.c L6534
@ 2009-02-05 11:36 Alan Mackenzie
  2016-01-15 20:40 ` Alan J Third
       [not found] ` <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 4+ messages in thread
From: Alan Mackenzie @ 2009-02-05 11:36 UTC (permalink / raw)
  To: bug-gnu-emacs

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".

-- 
Alan Mackenzie (Nuremberg, Germany).







^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#2203: C Mode:  C-M-a fails at BOD re_comp, src/regex.c L6534
  2009-02-05 11:36 bug#2203: C Mode: C-M-a fails at BOD re_comp, src/regex.c L6534 Alan Mackenzie
@ 2016-01-15 20:40 ` Alan J Third
       [not found] ` <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 4+ messages in thread
From: Alan J Third @ 2016-01-15 20:40 UTC (permalink / raw)
  To: 2203; +Cc: Alan Mackenzie

Alan Mackenzie <acm@muc.de> 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.

-- 
Alan Third





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#2203: C Mode:  C-M-a fails at BOD re_comp, src/regex.c L6534
       [not found] ` <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org>
@ 2016-01-17 22:31   ` Alan Mackenzie
  2016-01-22 23:06   ` Alan Mackenzie
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2016-01-17 22:31 UTC (permalink / raw)
  To: Alan J Third; +Cc: 2203

Hello, Alan.

In article <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org> you wrote:
> Alan Mackenzie <acm@muc.de> 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).






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#2203: C Mode:  C-M-a fails at BOD re_comp, src/regex.c L6534
       [not found] ` <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org>
  2016-01-17 22:31   ` Alan Mackenzie
@ 2016-01-22 23:06   ` Alan Mackenzie
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Mackenzie @ 2016-01-22 23:06 UTC (permalink / raw)
  To: 2203-done

Bug fixed in branch emacs-25.

In article <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org> you wrote:
> Alan Mackenzie <acm@muc.de> 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.

> -- 
> Alan Third

-- 
Alan Mackenzie (Nuremberg, Germany).






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-22 23:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-05 11:36 bug#2203: C Mode: C-M-a fails at BOD re_comp, src/regex.c L6534 Alan Mackenzie
2016-01-15 20:40 ` Alan J Third
     [not found] ` <mailman.2414.1452890468.843.bug-gnu-emacs@gnu.org>
2016-01-17 22:31   ` Alan Mackenzie
2016-01-22 23:06   ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).