Subject: bug#28939: 27.0.50; CC-Mode: (C++) Comment directly after quote breaks following lines

From: Bastian Beischer <[email-masked]>
Date: Sun, 22 Oct 2017 10:12:17 +0200

The following file is incorrectly parsed by CC-Mode (font-lock
considers everything after //bar to be a comment, for example):

#include "foo.h"//bar
int main(int argc, char** argv) {
  return 0;
}

This problem is reproduceable from emacs -Q when inserting the above
into a c++-mode buffer.

This is with emacs built from 94281c9a1cc0f756841fdc9b266657853df94a29
on master, but I guess this is relevant for emacs-26 as well.

Cheers
Bastian

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.24)
 of 2017-10-17 built on bastian-desktop
Repository revision: 94281c9a1cc0f756841fdc9b266657853df94a29
Windowing system distributor 'The X.Org Foundation', version 11.0.11905000
Recent messages:
Error during redisplay: (eval (format " Projectile[%s(%s)]" (projectile-project-name))) signaled (error "Not enough arguments for format string") [6 times]
Mark set
Error during redisplay: (eval (format " Projectile[%s(%s)]" (projectile-project-name))) signaled (error "Not enough arguments for format string")
Mark set
Error during redisplay: (eval (format " Projectile[%s(%s)]" (projectile-project-name))) signaled (error "Not enough arguments for format string") [2 times]
Saving file /home/beischer/bla.C...
Wrote /home/beischer/bla.C
Error during redisplay: (eval (format " Projectile[%s(%s)]" (projectile-project-name))) signaled (error "Not enough arguments for format string") [27 times]
Mark set
Error during redisplay: (eval (format " Projectile[%s(%s)]" (projectile-project-name))) signaled (error "Not enough arguments for format string") [6 times]

Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --mandir=/usr/share/man --with-gameuser=:games
 --with-sound=alsa --with-xft --with-modules --with-x-toolkit=gtk3
 --without-gconf --without-gsettings --without-gpm --without-m17n-flt
 --with-xwidgets --without-compress-install 'CFLAGS=-march=native -O2
 -pipe -fstack-protector-strong -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS NOTIFY ACL GNUTLS
LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES
XWIDGETS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: C++//l

Minor modes in effect:
  whitespace-mode: t
  subword-mode: t
  function-args-mode: t
  helm-fuzzier-mode: t
  helm-flx-mode: t
  projectile-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  window-numbering-mode: t
  magit-auto-revert-mode: t
  global-git-commit-mode: t
  diff-auto-refine-mode: t
  async-bytecomp-package-mode: t
  flx-ido-mode: t
  ido-everywhere: t
  global-srecode-minor-mode: t
  srecode-minor-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-scheduler-mode: t
  semantic-idle-scheduler-mode: t
  semantic-decoration-mode: t
  global-semantic-decoration-mode: t
  semantic-highlight-func-mode: t
  global-semantic-highlight-func-mode: t
  semantic-stickyfunc-mode: t
  global-semantic-stickyfunc-mode: t
  semantic-show-parser-state-mode: t
  global-semantic-show-parser-state-mode: t
  semantic-mode: t
  global-ede-mode: t
  ede-minor-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  global-hi-lock-mode: t
  hi-lock-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Load-path shadows:
/home/beischer/.emacs.d/cedet/lisp/speedbar/loaddefs hides /home/beischer/.emacs.d/cedet/lisp/cedet/loaddefs
/home/beischer/.emacs.d/elpa/cmake-mode-20160928.505/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode
/home/beischer/.emacs.d/cedet/lisp/speedbar/loaddefs hides /usr/share/emacs/27.0.50/lisp/loaddefs
/usr/share/emacs/site-lisp/various/buff-menu hides /usr/share/emacs/27.0.50/lisp/buff-menu
~/.emacs.d/lisp/vc-cvs hides /usr/share/emacs/27.0.50/lisp/vc/vc-cvs
~/.emacs.d/cc-mode/cc-engine hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-engine
~/.emacs.d/cc-mode/cc-mode hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-mode
~/.emacs.d/cc-mode/cc-cmds hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-cmds
~/.emacs.d/cc-mode/cc-align hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-align
~/.emacs.d/cc-mode/cc-vars hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-vars
~/.emacs.d/cc-mode/cc-langs hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-langs
~/.emacs.d/cc-mode/cc-awk hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-awk
~/.emacs.d/cc-mode/cc-menus hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-menus
~/.emacs.d/cc-mode/cc-styles hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-styles
~/.emacs.d/cc-mode/cc-guess hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-guess
~/.emacs.d/cc-mode/cc-bytecomp hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-bytecomp
~/.emacs.d/cc-mode/cc-fonts hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-fonts
~/.emacs.d/cc-mode/cc-defs hides /usr/share/emacs/27.0.50/lisp/progmodes/cc-defs

