From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 14 19:29:10 2018 Received: (at submit) by debbugs.gnu.org; 15 Jan 2018 00:29:10 +0000 Received: from localhost ([127.0.0.1]:56477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1easeD-0005pF-VF for submit@debbugs.gnu.org; Sun, 14 Jan 2018 19:29:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:56375) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1earUl-0004Aq-PM for submit@debbugs.gnu.org; Sun, 14 Jan 2018 18:15:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1earUf-0005Gq-5x for submit@debbugs.gnu.org; Sun, 14 Jan 2018 18:15:14 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40246) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1earUf-0005Gb-2k for submit@debbugs.gnu.org; Sun, 14 Jan 2018 18:15:13 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40210) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1earUd-0003E4-GD for bug-gnu-emacs@gnu.org; Sun, 14 Jan 2018 18:15:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1earUZ-0005As-3j for bug-gnu-emacs@gnu.org; Sun, 14 Jan 2018 18:15:11 -0500 Received: from smtp-out-3.talktalk.net ([62.24.135.67]:21097) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1earUY-00059f-Nn for bug-gnu-emacs@gnu.org; Sun, 14 Jan 2018 18:15:07 -0500 Received: from deadstar ([92.19.36.62]) by smtp.talktalk.net with SMTP id arUVeTuqjCbAZarUVeY6Jw; Sun, 14 Jan 2018 23:15:04 +0000 X-Originating-IP: [92.19.36.62] X-Spam: 0 X-OAuthority: v=2.2 cv=JvuBlIwC c=1 sm=1 tr=0 a=N5+SBwGB4EyPIOK9O3WKFg==:117 a=N5+SBwGB4EyPIOK9O3WKFg==:17 a=aR16PxjQAAAA:8 a=25AyJuR6OdVzTiwUCgsA:9 a=qYvUXXcDV_cI85pd:21 a=VnJ2qY-m3b7TOGHs:21 a=zbFvvTOBjyH4ze5LlUjX:22 From: gaetan.allaert@belgacom.net (=?utf-8?Q?Ga=C3=A9tan?= Allaert) To: bug-gnu-emacs@gnu.org Subject: 25.1; cc-mode (C++) : bad indentation on function closing curly brackets Date: Sun, 14 Jan 2018 23:13:23 +0000 Message-ID: <87r2qsc9v0.fsf@deadstar.home.uk> MIME-Version: 1.0 Content-Type: text/plain X-CMAE-Envelope: MS4wfLJcEJ/RKZ+Mm/vYBpizQouoqOzjAt4OIQb3dIDd+XKqGwMzUpv5PAT8MIX+4NIyOxVAN5NoJrzTqBGGtUJQfpfZMDYEVPnbESZDg8iqSckn+FPqZOGJ AqylDHPxXz9wS0gOZDxq8Clmqb9zC+m0n+GxEBIxDRNGaA22FXUIwyjM X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 14 Jan 2018 19:29:08 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) It is about an indentation issue in C++. The closing curly bracket at the end of the function is wrongly indented when: 1. at least one base_1 exists (the comma at the end of base_1 is required); 2. base_2 is the last call before the opening curly bracket of the function; 3. base_2 has only 1 argument that must be a symbol, not a literal or a string. Example: foo_good::foo_good (int arg_1, int arg_2) : base_1 (), base_2 (arg_1, arg_2) { } // good indentation foo_bad::foo_bad (int arg_1, int arg_2) : base_1 (), base_2 (arg_1) { } // bad identation Thanks to have a look at this issue. In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-15, modified by Debian built on trouble Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 System Description: Debian GNU/Linux 9.3 (stretch) Configured using: 'configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs25:/etc/emacs:/usr/local/share/emacs/25.1/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.1/site-lisp:/usr/share/emacs/site-lisp --with-sound=alsa --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fdebug-prefix-map=/build/emacs25-wN2qS3/emacs25-25.1+1=. -fstack-protector-strong -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LANG: en_GB.UTF-8 locale-coding-system: utf-8-unix Major mode: C++/l Minor modes in effect: show-paren-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 blink-cursor-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 Recent messages: Mark set [2 times] Replaced 2 occurrences Saving file /home/allaert/bug.cpp... Wrote /home/allaert/bug.cpp (No changes need to be saved) [2 times] Making completion list... Quit Mark set Saving file /home/allaert/bug.cpp... Wrote /home/allaert/bug.cpp next-line: End of buffer Load-path shadows: /usr/share/emacs/25.1/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs25/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs/25.1/site-lisp/slime/lib/ert hides /usr/share/emacs/25.1/lisp/emacs-lisp/ert /usr/share/emacs/25.1/site-lisp/slime/lib/ert-x hides /usr/share/emacs/25.1/lisp/emacs-lisp/ert-x Features: (shadow sort mail-extr emacsbug message dired format-spec rfc822 mml mml-sec password-cache epg gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils tabify dabbrev cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs multiple-cursors mc-hide-unmatched-lines-mode mc-separate-operations rectangular-region-mode mc-mark-pop mc-mark-more thingatpt mc-cycle-cursors mc-edit-lines multiple-cursors-core advice rect solarized-theme solarized-definitions finder-inf package epg-config seq byte-opt gv bytecomp byte-compile cl-extra help-mode easymenu cconv edmacro kmacro cl-loaddefs pcase cl-lib paren cus-start cus-load slime-autoloads haskell-mode-autoloads time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev 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 dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 231074 14250) (symbols 48 29159 1) (miscs 40 95 375) (strings 32 49655 7602) (string-bytes 1 1441279) (vectors 16 22232) (vector-slots 8 568868 6249) (floats 8 204 199) (intervals 56 481 133) (buffers 976 19)) From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 19 13:08:24 2018 Received: (at 30115) by debbugs.gnu.org; 19 Jan 2018 18:08:24 +0000 Received: from localhost ([127.0.0.1]:35202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecb5U-000074-6e for submit@debbugs.gnu.org; Fri, 19 Jan 2018 13:08:24 -0500 Received: from colin.muc.de ([193.149.48.1]:33890 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1ecb5T-00006r-4G for 30115@debbugs.gnu.org; Fri, 19 Jan 2018 13:08:23 -0500 Received: (qmail 60376 invoked by uid 3782); 19 Jan 2018 18:08:21 -0000 Received: from acm.muc.de (p548C7496.dip0.t-ipconnect.de [84.140.116.150]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 19 Jan 2018 19:08:21 +0100 Received: (qmail 6149 invoked by uid 1000); 19 Jan 2018 18:01:36 -0000 Date: Fri, 19 Jan 2018 18:01:36 +0000 To: =?iso-8859-1?Q?Ga=E9tan?= Allaert Subject: Re: bug#30115: 25.1; cc-mode (C++) : bad indentation on function closing curly brackets Message-ID: <20180119180136.GA6102@ACM> References: <87r2qsc9v0.fsf@deadstar.home.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87r2qsc9v0.fsf@deadstar.home.uk> User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 30115 Cc: 30115@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello, Gaétam/ On Sun, Jan 14, 2018 at 23:13:23 +0000, Gaétan Allaert wrote: > It is about an indentation issue in C++. > The closing curly bracket at the end of the function is wrongly indented > when: > 1. at least one base_1 exists (the comma at the end of base_1 is > required); > 2. base_2 is the last call before the opening curly bracket of the > function; > 3. base_2 has only 1 argument that must be a symbol, not a literal or a > string. > Example: > foo_good::foo_good (int arg_1, int arg_2) : > base_1 (), > base_2 (arg_1, arg_2) { > } // good indentation > foo_bad::foo_bad (int arg_1, int arg_2) : > base_1 (), > base_2 (arg_1) { > } // bad identation > Thanks to have a look at this issue. > In GNU Emacs 25.1.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) > of 2017-09-15, modified by Debian built on trouble > Windowing system distributor 'The X.Org Foundation', version 11.0.11902000 > System Description: Debian GNU/Linux 9.3 (stretch) [ .... ] Thanks for taking the trouble to report this bug, and thanks even more for cutting your example down to a concise, easy to work with snippet. It seems already to be fixed in the emacs-26 branch, the fix being for an entirely different symptom, but appears to fix this, too. It will be some time before Emacs 26 gets released. In the meantime, can I ask you to apply the following patch to cc-engine.el in your Emacs 25.1 (in .../emacs/lisp/progmodes), compile it, and test it with your real code. (If you want any help applying the patch or compiling the file, feel free to contact me by private mail.) Would you please let me know how well it solves the problem in your real code. Thanks. --- cc-engine.20180119.eeel 2017-10-01 17:14:49.185254672 +0000 +++ cc-engine.el 2018-01-19 17:49:09.308202347 +0000 @@ -7615,8 +7615,10 @@ ;; CASE 11 (when (and got-identifier - (not context) (looking-at c-after-suffixed-type-decl-key) + (or (eq context 'top) + (and (eq context nil) + (match-beginning 1))) (if (and got-parens (not got-prefix) (not got-suffix) @@ -8287,7 +8289,7 @@ (c-forward-objc-directive))) (setq id-start - (car-safe (c-forward-decl-or-cast-1 (c-point 'bosws) nil nil))) + (car-safe (c-forward-decl-or-cast-1 (c-point 'bosws) 'top nil))) (< id-start beg) ;; There should not be a '=' or ',' between beg and the -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 19 13:27:31 2018 Received: (at control) by debbugs.gnu.org; 19 Jan 2018 18:27:31 +0000 Received: from localhost ([127.0.0.1]:35234 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecbNy-0000Zs-QQ for submit@debbugs.gnu.org; Fri, 19 Jan 2018 13:27:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:46030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ecbNw-0000ZZ-Pz for control@debbugs.gnu.org; Fri, 19 Jan 2018 13:27:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ecbNr-0001wK-55 for control@debbugs.gnu.org; Fri, 19 Jan 2018 13:27:23 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:36340) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ecbNr-0001vz-1X for control@debbugs.gnu.org; Fri, 19 Jan 2018 13:27:23 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1ecbNq-0005uf-RJ for control@debbugs.gnu.org; Fri, 19 Jan 2018 13:27:22 -0500 Subject: control message for bug 30115 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Fri, 19 Jan 2018 13:27:22 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) close 30115 26.1 From unknown Mon Aug 18 02:32:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 17 Feb 2018 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator