GNU bug report logs - #23775
25.0.95.2; c-mode: Incorrect indentation and function bundery detection

Previous Next

Packages: cc-mode, emacs;

Reported by: Rolf Ade <rolf <at> pointsman.de>

Date: Thu, 16 Jun 2016 01:07:02 UTC

Severity: minor

Tags: wontfix

Found in version 25.0.95.2

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Rolf Ade <rolf <at> pointsman.de>
To: 23775 <at> debbugs.gnu.org
Subject: bug#23775: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection
Date: Thu, 16 Jun 2016 03:05:43 +0200
emacs -Q

Open some empty buffer foo.c and put it into c-mode if already is
(M-x c-mdoe). Insert this C code into it:

#define foo
int main (void) {
  int a=0;
  int b=0;
#ifdef foo
  if (a==0) {
#else
    if (b==0) {
#endif
      return 0;
    }
  }

I've inserted it here as emacs -Q indents it, this is the indentation
part of the report.

Place the point at the beginning of function foo, then call
c-end-of-defun, C-M-e by default in emacs -Q. Bell rings, point is
before the last charater of the first line of main, here:

int main (void) _P_{

(which is clearly not the end of the function) and prompts me in the
mini-buffer: "forward-sexp: Scan error: "Unbalanced parentheses", 29,
133"

However well advised such code is, gcc foo.c just compilies.




This bug report was last modified 9 years and 41 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.