GNU bug report logs -
#23901
CC Mode 5.33 (Java/l); Wrong indentation of fallthrough switch/case with strings
Previous Next
Full log
Message #19 received at 23901 <at> debbugs.gnu.org (full text, mbox):
Hello, Jostein.
On Wed, Jul 06, 2016 at 03:56:39PM +0200, Jostein Kjønigsen wrote:
> On Wed, Jul 6, 2016, at 01:55 PM, Alan Mackenzie wrote:
[ .... ]
> > The problem appears to be in the CC Mode variable
> > `c-nonlabel-token-key', which specifies things which can't be in a
> > label. The Java value includes the character '"', presumably from a
> > period in ancient history when strings in Java couldn't be case labels.
> > Please try out the following fix, and please confirm that it has fixed
> > the bug, or tell me what is still not right. The file cc-langs.el is in
> > the directory ..../lisp/progmodes/.
> > Note that after applying the patch, you need to recompile, at the very
> > least, cc-langs.el, cc-fonts.el, cc-engine.el, cc-mode.el. (Or just
> > recompile all of cc-*.el).
> > diff -r 2fcfc6e054b3 cc-langs.el
> > --- a/cc-langs.el Sun Jul 03 17:54:20 2016 +0000
> > +++ b/cc-langs.el Wed Jul 06 11:45:48 2016 +0000
> > @@ -3233,8 +3233,8 @@
> > (append (c-lang-const c-label-kwds)
> > (c-lang-const c-protection-kwds))
> > :test 'string-equal)))
> > - ;; Don't allow string literals, except in AWK. Character constants
> > are OK.
> > - (c objc java pike idl) (concat "\"\\|"
> > + ;; Don't allow string literals, except in AWK and Java. Character
> > constants are OK.
> > + (c objc pike idl) (concat "\"\\|"
> > (c-lang-const c-nonlabel-token-key))
> > ;; Also check for open parens in C++, to catch member init lists in
> > ;; constructors. We normally allow it so that macros with arguments
> >> Emacs : GNU Emacs 25.1.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)
> >> of 2016-04-15
> >> Package: CC Mode 5.33 (Java/l)
> >> Buffer Style: java
> >> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> >> gen-string-delim gen-comment-delim syntax-properties 1-bit)
> > [ CC Mode state appreciated and snipped. ]
> >> --
> >> Åsmund Grammeltvedt
> > --
> > Alan Mackenzie (Nuremberg, Germany).
> Hey Alan.
> Thanks for the excellent response.
> Quick dislaimer: I'm the current csharp-mode maintainer, and this bug
> was originally issued for csharp-mode. As we discovered the same bug
> was found in java-mode which csharp-mode is based on, we suggested
> reporting the error upstream.
> I can confirm that this patch does indeed fix the indentation issue,
> also in csharp-mode, but unfortunately it seems to have some
> side-effects besides just indentation.
> csharp-mode has a small suite of automated test to verify behaviour,
> fontification, indentation, imenu-results, etc.
> After applying your patch and recompiling all cc-mode *.el-files, two
> of our tests which used to be OK are now failing. They're both related
> to fontification: one for #compiler directives and another for
> string-literal termination.
> To me, these kind of side-effects seems a bit unexpected. Would it be
> OK to ask you for some feedback? Basically all you need to reproduce is
> doing the following:
Things are rarely that simple. :-(
> > git clone https://github.com/josteink/csharp-mode
> > cd csharp-mode
> > make clean && make test
On the make test, I get the following messages, the last ones being an
error:
"/usr/local/bin/emacs" -Q -batch -L . -l csharp-mode-tests.el -f
ert-run-tests-batch-and-exit
Contacting host: melpa.org:443
Opening TLS connection to `melpa.org'...
Opening TLS connection with `gnutls-cli --insecure -p 443 melpa.org'...
Opening TLS connection with `gnutls-cli --insecure -p 443
melpa.org'...done
Opening TLS connection to `melpa.org'...done
Saving file /home/acm/.emacs.d/elpa/archives/melpa/archive-contents...
Wrote /home/acm/.emacs.d/elpa/archives/melpa/archive-contents
Contacting host: elpa.gnu.org:80
Saving file /home/acm/.emacs.d/elpa/archives/gnu/archive-contents...
Wrote /home/acm/.emacs.d/elpa/archives/gnu/archive-contents
Package `emacs-24.4' is unavailable
makefile:22: recipe for target 'test' failed
make: *** [test] Error 255
References to a package `emacs-24.4' aren't conducive to a good night's
sleep. ;-)
> I don't want to bother you too much with third-party code, but thought
> you may find it interesting none the less, since this may also affect
> other cc-mode derived modes.
Certainly, yes. But maybe it might be simpler if you could describe the
two test cases that fail, and how to reproduce the failures starting from
emacs -Q, loading csharp-mode. I've got a copy of the csharp-mode
repository, including the testing files.
> --
> Jostein Kjønigsen
> jostein <at> kjonigsen.net / jostein <at> secure.kjonigsen.net
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 8 years and 355 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.