Features:
(shadow sort mail-extr emacsbug sendmail semantic/tag-write misearch
multi-isearch ede/locate semantic/tag-file whitespace cap-words
superword subword semantic/db-file semantic/adebug eieio-datadebug
data-debug cedet-files function-args json map semantic-directory
semantic/ia ido-completing-read+ memoize cus-edit minibuf-eldef
company-oddmuse company-keywords company-etags company-gtags
company-dabbrev-code company-dabbrev company-files company-capf
company-cmake company-xcode company-clang company-semantic company-eclim
company-template company-css company-nxml company-bbdb company-edbi edbi
sql view jedi jedi-core python-environment epc ctable concurrent
deferred auto-complete popup cmake-project helm-fuzzier helm helm-source
helm-multi-match helm-lib helm-flx tempo url url-proxy url-privacy
url-expand url-methods url-history url-cookie url-domsuf url-util
mailcap xml-parse doxymacs projectile ibuf-ext ibuffer ibuffer-loaddefs
dropdown-list yasnippet elec-pair my-term term disp-table ehelp
etags-table etags xref project cmake-mode rx qt-pro pastebin
window-numbering company magit-topgit magit-obsolete magit-blame
magit-stash magit-bisect magit-remote magit-commit magit-sequence
magit-notes magit-worktree magit-branch magit-files magit-refs
magit-status magit esh-var esh-io esh-cmd esh-opt esh-ext esh-proc
esh-arg esh-groups eshell esh-module esh-mode esh-util magit-repos
magit-apply magit-wip magit-log magit-diff smerge-mode magit-core
magit-autorevert autorevert filenotify magit-process magit-margin
magit-mode magit-git magit-section magit-popup git-commit magit-utils
vc-git diff-mode crm log-edit message rmc puny rfc822 mml mml-sec epa
derived epg gnus-util rmail rmail-loaddefs mm-decode mm-bodies mm-encode
mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr
mailabbrev mail-utils gmm-utils mailheader pcvs-util add-log with-editor
cl-extra help-mode async-bytecomp async server buff-menu+ hideshow
flx-ido ido dired-x dired dired-loaddefs ede/cpp-root srecode/mode
semantic/senator srecode/insert srecode/filters srecode/args
semantic/db-mode f dash cl s semantic/bovine/c hideif
semantic/bovine/c-by semantic/lex-spp semantic/idle working fame
semantic/bovine/gcc semantic/dep semantic/bovine semantic/analyze/refs
semantic/decorate/include semantic/db-find semantic/db-ref
semantic/decorate/mode semantic/decorate pulse cedet-devel-load
cogre/srecode cogre cogre/picture-hack rect picture eieio-opt
srecode/find srecode/map semantic/edit srecode/srt-mode srecode/template
srecode/srt-wy semantic/wisent semantic/wisent/wisent srecode/ctxt
srecode/compile srecode/dictionary srecode/table srecode
semantic/canned-configs semantic/ia-sb semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn semantic/db semantic/ctxt
semantic/format semantic/tag-ls semantic/find semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
sb-info ede/speedbar ede/files ede ede/detect ede/base ede/auto
ede/source eieio-compat eieio-base eieio-speedbar speedbar sb-image
ezimage dframe eieio-custom wid-edit cedet cedet-compat inversion
cedet-remove-builtin cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs flymake-proc flymake subr-x
warnings ams-meeting org-element avl-tree generator org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline easy-mmode org-version ob-emacs-lisp ob ob-tangle org-src ob-ref
ob-lob ob-table ob-keys ob-exp ob-comint ob-core ob-eval org-compat
org-macs org-loaddefs find-func cal-menu calendar cal-loaddefs
calc-mouse calc-yank calc-ext calc calc-loaddefs calc-macs hide-lines
ivy flx delsel ivy-overlay ffap thingatpt vc-cvs vc vc-dispatcher pcase
finder-inf tex-site info package easymenu epg-config url-handlers
url-parse url-vars seq edmacro kmacro emacs-x-theme time-date tramp
tramp-compat tramp-loaddefs trampver ucs-normalize shell pcomplete
parse-time format-spec advice auth-source cl-seq eieio byte-opt bytecomp
byte-compile cconv eieio-core cl-macs gv eieio-loaddefs cl-loaddefs
cl-lib password-cache paren grep compile comint ansi-color ring linum
hi-lock cus-start cus-load mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote dbusbind inotify lcms2 dynamic-setting font-render-setting
xwidget-internal move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 2011253 46749)
 (symbols 48 61049 3)
 (miscs 40 3352 2024)
 (strings 32 391097 6013)
 (string-bytes 1 8382878)
 (vectors 16 167928)
 (vector-slots 8 1867169 23438)
 (floats 8 234 385)
 (intervals 56 9521 514)
 (buffers 992 21))