Subject: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection

From: Rolf Ade <[email-masked]>
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.