Received: (at submit) by debbugs.gnu.org; 12 Jun 2018 21:56:19 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 12 17:56:19 2018 Received: from localhost ([127.0.0.1]:45475 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1fSrH1-0001Hb-42 for submit <at> debbugs.gnu.org; Tue, 12 Jun 2018 17:56:19 -0400 Received: from mail-qt0-f172.google.com ([209.85.216.172]:40197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <raeburn@HIDDEN>) id 1fSrGy-0001HK-63 for submit <at> debbugs.gnu.org; Tue, 12 Jun 2018 17:56:16 -0400 Received: by mail-qt0-f172.google.com with SMTP id q6-v6so548584qtn.7 for <submit <at> debbugs.gnu.org>; Tue, 12 Jun 2018 14:56:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=KA0S7sgpeWqvA0gWOuNrmdhZww+5y5RfCrL4MdzbLpU=; b=JGGUP8oC8aez1MbTZ51q3m5MZozbFsktlHWBRmShjNBSd4TShKsNCSdNDIBtGUqNlw 0mZ1Q2dm1TZQozEt5nkWtNVlLwObsWn+WU4+GOocWKXuZvLw2MQfUaV5s1yY7zP4SMqn fU8lSIZoODP01W6wXYoEhJR71ovFJuVd2kOsji5ko2XF4MBaooyZuJibC6XKnVc22fIc NtOUilt6tyVEPjfjYoEWNnTVh/MmM9MqeNOA9cwy7QGx4LD0KlDB/ylSUluF9WXgfwxN Frctnzc55G15zsvnSW7M8pTuqz3znfQTjNMY/ZDL/LLsqXcFqFJ01ADW9FXRT3O6Icdv Afcw== X-Gm-Message-State: APt69E0eNuBIwFMdfkQr+kYYe//xV0aErYsPpW7sEUXeU8Qukik9d6Kp Pe3f3jra8P+ZuqTxHlKqrDazrA== X-Google-Smtp-Source: ADUXVKIW+nInCYPvRvG/2Y/WCALa5n1ioyzvNFIelaY5TFcDA9/9MnfY0OEoKNEZgTC1DmoejOKvIA== X-Received: by 2002:ac8:3655:: with SMTP id n21-v6mr2348605qtb.330.1528840570556; Tue, 12 Jun 2018 14:56:10 -0700 (PDT) Received: from crash (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id q1-v6sm980103qtk.45.2018.06.12.14.56.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 14:56:09 -0700 (PDT) From: Ken Raeburn <raeburn@HIDDEN> To: submit <at> debbugs.gnu.org Subject: CC Mode 5.33.1 (C/*l); compound literal indentation X-Debbugs-Package: cc-mode Date: Tue, 12 Jun 2018 17:56:08 -0400 Message-ID: <8736xrbrev.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Indentation is inconsistent for field initializers in compound literals, and it appears to be influenced by context: struct foo f3() { int x =3D 42; return (struct foo) { .a =3D 1, .b =3D 2, .c =3D 3, }; } The ".b" and ".c" lines are indented two positions further than the ".a" line. They should be consistent. Syntatic analysis: Start of ".a" line is ((statement-block-intro 469)) Start of ".b" line and start of ".c" line are ((defun-block-intro 469) (statement-cont 469)) Emacs 25.3 analyzed and indented this one the same way. Without the extra initial statement in the function, the indentation comes out differently: struct foo f3() { return (struct foo) { .a =3D 1, .b =3D 2, .c =3D 3, }; } The ".a" line is indented two positions from the start of "return". The other two are indented three positions relative to the "{", making their position sensitive to the length of the type name. While I could see an argument for changing the indentation to be relative to the braces, I can also see an argument for the old way too, and I think I liked the old way better. (Bug #27402 may be related?) If this was intentional, do we have a knob for picking between the two? In any case, the indentation of the three lines should be consistent here too. Syntactic analysis: Start of ".a" line is ((statement-block-into 220)) Start of ".b" line and start of ".c" line are ((brace-list-intro 220) (statement-cont 220)) Under Emacs 25.3, these had defun-block-intro instead of brace-list-intro, and were indented two columns further than the ".a" line, which was also wrong. void f3() { y =3D (struct foo) { .a =3D 1, .b =3D 2, .c =3D 3, }; } The ".a" line is indented one column past the "{". Syntactic analysis: The ".a" line is ((brace-list-intro 563)) The ".b" and ".c" lines are ((brace-list-entry 602)) Emacs 25.3 indented all three lines two columns past the "y", and had a similar syntactic analysis of the lines, so this is arguably a regression. struct foo f3x() { return (struct foo) { 1, 2, 3, }; } Here, without the designated initializer syntax, it's consistently two columns further than "return" for the "1", and two columns further for the following values. Adding an extra variable declaration at the start of the function doesn't change the result. This should probably be consistent with the indentation for the designated-initializer syntax. Emacs 25.3 indented all of the initializer values two columns past the "return", and lined the "}" up with the "return, so this is a regression. Emacs : GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30) of 2018-05-31 Package: CC Mode 5.33.1 (C/*l) Buffer Style: user c-emacs-features: (pps-extended-state col-0-paren posix-char-classes gen-st= ring-delim gen-comment-delim syntax-properties 1-bit) current state: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D (setq c-basic-offset 2 c-comment-only-line-offset 0 c-indent-comment-alist '((anchored-comment column . 0) (end-block space . = 1) (cpp-end-block space . 2)) c-indent-comments-syntactically-p nil c-block-comment-prefix "* " c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "#+") (other . "//+\\|\\**")) c-doc-comment-style '((java-mode . javadoc) (pike-mode . autodoc) (c-mode . gtkdoc)) c-cleanup-list '(scope-operator) c-hanging-braces-alist '((brace-list-open) (brace-entry-open) (statement-cont) (substatement-open after) (block-close . c-snug-do-while) (extern-lang-open after) (namespace-open after) (module-open after) (composition-open after) (inexpr-class-open after) (inexpr-class-close before) (arglist-cont-nonempty)) c-hanging-colons-alist nil c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist) c-backslash-column 48 c-backslash-max-column 72 c-special-indent-hook '(c-gnu-impose-minimum) c-label-minimum-indentation 1 c-offsets-alist '((inexpr-class . +) (inexpr-statement . +) (lambda-intro-cont . +) (inlambda . c-lineup-inexpr-block) (template-args-cont c-lineup-template-args +) (incomposition . +) (inmodule . +) (innamespace . +) (inextern-lang . +) (composition-close . 0) (module-close . 0) (namespace-close . 0) (extern-lang-close . 0) (composition-open . 0) (module-open . 0) (namespace-open . 0) (extern-lang-open . 0) (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call + ) (objc-method-args-cont . c-lineup-ObjC-method-args) (objc-method-intro . [0]) (friend . 0) (cpp-define-intro c-lineup-cpp-define +) (cpp-macro-cont . +) (cpp-macro . [0]) (inclass . +) (stream-op . c-lineup-streamop) (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist ) (arglist-cont c-lineup-gcc-asm-reg 0) (comment-intro c-lineup-knr-region-comment c-lineup-comment ) (catch-clause . 0) (else-clause . 0) (do-while-closure . 0) (access-label . -) (case-label . 0) (substatement . +) (statement-case-intro . +) (statement . 0) (brace-entry-open . 0) (brace-list-entry . c-lineup-under-anchor) (brace-list-close . 0) (block-close . 0) (block-open . 0) (inher-cont . c-lineup-multi-inher) (inher-intro . +) (member-init-cont . c-lineup-multi-inher) (member-init-intro . +) (annotation-var-cont . +) (annotation-top-cont . 0) (topmost-intro . 0) (knr-argdecl . 0) (func-decl-cont . +) (inline-close . 0) (class-close . 0) (class-open . 0) (defun-block-intro . +) (defun-close . 0) (defun-open . 0) (c . c-lineup-C-comments) (string . c-lineup-dont-change) (topmost-intro-cont . c-lineup-topmost-intro-cont) (brace-list-intro . +) (brace-list-open . 0) (inline-open . +) (arglist-close . +) (arglist-intro . +) (statement-cont . +) (statement-case-open . 0) (label . 2) (substatement-label . 2) (substatement-open . +) (knr-argdecl-intro . +) (statement-block-intro . +) ) c-buffer-is-cc-mode 'c-mode c-tab-always-indent t c-syntactic-indentation t c-syntactic-indentation-in-macros t c-ignore-auto-fill '(string cpp code) c-auto-align-backslashes t c-backspace-function 'backward-delete-char-untabify c-delete-function 'delete-char c-electric-pound-behavior '(alignleft) c-default-style '((java-mode . "java") (awk-mode . "awk") (other . "gnu")) c-enable-xemacs-performance-kludge-p nil c-old-style-variable-behavior nil defun-prompt-regexp nil tab-width 8 comment-column 32 parse-sexp-ignore-comments t parse-sexp-lookup-properties t auto-fill-function nil comment-multi-line t comment-start-skip "\\(//+\\|/\\*+\\)\\s *" fill-prefix nil fill-column 79 paragraph-start "[ ]*\\(//+\\|\\**\\)[ ]*$\\|^\f" adaptive-fill-mode t adaptive-fill-regexp "[ ]*\\(//+\\|\\**\\)[ ]*\\([ ]*\\([-=E2=80=93!|#%= ;>*=C2=B7=E2=80=A2=E2=80=A3=E2=81=83=E2=97=A6]+[ ]*\\)*\\)" )
Ken Raeburn <raeburn@HIDDEN>
:bug-cc-mode@HIDDEN
.
Full text available.bug-cc-mode@HIDDEN
:bug#31806
; Package cc-mode
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.