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

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

cc mode indentation bug


From: Alan Morgan
Subject: cc mode indentation bug
Date: Tue, 11 Mar 2003 17:37:41 +0000

The following is a bug report from an emacs user at our site. I have confirmed
that a vanilla emacs does exhibit this bug as described.

The emacs version and platform concerned are as stated in the message
below. Configuration and build information:

configured using `configure  --with-gcc=no --prefix=/usr/local/src/edcad/gnu 
--with-x-toolkit=motif'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: C
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Regards,

Alan

------- start of forwarded message (RFC 934 encapsulation) -------
Content-Length: 1698
Received: (from address@hidden)
        by camcon.co.uk (8.8.8+Sun/8.8.8) id PAA24708;
        Tue, 11 Mar 2003 15:33:58 GMT
Message-Id: <address@hidden>
From: Roger Sewell <address@hidden>
To: arm
Subject: Bug to report to emacs
Date: Tue, 11 Mar 2003 15:33:58 GMT


Alan,

The following is a bug in GNU Emacs 21.2.1 (sparc-sun-solaris2.6,
OSF/Motif Version 1.2.6) of 2003-01-30 on athene:

If you load the piece of code below as a .cpp file into emacs, set the
region to cover the whole file, and execute M-x indent-region, it gets
transformed into the second fragment below, which is incorrectly
formatted. The reason is the interpretation of the substring
"default:" as the keyword default:.

Correctly formatted:

void main()
{
  int c;

  switch (c)
    {
    case 0:
      cout << "Here is a dummy error message containing the word default: which 
causes a formatting error" << endl;
      cout << "This is the result of the error" << endl;
    case 1:
      cout << "Here is a dummy error message not containing the colon after 
default which does not cause a formatting error" << endl;
      cout << "This is the result of there not being an error" << endl;

    default:
      // do nothing
    }
}

Incorrectly formatted:

void main()
{
  int c;

  switch (c)
    {
    case 0:
      cout << "Here is a dummy error message containing the word default: which 
causes a formatting error" << endl;
                                                                   cout << 
"This is the result of the error" << endl;
    case 1:
      cout << "Here is a dummy error message not containing the colon after 
default which does not cause a formatting error" << endl;
      cout << "This is the result of there not being an error" << endl;

    default:
      // do nothing
    }
}

Would you be able to report this as usual ? Appropriate to add that we
don't need a fix at this point, purpose of report is just so that they
can get it right next time.

TIA,
Roger.

------- end -------




reply via email to

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