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

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

bug#12926: emacs 4.2: cc-mode confused by indented preprocessor statemen


From: Kevin Burge
Subject: bug#12926: emacs 4.2: cc-mode confused by indented preprocessor statements
Date: Sun, 18 Nov 2012 11:15:28 -0600
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.7 (Harue) FLIM/1.14.9 (Goj┼Ź) APEL/10.8 Emacs/24.2 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO)

- If you indent the following code with gcc 4.2, by highlighting lines 06-10
and indenting, it confuses line 07 as the first line of a function rather than
the first line of a statement, and so everything is shifted left.

- If you move the preprocessor lines 02 and 04 back to column 1, it indents
correctly.

- If you change "#if defined(A)" to "#if 0" while still indented, it indents
correctly.

There is just something that cc-mode does not like about indented preprocessor
statements.  4.1 exhibited the same behavior, and prevents us from upgrading
from 23.4.

IMPORTANT: you MUST close and re-open the file between these tests because the
caching in cc-mode interferes with the results.

01 int f(void) {
02    #if defined(A)
03    printf("test\n");
04    #endif
05
06    if (test) {
07        int i = 0;
08        printf();
09    }
10 }

The source:

int f(void) {
    #if defined(A)
    printf("test\n");
    #endif

    if (test) {
        int i = 0;
        printf();
    }
}

Thank you,
Kevin Burge





reply via email to

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