GNU bug report logs -
#12527
24.2; idented preprocessor directives confusing cc-mode indent
Previous Next
Reported by: Kevin Burge <kcburge <at> gmail.com>
Date: Thu, 27 Sep 2012 19:41:01 UTC
Severity: normal
Found in version 24.2
Fixed in version 24.5
Done: Alex <agrambot <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
close 12527 24.5
quit
Kevin Burge <kcburge <at> gmail.com> writes:
> Summary: Indenting the preprocessor blocks at least 1 space completely
> throws off the cc-mode indentation for anything after the
> preprocessor block.
>
> To reproduce: Create the simple file "test.cpp":
>
> ===
> int f(void) {
> #if defined(A)
> printf("test\n");
> #endif
>
> if (test) {
> int i = 0;
> }
> }
> ===
>
> IMPORTANT: "#if.....#endif" block MUST be indented at least 1 space.
>
> If you navigate inside the "if (test)" block and hit tab, it
> un-indents the line, and any lines after it, to the end of the file.
> If you reindent the entire file, it works just fine, because the
> indented preprocessor directives, which works around the problem.
>
> You have to play around with this, too. There are certain variations
> of the #if line that affect the behavior. And, each time you test,
> you MUST re-open the file, because the caching seems to completely
> throw it off.
>
> I.e. if you change the #if block to
>
> ===
> #if 0
> printf("test\n");
> #endif
> ===
>
> And re-load the file, then try to indent the "if (test)" block, it
> does what it should. Also, changing it to (and reloading):
>
> ===
> #if A
> printf("test\n");
> #endif
> ===
>
> Is sufficient to break it again. So, it seems like whatever follows
> the #if affects the behavior.
This appears to work fine in 24.5.
This bug report was last modified 9 years and 3 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.