emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#14133: closed (24.2; c functions recognition break


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#14133: closed (24.2; c functions recognition breaks on certain preprocessor macros)
Date: Mon, 15 Apr 2013 16:25:01 +0000

Your message dated Mon, 15 Apr 2013 16:19:38 +0000
with message-id <address@hidden>
and subject line Re: bug#14133: 24.2; c functions recognition breaks on certain 
preprocessor macros
has caused the debbugs.gnu.org bug report #14133,
regarding 24.2; c functions recognition breaks on certain preprocessor macros
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
14133: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14133
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.2; c functions recognition breaks on certain preprocessor macros Date: Wed, 3 Apr 2013 12:48:37 +0200
Function coloring, c-beginning-of-defun and c-end-of-defun behaves
strangely if the functions contain ifdef'd code.

For example:
void function_one(void)
{
    // Make the number of spaces before # vary.
    #if defined(DEBUG)
    trap();
    #endif // DEBUG
}


void function_two(void)
{
    // doing nothing
}


The number of spaces that precede the macros seem to influence the
strange behavior.

At first I thought that the c-*-of-defun functions worked if both
C-macros were aligned, but it is not always the case.

It is quite easy to see if the current state is working or not: the
identifier 'function_two' is not colored correctly when the function
recognition fails.

There seems also to be differences depending on the form of the macro:
#if defined(DEBUG)
#if defined DEBUG
#ifdef DEBUG

The cases showing the fault depend on the previous states, the file
content alone is not enough to guarantee seeing the fault.

Examples of code that causes the fault (only function_one is shown for
readability, see above for function_two):

--- 1 ---
1.a.
// -- OK
void function_one(void)
{
    // Make the number of spaces before # vary.
#if defined DEBUG
    trap();
#endif // DEBUG
}

1.b. Add one space before #if -> Fail
1.c. Add one more space before #if -> OK
1.d. Delete the space added in 1.c. -> still OK (although same content
as in 1.b.).


--- 2 ---
2.a.
// --- OK
void function_one(void)
{
    // Make the number of spaces before # vary.
#if defined DEBUG
    trap();
#endif // DEBUG
}

2.b. Add one space before #if -> OK (unlike case 1)
2.c. Add one more space before #if -> Fail
2.d. Delete the space added in 2.c. -> still Fail (although same
content as in 2.b.).
2.e. Remove the last space before #if -> OK


--- 3 ---
3.a.
// --- OK
void function_one(void)
{
    // Make the number of spaces before # vary.
#if defined DEBUG
    trap();
#endif // DEBUG
}

3.b. Add four spaces before #if -> Fail
3.c. Add one space before #endif -> Fail
3.d. Add one space before #endif -> OK
3.e. Delete one space before #endif -> OK (although same content as 3.c)


As far as I can see, the behavior of #ifdef is the same as that of #if
defined without parens. The behavior of #if defined with parens
differs, though.

IIRC, all preprocessor macros should be considered as blank lines when
it comes to function recognition?

--- End Message ---
--- Begin Message --- Subject: Re: bug#14133: 24.2; c functions recognition breaks on certain preprocessor macros Date: Mon, 15 Apr 2013 16:19:38 +0000 User-agent: Mutt/1.5.21 (2010-09-15)
Bug fixed in the trunk.

-- 
Alan Mackenzie (Nuremberg, Germany).


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]